diff --git a/entry/src/main/ets/pages/Index.ets b/entry/src/main/ets/pages/Index.ets index 03024aeb2b661c96e62f39208fb018ed5f8aeedb..8879774571443a52e7ca8c8c0131de96dc9b3cb7 100644 --- a/entry/src/main/ets/pages/Index.ets +++ b/entry/src/main/ets/pages/Index.ets @@ -82,8 +82,8 @@ struct XComponentPage { @LocalStorageLink('isMovingPhoto') isMovingPhoto: boolean = false; textTimerController: TextTimerController = new TextTimerController(); uri: string = ''; - @State rotation:number=0; - @State isShowZoom:boolean=false; + @State rotation: number = 0; + @State isShowZoom: boolean = false; onPageShow(): void { filePreview.closePreview(context); @@ -255,12 +255,12 @@ struct XComponentPage { PinchGesture({ fingers: 2 }) .onActionUpdate((event: GestureEvent) => { if (event && !this.isStabilization) { - this.zoom = this.zoom *(( event.scale-1) * 0.07+1) - this.isShowZoom=true - if(this.zoom>zoomRatioRange[1]){ - this.zoom=zoomRatioRange[1] - }else if(this.zoom zoomRatioRange[1]) { + this.zoom = zoomRatioRange[1] + } else if (this.zoom < zoomRatioRange[0]) { + this.zoom = zoomRatioRange[0] } if (this.isPhoto) { setPhotoZoom(this.zoom); @@ -270,7 +270,7 @@ struct XComponentPage { } }) .onActionEnd((event: GestureEvent) => { - this.isShowZoom=false + this.isShowZoom = false }) ) .onLoad(async () => { @@ -328,10 +328,11 @@ struct XComponentPage { } .visibility(this.isFront || this.isStabilization ? Visibility.Hidden : Visibility.Visible) .margin({ top: CameraConstants.PREVIEW_HEIGHT_BUTTON }) - Text(this.zoom.toFixed(0)+'x') + + Text(this.zoom === zoomRatioRange[0] ? '广角' : this.zoom.toFixed(1) + 'x') .fontColor(Color.White) .margin({ top: '1000px' }) - .visibility(this.isShowZoom?Visibility.Visible:Visibility.Hidden) + .visibility(this.isShowZoom && !this.isFront ? Visibility.Visible : Visibility.Hidden) } Row() { @@ -385,8 +386,8 @@ struct XComponentPage { .height(CameraConstants.CAMERA_SWITCH_SIZE) .width(CameraConstants.CAMERA_SWITCH_SIZE) .borderRadius(CameraConstants.CAMERA_SWITCH_SIZE / 2) - .rotate({angle:this.rotation}) - .animation({curve:curves.springMotion()}) + .rotate({ angle: this.rotation }) + .animation({ curve: curves.springMotion() }) .onClick(() => { if (this.currentPic) { previewPhoto(this.isMovingPhoto, context, this.uri); diff --git a/entry/src/main/ets/utils/CameraShooter.ets b/entry/src/main/ets/utils/CameraShooter.ets index 07189e2db32b556e1e9cba11f8b73bd4a597fe67..c5c59a14f24b33620ee9caa915bbdd19b77ea013 100644 --- a/entry/src/main/ets/utils/CameraShooter.ets +++ b/entry/src/main/ets/utils/CameraShooter.ets @@ -88,13 +88,20 @@ export async function cameraShooting(isVideo: boolean, cameraPosition: number, s width: 1920, height: 1080 } - ; let photoProfile: undefined | camera.Profile = photoProfilesArray.find((profile: camera.Profile) => { return profile.size.width === photoSize.width && profile.size.height === photoSize.height; }); let previewProfile: undefined | camera.Profile = previewProfilesArray.find((profile: camera.Profile) => { return profile.size.width === previewSize.width && profile.size.height === previewSize.height; }); + if (cameraPosition === 0 && foldAbleStatus != 0) { + photoProfile = photoProfilesArray.find((profile: camera.Profile) => { + return profile.size.width === 1920 && profile.size.height === 1080; + }); + previewProfile = previewProfilesArray.find((profile: camera.Profile) => { + return profile.size.width === 1920 && profile.size.height === 1080; + }); + } previewOutput = cameraManager.createPreviewOutput(previewProfile, surfaceId); if (previewOutput === undefined) { return [];