Skip to content

Commit e55da2a

Browse files
authored
fix(ui-canvas): iOS Path arcTo() sweep angle treat module 360 (#64)
1 parent d60ee44 commit e55da2a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/ui-canvas/canvas.ios.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -640,13 +640,17 @@ export class Path implements IPath {
640640
}
641641
arcTo(rect: Rect, startAngle: number, sweepAngle: number, forceMoveTo?: boolean) {
642642
const center = CGPointMake(rect.centerX(), rect.centerY());
643+
// This is how Android does things in arcTo
644+
const endAngle = (startAngle + sweepAngle) % 360;
645+
643646
let t = CGAffineTransformMakeTranslation(center.x, center.y);
644647
t = CGAffineTransformConcat(CGAffineTransformMakeScale(1.0, rect.height() / rect.width()), t);
648+
645649
if (this.mBPath) {
646-
this.mBPath.addArcWithCenterRadiusStartAngleEndAngleClockwise(center, rect.width() / 2, (startAngle * Math.PI) / 180, ((startAngle + sweepAngle) * Math.PI) / 180, sweepAngle < 0);
650+
this.mBPath.addArcWithCenterRadiusStartAngleEndAngleClockwise(center, rect.width() / 2, (startAngle * Math.PI) / 180, (endAngle * Math.PI) / 180, sweepAngle < 0);
647651
this.mBPath.applyTransform(t);
648652
} else {
649-
CGPathAddArc(this.mPath, new interop.Reference(t), 0, 0, rect.width() / 2, (startAngle * Math.PI) / 180, ((startAngle + sweepAngle) * Math.PI) / 180, sweepAngle < 0);
653+
CGPathAddArc(this.mPath, new interop.Reference(t), 0, 0, rect.width() / 2, (startAngle * Math.PI) / 180, (endAngle * Math.PI) / 180, sweepAngle < 0);
650654
}
651655
}
652656
//@ts-ignore

0 commit comments

Comments
 (0)