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