mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-21 08:02:39 +08:00
remove event at _applySpriteFrame (#8517)
* remove event at _applySpriteFrame * remove version dirty
This commit is contained in:
@@ -1105,7 +1105,6 @@ export class SpriteFrame extends Asset {
|
||||
this._rect.x = frame.x;
|
||||
this._rect.y = frame.y;
|
||||
this._calculateUV();
|
||||
this.emit('uv-updated');
|
||||
}
|
||||
|
||||
public _resetDynamicAtlasFrame () {
|
||||
|
||||
@@ -483,9 +483,7 @@ export class Sprite extends Renderable2D {
|
||||
}
|
||||
|
||||
if (this._spriteFrame) {
|
||||
this._spriteFrame.on('load', this._markForUpdateUvDirty, this);
|
||||
this._spriteFrame.on('uv-updated', this._markForUpdateUvDirty, this);
|
||||
this._markForUpdateUvDirty();
|
||||
this._spriteFrame.once('load', this._onTextureLoaded, this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -512,6 +510,7 @@ export class Sprite extends Renderable2D {
|
||||
|
||||
// this._flushAssembler();
|
||||
this._activateMaterial();
|
||||
this._markForUpdateUvDirty();
|
||||
}
|
||||
|
||||
public onDestroy () {
|
||||
@@ -520,9 +519,8 @@ export class Sprite extends Renderable2D {
|
||||
this.node.off(SystemEventType.SIZE_CHANGED, this._resized, this);
|
||||
}
|
||||
|
||||
if (this._spriteFrame) {
|
||||
this._spriteFrame.off('uv-updated', this._markForUpdateUvDirty, this);
|
||||
this._spriteFrame.off('load');
|
||||
if (this._spriteFrame && !this._spriteFrame.loaded) {
|
||||
this._spriteFrame.off('load', this._onTextureLoaded, this);
|
||||
}
|
||||
super.onDestroy();
|
||||
}
|
||||
@@ -745,16 +743,9 @@ export class Sprite extends Renderable2D {
|
||||
// }
|
||||
|
||||
if (this._renderData) {
|
||||
if (oldFrame) {
|
||||
oldFrame.off('load', this._markForUpdateUvDirty);
|
||||
oldFrame.off('uv-updated', this._markForUpdateUvDirty, this);
|
||||
if (oldFrame && !oldFrame.loaded) {
|
||||
oldFrame.off('load', this._onTextureLoaded, this);
|
||||
}
|
||||
|
||||
if (spriteFrame) {
|
||||
spriteFrame.on('load', this._markForUpdateUvDirty, this);
|
||||
spriteFrame.on('uv-updated', this._markForUpdateUvDirty, this);
|
||||
}
|
||||
|
||||
if (!this._renderData.uvDirty) {
|
||||
if (oldFrame && spriteFrame) {
|
||||
this._renderData.uvDirty = oldFrame.uvHash !== spriteFrame.uvHash;
|
||||
@@ -768,8 +759,7 @@ export class Sprite extends Renderable2D {
|
||||
|
||||
if (spriteFrame) {
|
||||
if (!oldFrame || spriteFrame !== oldFrame) {
|
||||
// this._material.setProperty('mainTexture', spriteFrame);
|
||||
if (spriteFrame.loaded) {
|
||||
if (spriteFrame.loaded) {
|
||||
this._onTextureLoaded();
|
||||
} else {
|
||||
spriteFrame.once('load', this._onTextureLoaded, this);
|
||||
|
||||
@@ -30,6 +30,7 @@ export class DynamicAtlasManager {
|
||||
this.reset();
|
||||
legacyCC.director.on(legacyCC.Director.EVENT_BEFORE_SCENE_LAUNCH, this.beforeSceneLoad, this);
|
||||
} else {
|
||||
this.reset();
|
||||
legacyCC.director.off(legacyCC.Director.EVENT_BEFORE_SCENE_LAUNCH, this.beforeSceneLoad, this);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user