disAppear生命周期清空定时器只在gif图片时执行

Signed-off-by: zenggaofeng <zenggaofeng2@h-partners.com>
This commit is contained in:
zenggaofeng 2024-03-07 09:52:49 +08:00
parent f5f238df40
commit ec07480c42
2 changed files with 11 additions and 1 deletions

View File

@ -2,6 +2,7 @@
- 使用taskpool实现多线程加载图片资源
- 修复部分gif图片识别成静态图
- 修复同一张图片发送多次请求
- disAppear生命周期清空定时器只在gif图片时执行
## 2.1.2-rc.8
- onAreaChange绘制图片改为component Util绘制

View File

@ -51,6 +51,8 @@ export struct ImageKnifeComponent {
// 抗锯齿属性
private imageSmoothingQuality: ImageSmoothingQuality = 'low';
private imageSmoothingEnabled: boolean = true;
// 是否是gif图片
private isGif: boolean = false
@State keyCanvas: KeyCanvas = {
keyId: util.generateRandomUUID()
}
@ -197,6 +199,11 @@ export struct ImageKnifeComponent {
request.load(this.imageKnifeOption.loadSrc)
.addListener({ callback: (err:BusinessError|string, data:ImageKnifeData) => {
LogUtil.log('ImageKnifeComponent request.load callback')
if(data.isGIFFrame()) {
this.isGif = true
} else {
this.isGif = false
}
this.runNextFunction(this.displayMainSource,data);
return false;
}
@ -648,7 +655,9 @@ export struct ImageKnifeComponent {
if (this.detachFromLayoutPixelMap != undefined) {
this.detachFromLayoutPixelMap.detach();
}
this.resetGifData();
if(this.isGif){
this.resetGifData();
}
this.listener.off("layout",this.onLayoutComplete)
}