Skip to content

Commit

Permalink
Add isCCW param for addCircle
Browse files Browse the repository at this point in the history
  • Loading branch information
just-dodo committed Sep 30, 2024
1 parent 8f016e9 commit 8dd26be
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
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

0 comments on commit 8dd26be

Please sign in to comment.