添加长图拼接拖拽排序,优化水印添加成功后的显示问题
This commit is contained in:
parent
a1c33b320e
commit
8c151dbe9a
|
|
@ -131,6 +131,7 @@ struct AddWatermarkPage {
|
|||
MP4Parser.ffmpegCmd(cmd, {
|
||||
callBackResult: (code: number) => {
|
||||
if (code === 0) {
|
||||
this.controller.reset()
|
||||
this.uri = FileUtil.getUriFromPath(outputPath)
|
||||
this.isSuccess = true
|
||||
this.isPlaying = false
|
||||
|
|
@ -550,6 +551,7 @@ struct AddWatermarkPage {
|
|||
.margin({ top: 20, bottom: 20 })
|
||||
.borderRadius(10)
|
||||
.backgroundColor(Color.White)
|
||||
.visibility(!this.isSuccess ? Visibility.Visible : Visibility.Hidden)
|
||||
}
|
||||
.layoutWeight(1)
|
||||
.visibility(this.uri ? Visibility.Visible : Visibility.None)
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ import { AuthViewModel } from '../../../../viewModel/AuthViewModel'
|
|||
import { VipAuthEntity } from '../../../../entity/VipAuthEntity'
|
||||
import { LoginManager } from '../../../../manager/LoginGlobalManager'
|
||||
import { RouterUrls } from '../../../../common/RouterUrls'
|
||||
import { router } from '@kit.ArkUI'
|
||||
import { curves, router } from '@kit.ArkUI'
|
||||
import { EventReportManager } from '../../../../manager/EventReportManager'
|
||||
|
||||
@Entry
|
||||
|
|
@ -31,6 +31,14 @@ struct ImageMergePage {
|
|||
@Local imageUris: Array<string> = []
|
||||
@Local isSuccess: boolean = false
|
||||
|
||||
@Local dragItem: number = -1; // 当前拖拽的项目
|
||||
@Local scaleItem: number = -1; // 当前缩放的项目
|
||||
@Local neighborItem: number = -1; // 相邻项目
|
||||
@Local neighborScale: number = -1; // 相邻项目的缩放比例
|
||||
@Local offsetX: number = 0;
|
||||
private dragRefOffset: number = 0; // 拖拽参考偏移
|
||||
private itemIntv: number = 80; // 项目间隔
|
||||
|
||||
@Monitor('viewModel.authInfo')
|
||||
onPermissionInfoChange(monitor: IMonitor) {
|
||||
const info = monitor.value()?.now as VipAuthEntity;
|
||||
|
|
@ -156,6 +164,22 @@ struct ImageMergePage {
|
|||
})
|
||||
}
|
||||
|
||||
scaleSelect(item: number): number {
|
||||
if (this.scaleItem === item) {
|
||||
return 1.05;
|
||||
} else if (this.neighborItem === item) {
|
||||
return this.neighborScale;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
itemMove(index: number, newIndex: number): void {
|
||||
let tmp = this.imageUris.splice(index, 1);
|
||||
this.imageUris.splice(newIndex, 0, tmp[0]);
|
||||
}
|
||||
|
||||
|
||||
showDownloadDialog() {
|
||||
DownloadDialog.show(this.getUIContext(), { status: DownloadStatus.COMPLETED, totalSize: 0, progress: 0, totalCount: 1, index: 0, callback: {
|
||||
confirm: () => {
|
||||
|
|
@ -228,7 +252,7 @@ struct ImageMergePage {
|
|||
ListItem() {
|
||||
RelativeContainer() {
|
||||
Stack() {
|
||||
Image(item).width('100%').height('100%').borderRadius(6)
|
||||
Image(item).width('100%').height('100%').borderRadius(6).draggable(false)
|
||||
Text(`${index + 1}`)
|
||||
.width(20)
|
||||
.height(20)
|
||||
|
|
@ -259,6 +283,7 @@ struct ImageMergePage {
|
|||
}
|
||||
}
|
||||
})
|
||||
.draggable(false)
|
||||
}
|
||||
.height('100%')
|
||||
.aspectRatio(1)
|
||||
|
|
@ -267,13 +292,17 @@ struct ImageMergePage {
|
|||
.onClick(() => {
|
||||
this.selectedImage = item
|
||||
})
|
||||
})
|
||||
}, (item: string) => item)
|
||||
.onMove((from:number, to:number) => {
|
||||
let tmp = this.imageUris.splice(from, 1)
|
||||
this.imageUris.splice(to, 0, tmp[0])
|
||||
})
|
||||
|
||||
if (this.imageUris.length > 0 && this.imageUris.length < 9) {
|
||||
ListItem() {
|
||||
Stack() {
|
||||
Column() {
|
||||
Image($r('app.media.ic_add_image')).width(24).height(24)
|
||||
Image($r('app.media.ic_add_image')).width(24).height(24).draggable(false)
|
||||
Text('请上传图片').fontColor($r('app.color.color_466afd')).fontSize(10).margin({top: 4})
|
||||
}
|
||||
}
|
||||
|
|
@ -290,6 +319,7 @@ struct ImageMergePage {
|
|||
}
|
||||
}
|
||||
.width('100%')
|
||||
.height('auto')
|
||||
.scrollBar(BarState.Off)
|
||||
.listDirection(Axis.Horizontal)
|
||||
}
|
||||
|
|
@ -312,7 +342,7 @@ struct ImageMergePage {
|
|||
.fontWeight(FontWeight.Medium)
|
||||
.backgroundColor($r('app.color.color_466afd'))
|
||||
.onClick(() => {
|
||||
if (this.imageUris) {
|
||||
if (this.imageUris.length > 0) {
|
||||
this.mergeImage()
|
||||
} else {
|
||||
ToastUtils.show('请上传图片')
|
||||
|
|
|
|||
|
|
@ -117,8 +117,8 @@ export struct WatermarkView {
|
|||
if (StrUtil.isNotEmpty(this.imagePath)) {
|
||||
this.clipRect.width = 80
|
||||
this.clipRect.height = 80
|
||||
this.moveClipCanvas(0, 0)
|
||||
}
|
||||
this.moveClipCanvas(0, 0)
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue