From 0d7a76310cee6ff76a35b14d521cd9d6bce6071f Mon Sep 17 00:00:00 2001 From: GColoy <77153550+GColoy@users.noreply.github.com> Date: Sat, 16 Sep 2023 21:06:34 +0200 Subject: [PATCH] added polybool library --- package.json | 1 + src/ExcalidrawAutomate.ts | 11 +++++++++++ src/polybooljs.d.ts | 1 + 3 files changed, 13 insertions(+) create mode 100644 src/polybooljs.d.ts diff --git a/package.json b/package.json index b26e52d..c4660e5 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ "gl-matrix": "^3.4.3", "lz-string": "^1.5.0", "monkey-around": "^2.3.0", + "polybooljs": "^1.2.0", "react": "^18.2.0", "react-dom": "^18.2.0", "roughjs": "^4.5.2", diff --git a/src/ExcalidrawAutomate.ts b/src/ExcalidrawAutomate.ts index fb6c1b3..55c5e22 100644 --- a/src/ExcalidrawAutomate.ts +++ b/src/ExcalidrawAutomate.ts @@ -77,6 +77,7 @@ import { ROUNDNESS } from "src/constants"; import { ClipboardData } from "@zsviczian/excalidraw/types/clipboard"; import { emulateKeysForLinkClick, KeyEvent, PaneTarget } from "src/utils/ModifierkeyHelper"; import { Mutable } from "@zsviczian/excalidraw/types/utility-types"; +import { Polybool } from "polybooljs"; extendPlugins([ HarmonyPlugin, @@ -2261,6 +2262,16 @@ export class ExcalidrawAutomate { return CM(color); } + /** + * Gets the class Polybool from https://github.com/velipso/polybooljs + * @returns + */ + getPolybool() { + const defaultEpsilon = 0.0000000001; + Polybool.epsilon(defaultEpsilon); + return Polybool; + } + importSVG(svgString:string):boolean { const res:ConversionResult = svgToExcalidraw(svgString); if(res.hasErrors) { diff --git a/src/polybooljs.d.ts b/src/polybooljs.d.ts new file mode 100644 index 0000000..fa38afa --- /dev/null +++ b/src/polybooljs.d.ts @@ -0,0 +1 @@ +declare module "polybooljs"; \ No newline at end of file