Toggle navigation
Toggle navigation
This project
Loading...
Sign in
developOne
/
harmonyPool
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
张善主
2024-05-06 17:36:29 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
a38c69c94509ecad62f9248407f9e69542b86469
a38c69c9
1 parent
7f4ec975
feat(查看图片):动态
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
14 deletions
sight_harmony/features/wdComponent/src/main/ets/components/view/ImageItemView.ets
sight_harmony/features/wdComponent/src/main/ets/components/view/ImageItemView.ets
View file @
a38c69c
...
...
@@ -158,20 +158,38 @@ export struct ImageItemView {
build() {
Stack() {
Image(this.imagePixelMap)// TODO:知识点:宽高只根据其尺寸设置一个,通过保持宽高比来设置另一个属性
.width(this.fitWH === "width" ? "100%" : undefined)
.height(this.fitWH === "height" ? "100%" : undefined)
.aspectRatio(this.imageWHRatio)
.objectFit(ImageFit.Cover)// TODO:知识点:保持宽高比进行缩放,可以超出父组件,以便实现多图切换的增强功能
.autoResize(false)
.transform(this.matrix)// TODO:知识点:通过matrix控制图片的缩放
.defaultFocus(true)
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])
.offset({
// TODO:知识点:通过offset控制图片的偏移
x: this.imageOffsetInfo.currentX,
y: this.imageOffsetInfo.currentY
})
if(this.imageUri != null && (this.imageUri.includes('.gif') || this.imageUri.includes('.GIF'))){
Image(this.imageUri)// TODO:知识点:宽高只根据其尺寸设置一个,通过保持宽高比来设置另一个属性
.width(this.fitWH === "width" ? "100%" : undefined)
.height(this.fitWH === "height" ? "100%" : undefined)
.aspectRatio(this.imageWHRatio)
.objectFit(ImageFit.Cover)// TODO:知识点:保持宽高比进行缩放,可以超出父组件,以便实现多图切换的增强功能
.autoResize(false)
.transform(this.matrix)// TODO:知识点:通过matrix控制图片的缩放
.defaultFocus(true)
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])
.offset({
// TODO:知识点:通过offset控制图片的偏移
x: this.imageOffsetInfo.currentX,
y: this.imageOffsetInfo.currentY
})
}else{
Image(this.imagePixelMap)// TODO:知识点:宽高只根据其尺寸设置一个,通过保持宽高比来设置另一个属性
.width(this.fitWH === "width" ? "100%" : undefined)
.height(this.fitWH === "height" ? "100%" : undefined)
.aspectRatio(this.imageWHRatio)
.objectFit(ImageFit.Cover)// TODO:知识点:保持宽高比进行缩放,可以超出父组件,以便实现多图切换的增强功能
.autoResize(false)
.transform(this.matrix)// TODO:知识点:通过matrix控制图片的缩放
.defaultFocus(true)
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])
.offset({
// TODO:知识点:通过offset控制图片的偏移
x: this.imageOffsetInfo.currentX,
y: this.imageOffsetInfo.currentY
})
}
}
.onBlur(() => {
this.resetCurrentImageInfo();
...
...
Please
register
or
login
to post a comment