Skip to content

Commit

Permalink
0.0.5 - fix index.d.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
Dexus committed Jan 11, 2025
1 parent 419e358 commit 3051675
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
6 changes: 3 additions & 3 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@

/* auto-generated by NAPI-RS */

export const enum PolyType {
export enum PolyType {
Subject = 0,
Clip = 1
}
export const enum ClipType {
export enum ClipType {
None = 0,
Intersection = 1,
Union = 2,
Difference = 3,
Xor = 4
}
export const enum FillType {
export enum FillType {
EvenOdd = 0,
NonZero = 1,
Positive = 2,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@deepnest/clipper2",
"version": "0.0.4",
"version": "0.0.5",
"main": "index.js",
"types": "index.d.ts",
"napi": {
Expand Down
7 changes: 6 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@ use clipper2_sys::{
extern crate napi_derive;

#[napi]
#[derive(Debug)]
pub enum PolyType {
Subject,
Clip,
}

#[napi]
#[derive(Debug)]
pub enum ClipType {
None,
Intersection,
Expand All @@ -22,6 +24,7 @@ pub enum ClipType {
}

#[napi]
#[derive(Debug)]
pub enum FillType {
EvenOdd,
NonZero,
Expand Down Expand Up @@ -214,7 +217,7 @@ impl ClipperFloat64 {
} else if let PolyType::Clip = poly_type {
self.clipper.add_subject(path_a);
} else {
panic!("Invalid PolyType");
panic!("Invalid PolyType: {:?}", poly_type);
}
}

Expand All @@ -226,12 +229,14 @@ impl ClipperFloat64 {
ClipType::Union => ClipTypeOrig::Union,
ClipType::Difference => ClipTypeOrig::Difference,
ClipType::Xor => ClipTypeOrig::Xor,
_ => panic!("Invalid PolyType: {:?}", clip_type),
};
let fill_type = match fill_type {
FillType::EvenOdd => FillRule::EvenOdd,
FillType::NonZero => FillRule::NonZero,
FillType::Positive => FillRule::Positive,
FillType::Negative => FillRule::Negative,
_ => panic!("Invalid PolyType: {:?}", fill_type),
};
let path_c = self.clipper.boolean_operation(clip_type, fill_type);
let mut result = vec![];
Expand Down

0 comments on commit 3051675

Please sign in to comment.