浏览代码

Better fix

Popov72 5 年之前
父节点
当前提交
f9939da61a
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      gui/src/2D/controls/image.ts

+ 1 - 1
gui/src/2D/controls/image.ts

@@ -384,6 +384,7 @@ export class Image extends Control {
     }
 
     private _onImageLoaded(): void {
+        this._imageDataCache.data = null;
         this._imageWidth = this._domImage.width;
         this._imageHeight = this._domImage.height;
         this._loaded = true;
@@ -470,7 +471,6 @@ export class Image extends Control {
         this._domImage = document.createElement("img");
 
         this._domImage.onload = () => {
-            this._imageDataCache.data = null;
             this._onImageLoaded();
         };
         if (value) {