Canvas的key改为唯一ID(UUID)
Signed-off-by: zenggaofeng <zenggaofeng2@h-partners.com>
This commit is contained in:
parent
cc54efd50b
commit
170bb9f8e8
|
@ -1,3 +1,6 @@
|
|||
## 2.1.2-rc.8
|
||||
- onAreaChange绘制图片改为component Util绘制
|
||||
|
||||
## 2.1.2-rc.7
|
||||
- 修复图片圆角图形变换导致抗锯齿、ScaleType失效
|
||||
- 修复使用模糊化出现图片变模糊和变形
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"name": "entry",
|
||||
"description": "example description",
|
||||
"repository": {},
|
||||
"version": "2.1.2-rc.7",
|
||||
"version": "2.1.2-rc.8",
|
||||
"dependencies": {
|
||||
"@ohos/libraryimageknife": "file:../sharedlibrary",
|
||||
"@ohos/sharedlibrary2": "file:../sharedlibrary2",
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
"main": "index.ets",
|
||||
"repository": "https://gitee.com/openharmony-tpc/ImageKnife",
|
||||
"type": "module",
|
||||
"version": "2.1.2-rc.7",
|
||||
"version": "2.1.2-rc.8",
|
||||
"dependencies": {
|
||||
"pako": "^2.1.0",
|
||||
"@ohos/disklrucache": "^2.0.2-rc.0",
|
||||
|
|
|
@ -26,7 +26,11 @@ import common from '@ohos.app.ability.common'
|
|||
import { ObjectKey } from './ObjectKey'
|
||||
import componentUtils from '@ohos.arkui.componentUtils'
|
||||
import inspector from '@ohos.arkui.inspector'
|
||||
import util from '@ohos.util'
|
||||
|
||||
interface KeyCanvas {
|
||||
keyId:string
|
||||
}
|
||||
@Component
|
||||
export struct ImageKnifeComponent {
|
||||
@Watch('watchImageKnifeOption') @ObjectLink imageKnifeOption: ImageKnifeOption;
|
||||
|
@ -47,6 +51,9 @@ export struct ImageKnifeComponent {
|
|||
// 抗锯齿属性
|
||||
private imageSmoothingQuality: ImageSmoothingQuality = 'low';
|
||||
private imageSmoothingEnabled: boolean = true;
|
||||
@State keyCanvas: KeyCanvas = {
|
||||
keyId: util.generateRandomUUID()
|
||||
}
|
||||
defaultLifeCycle: IDrawLifeCycle = {
|
||||
|
||||
// 展示占位图
|
||||
|
@ -94,12 +101,12 @@ export struct ImageKnifeComponent {
|
|||
private detachFromLayoutGIF :DetachFromLayout|undefined = undefined;
|
||||
|
||||
private detachFromLayoutPixelMap :DetachFromLayout|undefined = undefined;
|
||||
listener: inspector.ComponentObserver = inspector.createComponentObserver("ImageKnifeCanvas")
|
||||
private value: componentUtils.ComponentInfo = componentUtils.getRectangleById("ImageKnifeCanvas")
|
||||
listener: inspector.ComponentObserver = inspector.createComponentObserver(this.keyCanvas.keyId)
|
||||
private value: componentUtils.ComponentInfo = componentUtils.getRectangleById(this.keyCanvas.keyId)
|
||||
|
||||
build() {
|
||||
Canvas(this.context)
|
||||
.key("ImageKnifeCanvas")
|
||||
.key(this.keyCanvas.keyId)
|
||||
.width('100%')
|
||||
.height('100%')
|
||||
.renderFit(RenderFit.RESIZE_FILL)
|
||||
|
@ -126,7 +133,7 @@ export struct ImageKnifeComponent {
|
|||
})
|
||||
}
|
||||
onLayoutComplete:()=>void = ():void=>{
|
||||
this.value = componentUtils.getRectangleById("ImageKnifeCanvas");
|
||||
this.value = componentUtils.getRectangleById(this.keyCanvas.keyId);
|
||||
this.currentWidth = px2vp(this.value.size.width)
|
||||
this.currentHeight = px2vp(this.value.size.height)
|
||||
if (this.currentWidth <= 0 || this.currentHeight <= 0) {
|
||||
|
|
|
@ -6,6 +6,6 @@
|
|||
"name": "imageknife",
|
||||
"description": "example description",
|
||||
"repository": {},
|
||||
"version": "2.1.2-rc.7",
|
||||
"version": "2.1.2-rc.8",
|
||||
"dependencies": {}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue