guy 7 years ago
parent
commit
2ef3c1eacf
  1. 19
      bi/base.js
  2. 19
      dist/base.js
  3. 19
      dist/bundle.js
  4. 70
      dist/bundle.min.js

19
bi/base.js

@ -2425,6 +2425,10 @@ BI.Canvas = BI.inherit(BI.Widget, {
this._queue = []; this._queue = [];
}, },
mounted: function () {
this.stroke();
},
_getContext: function () { _getContext: function () {
if (!this.ctx) { if (!this.ctx) {
this.ctx = this.canvas.getContext('2d'); this.ctx = this.canvas.getContext('2d');
@ -2509,20 +2513,19 @@ BI.Canvas = BI.inherit(BI.Widget, {
this._getContext().clearRect(0, 0, this.canvas.width, this.canvas.height); this._getContext().clearRect(0, 0, this.canvas.width, this.canvas.height);
}, },
stroke: function (callback) { stroke: function () {
var self = this; var ctx = this._getContext();
BI.nextTick(function () { if(!ctx){
var ctx = self._getContext(); return false;
BI.each(self._queue, function (i, q) { }
BI.each(this._queue, function (i, q) {
if (BI.isFunction(ctx[q.k])) { if (BI.isFunction(ctx[q.k])) {
ctx[q.k].apply(ctx, q.v); ctx[q.k].apply(ctx, q.v);
} else { } else {
ctx[q.k] = q.v; ctx[q.k] = q.v;
} }
}); });
self._queue = []; this._queue = [];
callback && callback();
});
} }
}); });
BI.shortcut("bi.canvas", BI.Canvas);/** BI.shortcut("bi.canvas", BI.Canvas);/**

19
dist/base.js vendored

@ -2425,6 +2425,10 @@ BI.Canvas = BI.inherit(BI.Widget, {
this._queue = []; this._queue = [];
}, },
mounted: function () {
this.stroke();
},
_getContext: function () { _getContext: function () {
if (!this.ctx) { if (!this.ctx) {
this.ctx = this.canvas.getContext('2d'); this.ctx = this.canvas.getContext('2d');
@ -2509,20 +2513,19 @@ BI.Canvas = BI.inherit(BI.Widget, {
this._getContext().clearRect(0, 0, this.canvas.width, this.canvas.height); this._getContext().clearRect(0, 0, this.canvas.width, this.canvas.height);
}, },
stroke: function (callback) { stroke: function () {
var self = this; var ctx = this._getContext();
BI.nextTick(function () { if(!ctx){
var ctx = self._getContext(); return false;
BI.each(self._queue, function (i, q) { }
BI.each(this._queue, function (i, q) {
if (BI.isFunction(ctx[q.k])) { if (BI.isFunction(ctx[q.k])) {
ctx[q.k].apply(ctx, q.v); ctx[q.k].apply(ctx, q.v);
} else { } else {
ctx[q.k] = q.v; ctx[q.k] = q.v;
} }
}); });
self._queue = []; this._queue = [];
callback && callback();
});
} }
}); });
BI.shortcut("bi.canvas", BI.Canvas);/** BI.shortcut("bi.canvas", BI.Canvas);/**

19
dist/bundle.js vendored

@ -28166,6 +28166,10 @@ BI.Canvas = BI.inherit(BI.Widget, {
this._queue = []; this._queue = [];
}, },
mounted: function () {
this.stroke();
},
_getContext: function () { _getContext: function () {
if (!this.ctx) { if (!this.ctx) {
this.ctx = this.canvas.getContext('2d'); this.ctx = this.canvas.getContext('2d');
@ -28250,20 +28254,19 @@ BI.Canvas = BI.inherit(BI.Widget, {
this._getContext().clearRect(0, 0, this.canvas.width, this.canvas.height); this._getContext().clearRect(0, 0, this.canvas.width, this.canvas.height);
}, },
stroke: function (callback) { stroke: function () {
var self = this; var ctx = this._getContext();
BI.nextTick(function () { if(!ctx){
var ctx = self._getContext(); return false;
BI.each(self._queue, function (i, q) { }
BI.each(this._queue, function (i, q) {
if (BI.isFunction(ctx[q.k])) { if (BI.isFunction(ctx[q.k])) {
ctx[q.k].apply(ctx, q.v); ctx[q.k].apply(ctx, q.v);
} else { } else {
ctx[q.k] = q.v; ctx[q.k] = q.v;
} }
}); });
self._queue = []; this._queue = [];
callback && callback();
});
} }
}); });
BI.shortcut("bi.canvas", BI.Canvas);/** BI.shortcut("bi.canvas", BI.Canvas);/**

70
dist/bundle.min.js vendored

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save