修复成功回调获取不到宽高
Signed-off-by: zgf <zenggaofeng2@h-partners.com>
This commit is contained in:
parent
2fee05b569
commit
9ee162c69a
|
@ -1,3 +1,6 @@
|
|||
## 3.0.0-rc.7
|
||||
- 修复成功回调获取不到宽高
|
||||
|
||||
## 3.0.0-rc.6
|
||||
- 支持多种组合变换
|
||||
- 支持全局配置是否在子线程请求加载图片,默认在子线程
|
||||
|
|
|
@ -36,7 +36,8 @@ struct LoadStatePage {
|
|||
},
|
||||
border: { radius: 50 }
|
||||
}
|
||||
|
||||
@State currentWidth: number = 200
|
||||
@State currentHeight: number = 200
|
||||
build() {
|
||||
Column() {
|
||||
Text('测试失败场景请先关闭网络,并保证本地没有此网络图片的缓存')
|
||||
|
@ -57,8 +58,10 @@ struct LoadStatePage {
|
|||
onLoadFailed: (err) => {
|
||||
console.error("Load Failed Reason: " + err + " cost " + (new Date().getTime() - this.starTime) + " milliseconds");
|
||||
},
|
||||
onLoadSuccess: (data) => {
|
||||
onLoadSuccess: (data,width,height) => {
|
||||
console.info("Load Successful: cost " + (new Date().getTime() - this.starTime) + " milliseconds");
|
||||
this.currentWidth = width!
|
||||
this.currentHeight = height!
|
||||
return data;
|
||||
},
|
||||
},
|
||||
|
@ -68,7 +71,7 @@ struct LoadStatePage {
|
|||
}
|
||||
.margin({ top: 20 })
|
||||
|
||||
ImageKnifeComponent({ imageKnifeOption: this.ImageKnifeOption }).height(200).width(200)
|
||||
ImageKnifeComponent({ imageKnifeOption: this.ImageKnifeOption }).height(this.currentHeight).width(this.currentWidth)
|
||||
.margin({ top: 20 })
|
||||
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
"main": "index.ets",
|
||||
"repository": "https://gitee.com/openharmony-tpc/ImageKnife",
|
||||
"type": "module",
|
||||
"version": "3.0.0-rc.6",
|
||||
"version": "3.0.0-rc.7",
|
||||
"dependencies": {
|
||||
"@ohos/gpu_transform": "^1.0.2"
|
||||
},
|
||||
|
|
|
@ -267,8 +267,8 @@ export class ImageKnifeDispatcher {
|
|||
|
||||
let ImageKnifeData: ImageKnifeData = {
|
||||
source: pixelmap!,
|
||||
imageWidth: 0,
|
||||
imageHeight: 0
|
||||
imageWidth: requestJobResult.size == undefined ? 0 : requestJobResult.size.width,
|
||||
imageHeight: requestJobResult.size == undefined ? 0 : requestJobResult.size.height
|
||||
};
|
||||
|
||||
// 保存内存缓存
|
||||
|
@ -303,7 +303,7 @@ export class ImageKnifeDispatcher {
|
|||
if (requestWithSource.request.imageKnifeOption.onLoadListener &&
|
||||
requestWithSource.request.imageKnifeOption.onLoadListener.onLoadSuccess) {
|
||||
// 回调请求成功
|
||||
requestWithSource.request.imageKnifeOption.onLoadListener.onLoadSuccess(ImageKnifeData.source);
|
||||
requestWithSource.request.imageKnifeOption.onLoadListener.onLoadSuccess(ImageKnifeData.source,ImageKnifeData.imageWidth,ImageKnifeData.imageHeight);
|
||||
LogUtil.log("ImageKnife_DataTime_getAndShowImage_onLoadSuccess:"+currentRequest.imageKnifeOption.loadSrc)
|
||||
}
|
||||
} else if (requestWithSource.source == ImageKnifeRequestSource.ERROR_HOLDER) {
|
||||
|
|
Loading…
Reference in New Issue