From d77539c555ed09915e4a8688d53a2caf29887f4c Mon Sep 17 00:00:00 2001 From: zhoulisheng1 Date: Fri, 24 Mar 2023 09:44:21 +0800 Subject: [PATCH] =?UTF-8?q?1.=E5=BD=93loadSrc=E5=8F=82=E6=95=B0=E4=BC=A0?= =?UTF-8?q?=E5=85=A5=E4=B8=BAundefined=E6=97=B6,=E7=BB=93=E6=9D=9Fgif?= =?UTF-8?q?=E5=BE=AA=E7=8E=AF=E5=92=8C=E5=8E=9F=E6=9C=89=E7=9A=84canvas?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhoulisheng1 --- .../components/imageknife/ImageKnifeComponent.ets | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/imageknife/src/main/ets/components/imageknife/ImageKnifeComponent.ets b/imageknife/src/main/ets/components/imageknife/ImageKnifeComponent.ets index 575cc14..11d4fcc 100644 --- a/imageknife/src/main/ets/components/imageknife/ImageKnifeComponent.ets +++ b/imageknife/src/main/ets/components/imageknife/ImageKnifeComponent.ets @@ -19,7 +19,7 @@ import { RequestOption } from '../imageknife/RequestOption' import { ImageKnifeData } from '../imageknife/ImageKnifeData' import { GIFFrame } from '../imageknife/utils/gif/GIFFrame' import { IDrawLifeCycle } from '../imageknife/interface/IDrawLifeCycle' -import {LogUtil} from '../imageknife/utils/LogUtil' +import { LogUtil } from '../imageknife/utils/LogUtil' @Component @@ -251,11 +251,15 @@ export struct ImageKnifeComponent { } // imageknife 第一次启动和数据刷新后重新发送请求 imageKnifeExecute() { - if(this.imageKnifeOption.loadSrc == null){ - // 如果数据是null或者undefined 则不进入图片请求流程 + if (this.imageKnifeOption.loadSrc == null) { + // 如果数据是null或者undefined,清空图片内容和gif循环,并且不进入图片请求流程 + this.resetGifData() + if (this.canvasHasReady) { + // 如果canvas已经初始化好了,清空原有的canvas内容 + this.context.clearRect(0, 0, this.currentWidth, this.currentHeight) + } return } - this.resetGifData() let request = new RequestOption(); this.configNecessary(request);