From f002490fa21f3d2de51b26c2d9b00fc8d1c789e9 Mon Sep 17 00:00:00 2001 From: tongzihan <15671769870@163.com> Date: Wed, 27 Aug 2025 17:07:10 +0800 Subject: [PATCH] =?UTF-8?q?=E9=98=B2=E6=8A=96=E6=A8=A1=E5=BC=8F=E4=B8=8D?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=8F=98=E7=84=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- entry/src/main/ets/pages/Index.ets | 9 +++++++-- entry/src/main/ets/views/SettingButtonsView.ets | 2 +- entry/src/main/ets/views/ZoomButtonsView.ets | 4 ++-- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 7b6b827..459ede1 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ 使用说明: 1. 打开应用,授权后展示预览界面。 2. 上方从左至右按钮功能依次为:闪光灯设置、延迟拍照模式设置、动态拍照模式设置、单双段拍照模式设置(单段拍照模式不支持动态拍摄)。 -3. 切换录像模式,上方按钮依次为:闪关灯设置、防抖模式设置。 +3. 切换录像模式,上方按钮依次为:闪关灯设置、防抖模式设置(模式不支持变焦)。 4. 右侧按钮依次为:网格线、水平仪、双路预览(获取预览帧数据)。 5. 下方按钮可拍照,录像,切换前后置摄像头。 diff --git a/entry/src/main/ets/pages/Index.ets b/entry/src/main/ets/pages/Index.ets index 3e94243..6226fa5 100644 --- a/entry/src/main/ets/pages/Index.ets +++ b/entry/src/main/ets/pages/Index.ets @@ -85,6 +85,7 @@ struct Index { @State currentZoom: number = 1; @State isZoomPinching: boolean = false; private originZoomBeforePinch: number = 1; // record zoom after pinch, sale base it. + @State isStabilizationEnabled: boolean = false; @State previewImage: PixelMap | ResourceStr = ''; private PreviewImageHeight: number = 80; @@ -266,8 +267,10 @@ struct Index { .onActionStart(() => { this.originZoomBeforePinch = this.currentZoom; this.isZoomPinching = true; + this.sleepTimer?.refresh(); }) .onActionUpdate((event: GestureEvent) => { + if (this.previewVM.isVideoMode() && this.isStabilizationEnabled) return; const targetZoom = this.originZoomBeforePinch * event.scale; this.currentZoom = limitNumberInRange(targetZoom, this.zoomRange); this.cameraManager.setZoomRatio(this.currentZoom); @@ -474,10 +477,12 @@ struct Index { videoManager: this.videoManager, photoDelayTime: this.photoDelayTime, isSinglePhoto: this.isSinglePhoto, - isLivePhoto: this.isLivePhoto + isLivePhoto: this.isLivePhoto, + isStabilizationEnabled: this.isStabilizationEnabled }) if (!this.photoRemainder) { - if (!this.previewVM.isFront) { + if (!this.previewVM.isFront && + !(this.isStabilizationEnabled && this.previewVM.isVideoMode())) { ZoomButtonsView({ cameraManager: this.cameraManager, zoomRange: this.zoomRange, diff --git a/entry/src/main/ets/views/SettingButtonsView.ets b/entry/src/main/ets/views/SettingButtonsView.ets index c44004d..559f433 100644 --- a/entry/src/main/ets/views/SettingButtonsView.ets +++ b/entry/src/main/ets/views/SettingButtonsView.ets @@ -70,7 +70,7 @@ struct SettingButtonsView { @Require photoManager: PhotoManager; @Link videoManager: VideoManager; @Link photoDelayTime: number; - @State isStabilizationEnabled: boolean = false; + @Link isStabilizationEnabled: boolean; @Link isSinglePhoto: boolean; @Link previewVM: PreviewViewModel; diff --git a/entry/src/main/ets/views/ZoomButtonsView.ets b/entry/src/main/ets/views/ZoomButtonsView.ets index ccdef47..1c943b7 100644 --- a/entry/src/main/ets/views/ZoomButtonsView.ets +++ b/entry/src/main/ets/views/ZoomButtonsView.ets @@ -54,8 +54,8 @@ struct ZoomButtonsView { .borderRadius('50%') .textAlign(TextAlign.Center) .onClick(() => { - this.cameraManager.setSmoothZoom(zoom) - this.currentZoom = zoom + this.cameraManager.setSmoothZoom(zoom); + this.currentZoom = zoom; }) }, (zoom: number) => zoom.toString()) } -- Gitee