Browse Source

Merge pull request #8781 from Popov72/fix-imagecontains

GUI image: fix cache issue with "contains" method
David Catuhe 5 năm trước cách đây
mục cha
commit
e92c6257ee
1 tập tin đã thay đổi với 2 bổ sung0 xóa
  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 {
+        this._imageDataCache.data = null;
         this._imageWidth = this._domImage.width;
         this._imageHeight = this._domImage.height;
         this._loaded = true;
@@ -652,6 +653,7 @@ export class Image extends Control {
             const context = canvas.getContext("2d")!;
 
             this._imageDataCache.data = imageData = context.getImageData(0, 0, width, height).data;
+            this._imageDataCache.key = key;
         }
 
         x = (x - this._currentMeasure.left) | 0;