diff --git a/README.md b/README.md index 7b6b827cfb278bcd8890fa8a9ea618c65e8fad07..459ede13b5db7c15204bb750b637c891507851e8 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 3e9424333fe9bb3251e2623f0bdfdbf6ec78b374..6226fa52527caef026c78dd789ee32714363abcb 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 c44004d2daf998a9d849154845ad94df48565da7..559f433380af10bdf8a2bcf6588118f2cd839efd 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 ccdef4750b5fa7025cb7e6a40a42a97b6cb54012..1c943b7e522fa118aaa33b763e5d9d43d16908da 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()) }