浏览代码

Merge pull request #8781 from Popov72/fix-imagecontains

GUI image: fix cache issue with "contains" method
David Catuhe 5 年之前
父节点
当前提交
e92c6257ee
共有 1 个文件被更改,包括 2 次插入0 次删除
  1. 2 0
      gui/src/2D/controls/image.ts

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

@@ -384,6 +384,7 @@ export class Image extends Control {
     }
     }
 
 
     private _onImageLoaded(): void {
     private _onImageLoaded(): void {
+        this._imageDataCache.data = null;
         this._imageWidth = this._domImage.width;
         this._imageWidth = this._domImage.width;
         this._imageHeight = this._domImage.height;
         this._imageHeight = this._domImage.height;
         this._loaded = true;
         this._loaded = true;
@@ -652,6 +653,7 @@ export class Image extends Control {
             const context = canvas.getContext("2d")!;
             const context = canvas.getContext("2d")!;
 
 
             this._imageDataCache.data = imageData = context.getImageData(0, 0, width, height).data;
             this._imageDataCache.data = imageData = context.getImageData(0, 0, width, height).data;
+            this._imageDataCache.key = key;
         }
         }
 
 
         x = (x - this._currentMeasure.left) | 0;
         x = (x - this._currentMeasure.left) | 0;