From 62b4dd16adbed92ea0f3d2af9389f851fd34cbac Mon Sep 17 00:00:00 2001 From: zhoulisheng1 Date: Sat, 6 May 2023 18:05:19 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BF=AE=E5=A4=8DImageKnifeDrawFactory?= =?UTF-8?q?=E4=B8=AD=E7=9A=84setOval=E5=92=8CsetRect=E7=9A=84=E4=B8=AD?= =?UTF-8?q?=E5=BF=83=E7=82=B9=E5=8F=96=E5=80=BC=E9=94=99=E8=AF=AF=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhoulisheng1 --- .../components/imageknife/ImageKnifeDrawFactory.ets | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/imageknife/src/main/ets/components/imageknife/ImageKnifeDrawFactory.ets b/imageknife/src/main/ets/components/imageknife/ImageKnifeDrawFactory.ets index e68a0d3..3b6cf52 100644 --- a/imageknife/src/main/ets/components/imageknife/ImageKnifeDrawFactory.ets +++ b/imageknife/src/main/ets/components/imageknife/ImageKnifeDrawFactory.ets @@ -119,7 +119,7 @@ export class ImageKnifeDrawFactory{ switch (scaleType) { case ScaleType.FIT_START: circleX = imageWidth * minScale / 2 - circleY = imageWidth * minScale / 2 + circleY = imageHeight * minScale / 2 context.ellipse(circleX,circleY, (imageWidth * minScale - borderWidth) / 2, (imageHeight * minScale - borderWidth) / 2, 0, 0, Math.PI * 2) break case ScaleType.FIT_END: @@ -139,7 +139,7 @@ export class ImageKnifeDrawFactory{ break case ScaleType.CENTER: circleX = compWidth / 2; - circleY = compWidth / 2; + circleY = compHeight / 2; let centerRadiusX = (Math.min(compWidth,imageWidth) - borderWidth)/2 let centerRadiusY = (Math.min(compHeight,imageHeight) -borderWidth)/2 context.ellipse(circleX, circleY, centerRadiusX, centerRadiusY, 0, 0, Math.PI * 2) @@ -163,7 +163,7 @@ export class ImageKnifeDrawFactory{ context.ellipse(circleX,circleY,(imageWidth * minScale - borderWidth) / 2, (imageHeight * minScale - borderWidth) / 2, 0, 0, Math.PI * 2) }else{ // CENTER circleX = compWidth / 2; - circleY = compWidth / 2; + circleY = compHeight / 2; let centerRadiusX = (Math.min(compWidth,imageWidth) - borderWidth)/2 let centerRadiusY = (Math.min(compHeight,imageHeight) -borderWidth)/2 context.ellipse(circleX, circleY, centerRadiusX, centerRadiusY, 0, 0, Math.PI * 2) @@ -277,7 +277,7 @@ export class ImageKnifeDrawFactory{ let x1 = borderWidth/2 let y1 = borderWidth/2 let w1 = compWidth - borderWidth; - let h1 = compWidth - borderWidth; + let h1 = compHeight - borderWidth; switch (scaleType) { case ScaleType.FIT_START: x1 = borderWidth/2 @@ -314,7 +314,7 @@ export class ImageKnifeDrawFactory{ y1 = borderWidth/2 w1 = compWidth - borderWidth; - h1 = compWidth - borderWidth; + h1 = compHeight - borderWidth; this.roundRect(context, x1, y1, w1, h1, cornerRadius) break case ScaleType.FIT_XY: @@ -322,7 +322,7 @@ export class ImageKnifeDrawFactory{ y1 = borderWidth/2 w1 = compWidth - borderWidth; - h1 = compWidth - borderWidth; + h1 = compHeight - borderWidth; this.roundRect(context, x1, y1, w1, h1, cornerRadius) break case ScaleType.CENTER_INSIDE: