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: