From fe5fdb7babd511b7a29a0de16d9b749fd60d5026 Mon Sep 17 00:00:00 2001 From: Liuuuuuu <7967689+sandmliu@user.noreply.gitee.com> Date: Thu, 8 Jun 2023 08:46:28 +0000 Subject: [PATCH] update Media/ImageEdit/entry/src/main/ets/pages/HomePage.ets. Signed-off-by: Liuuuuuu <7967689+sandmliu@user.noreply.gitee.com> --- Media/ImageEdit/entry/src/main/ets/pages/HomePage.ets | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Media/ImageEdit/entry/src/main/ets/pages/HomePage.ets b/Media/ImageEdit/entry/src/main/ets/pages/HomePage.ets index 068cd118..94513f29 100644 --- a/Media/ImageEdit/entry/src/main/ets/pages/HomePage.ets +++ b/Media/ImageEdit/entry/src/main/ets/pages/HomePage.ets @@ -277,9 +277,18 @@ struct HomePage { height: this.imageHeight } this.showCanvas = true; + this.calcScale(); }); } + calcScale() { + let imageWidthScale = (this.screenWidth - CommonConstants.DOUBLE * CommonConstants.SCREEN_DISPLAY_MARGIN) / + this.imageOldSize.width; + let imageHeightScale = (this.screenHeight - CommonConstants.DOUBLE * CommonConstants.SCREEN_DISPLAY_MARGIN) / + this.imageOldSize.height; + this.imageScale = imageWidthScale > imageHeightScale ? imageHeightScale : imageWidthScale; + } + pixelInit() { this.showCanvas = false; getPixelMap(CommonConstants.RAW_FILE_NAME).then(pixelMap => { -- Gitee