浏览代码

Fix caching issue with the contains method

Popov72 5 年之前
父节点
当前提交
7382ea3780
共有 1 个文件被更改,包括 2 次插入0 次删除
  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;