Sfoglia il codice sorgente

Fix caching issue with the contains method

Popov72 5 anni fa
parent
commit
7382ea3780
1 ha cambiato i file con 2 aggiunte e 0 eliminazioni
  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 = document.createElement("img");
 
 
         this._domImage.onload = () => {
         this._domImage.onload = () => {
+            this._imageDataCache.data = null;
             this._onImageLoaded();
             this._onImageLoaded();
         };
         };
         if (value) {
         if (value) {
@@ -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;