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
chenjun
2024-08-29 10:40:27 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
42c19a4de2fbb5e42fcc674de83aca492fd2f234
42c19a4d
1 parent
8fe297a1
长图截取
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
0 deletions
sight_harmony/features/wdComponent/src/main/ets/components/cardview/Card19Component.ets
sight_harmony/features/wdComponent/src/main/ets/components/cardview/Card19Component.ets
View file @
42c19a4
...
...
@@ -173,6 +173,8 @@ struct createImg {
if (picWidth && picHeight) {
if (picWidth / picHeight > 2/1) {
return 1; //横长图
} else if (picWidth/picHeight > 1/2 && picWidth/picHeight < 3/4) { //截取图片
return 4;
} else if (picWidth/picHeight < 1/2) {
return 2; //竖长图
} else {
...
...
@@ -236,6 +238,25 @@ struct createImg {
}
}
} else if (this.getPicType(item.weight, item.height) === 4) {
GridCol({
span: this.onePicW > this.onePicH ? 12 : 8
}) {
Image(this.loadImg ? item.fullUrl : '')
.backgroundColor(0xf5f5f5)
// .aspectRatio(this.onePicW > this.onePicH ? 343 / 198 : 228 / 305)
.width('100%')
.autoResize(true)
.objectFit(ImageFit.Cover)
.autoResize(true)
.aspectRatio(3/4)
.borderRadius(this.caclImageRadius(index))
.opacity(!item.weight && !item.height ? 0 : 1)
.onComplete((event?) => {
this.onePicW = event?.width || 0;
this.onePicH = event?.height || 0;
})
}
} else {
GridCol({
span: this.onePicW > this.onePicH ? 12 : 8
...
...
Please
register
or
login
to post a comment