Skip to content

Commit

Permalink
fix: cacheMixin load image bug
Browse files Browse the repository at this point in the history
  • Loading branch information
06wj committed Apr 26, 2017
1 parent 560bdf8 commit 91affbb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/view/CacheMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ var CacheMixin = /** @lends CacheMixin# */ {
* @param {Boolean} forceUpdate 是否强制更新缓存
*/
cache: function(forceUpdate){
if(forceUpdate || this._cacheDirty || !this._cacheImage){
if(forceUpdate || this._cacheDirty || !this.drawable){
this.updateCache();
}
},
Expand All @@ -59,10 +59,10 @@ var CacheMixin = /** @lends CacheMixin# */ {
_cacheCanvas.width = this.width;
_cacheCanvas.height = this.height;
this._draw(_cacheContext);
this._cacheImage = new Image();
this._cacheImage.src = _cacheCanvas.toDataURL();
this.drawable = this.drawable||new Drawable();
this.drawable.init(this._cacheImage);
this.drawable.init({
image:_cacheCanvas.toDataURL()
});
this._cacheDirty = false;
}
},
Expand Down

0 comments on commit 91affbb

Please sign in to comment.