Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add isCCW param for addCircle #2663

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion packages/skia/cpp/api/JsiSkPath.h
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,11 @@ class JsiSkPath : public JsiSkWrappingSharedPtrHostObject<SkPath> {
auto x = arguments[0].asNumber();
auto y = arguments[1].asNumber();
auto r = arguments[2].asNumber();
getObject()->addCircle(x, y, r);
auto direction = SkPathDirection::kCW;
if (count >= 4 && arguments[3].getBool()) {
direction = SkPathDirection::kCCW;
}
getObject()->addCircle(x, y, r, direction);
return thisValue.getObject(runtime);
}

Expand Down
2 changes: 1 addition & 1 deletion packages/skia/src/skia/types/Path/Path.ts
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ export interface SkPath extends SkJSIInstance<"Path"> {
@param radius distance from center to edge
@return reference to SkPath
*/
addCircle(x: number, y: number, r: number): SkPath;
addCircle(x: number, y: number, r: number, isCCW?: boolean): SkPath;

getLastPt(): { x: number; y: number };

Expand Down
4 changes: 2 additions & 2 deletions packages/skia/src/skia/web/JsiSkPath.ts
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,8 @@ export class JsiSkPath extends HostObject<Path, "Path"> implements SkPath {
return this.ref.isVolatile();
}

addCircle(x: number, y: number, r: number) {
this.ref.addCircle(x, y, r);
addCircle(x: number, y: number, r: number, isCCW?: boolean) {
this.ref.addCircle(x, y, r, isCCW);
return this;
}

Expand Down
Loading