1.修复ImageKnifeDrawFactory中的setOval和setRect的中心点取值错误问题

Signed-off-by: zhoulisheng1 <zhoulisheng1@huawei.com>
This commit is contained in:
zhoulisheng1 2023-05-06 18:05:19 +08:00
parent 3df0657c84
commit 62b4dd16ad
1 changed files with 6 additions and 6 deletions

View File

@ -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: