mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-23 02:38:12 +08:00
Clean up web code errors and make CI enforce them
This commit is contained in:
@@ -1,26 +0,0 @@
|
||||
import paper from "paper/dist/paper-core";
|
||||
|
||||
// Required setup to be used headlessly
|
||||
paper.setup(new paper.Size(1, 1));
|
||||
paper.view.autoUpdate = false;
|
||||
|
||||
export function booleanUnion(path1: string, path2: string): string {
|
||||
return booleanOperation(path1, path2, "unite");
|
||||
}
|
||||
|
||||
export function booleanSubtract(path1: string, path2: string): string {
|
||||
return booleanOperation(path1, path2, "subtract");
|
||||
}
|
||||
|
||||
export function booleanIntersect(path1: string, path2: string): string {
|
||||
return booleanOperation(path1, path2, "intersect");
|
||||
}
|
||||
|
||||
function booleanOperation(path1: string, path2: string, operation: "unite" | "subtract" | "intersect"): string {
|
||||
const paperPath1 = new paper.CompoundPath(path1);
|
||||
const paperPath2 = new paper.CompoundPath(path2);
|
||||
const result = paperPath1[operation](paperPath2);
|
||||
paperPath1.remove();
|
||||
paperPath2.remove();
|
||||
return result.pathData;
|
||||
}
|
||||
Reference in New Issue
Block a user