Browse Source

Fix caching issue with the contains method

Popov72 5 years ago
parent
commit
7382ea3780
1 changed files with 2 additions and 0 deletions
  1. 2 0
      gui/src/2D/controls/image.ts

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

@@ -470,6 +470,7 @@ export class Image extends Control {
         this._domImage = document.createElement("img");
 
         this._domImage.onload = () => {
+            this._imageDataCache.data = null;
             this._onImageLoaded();
         };
         if (value) {
@@ -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;