sprite event off & fix renderData hash bug (#10012)

* event off

* fix renderData hash bug
This commit is contained in:
ChiaNing
2022-01-18 04:18:26 -06:00
committed by GitHub
parent 4397003da5
commit 59acd7eec7
2 changed files with 7 additions and 3 deletions
+6
View File
@@ -525,6 +525,12 @@ export class Sprite extends Renderable2D {
}
}
public onDisable () {
if (this._spriteFrame && this._type === SpriteType.SLICED) {
this._spriteFrame.off(SpriteFrame.EVENT_UV_UPDATED, this._updateUVs, this);
}
}
public onDestroy () {
this.destroyRenderData();
if (EDITOR) {
+1 -3
View File
@@ -220,9 +220,7 @@ export class RenderData extends BaseRenderData {
this.hashDirty = true;
}
if (this.hashDirty) {
const hashString = ` ${this.layer} ${this.blendHash} ${this.textureHash}`;
this.dataHash = murmurhash2_32_gc(hashString, 666);
this.hashDirty = false;
this.updateHash();
}
}