js-draw 0.23.1 → 0.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build-config.json +23 -0
- package/dist/bundle.js +3 -3
- package/dist/bundledStyles.js +1 -1
- package/dist/cjs/Color4.js +263 -0
- package/dist/cjs/Editor.d.ts +328 -0
- package/dist/cjs/Editor.js +1058 -0
- package/dist/cjs/EditorImage.d.ts +97 -0
- package/dist/cjs/EditorImage.js +531 -0
- package/dist/cjs/EventDispatcher.d.ts +29 -0
- package/dist/cjs/EventDispatcher.js +58 -0
- package/dist/cjs/Pointer.d.ts +37 -0
- package/dist/cjs/Pointer.js +123 -0
- package/dist/cjs/SVGLoader.d.ts +48 -0
- package/dist/cjs/SVGLoader.js +667 -0
- package/dist/cjs/SVGLoader.test.d.ts +1 -0
- package/dist/cjs/UndoRedoHistory.js +105 -0
- package/dist/cjs/UndoRedoHistory.test.d.ts +1 -0
- package/dist/cjs/Viewport.d.ts +73 -0
- package/dist/cjs/Viewport.js +307 -0
- package/dist/cjs/bundle/bundled.js +21 -0
- package/dist/cjs/commands/Command.js +61 -0
- package/dist/cjs/commands/Duplicate.js +80 -0
- package/dist/cjs/commands/Erase.js +101 -0
- package/dist/cjs/commands/SerializableCommand.js +57 -0
- package/dist/cjs/commands/UnresolvedCommand.js +43 -0
- package/dist/cjs/commands/invertCommand.js +77 -0
- package/dist/cjs/commands/lib.js +15 -0
- package/dist/cjs/commands/localization.d.ts +23 -0
- package/dist/cjs/commands/localization.js +24 -0
- package/dist/cjs/commands/uniteCommands.js +152 -0
- package/dist/cjs/commands/uniteCommands.test.d.ts +1 -0
- package/dist/cjs/components/AbstractComponent.d.ts +85 -0
- package/dist/cjs/components/AbstractComponent.js +300 -0
- package/dist/cjs/components/AbstractComponent.transformBy.test.d.ts +1 -0
- package/dist/cjs/components/BackgroundComponent.d.ts +62 -0
- package/dist/cjs/components/BackgroundComponent.js +311 -0
- package/dist/cjs/components/BackgroundComponent.test.d.ts +1 -0
- package/dist/cjs/components/ImageComponent.d.ts +31 -0
- package/dist/cjs/components/ImageComponent.js +228 -0
- package/dist/cjs/components/RestylableComponent.js +103 -0
- package/dist/cjs/components/SVGGlobalAttributesObject.d.ts +21 -0
- package/dist/cjs/components/SVGGlobalAttributesObject.js +82 -0
- package/dist/cjs/components/Stroke.d.ts +76 -0
- package/dist/cjs/components/Stroke.js +271 -0
- package/dist/cjs/components/Stroke.test.d.ts +1 -0
- package/dist/cjs/components/TextComponent.d.ts +79 -0
- package/dist/cjs/components/TextComponent.js +411 -0
- package/dist/cjs/components/TextComponent.test.d.ts +1 -0
- package/dist/cjs/components/UnknownSVGObject.d.ts +18 -0
- package/dist/cjs/components/UnknownSVGObject.js +65 -0
- package/dist/cjs/components/UnknownSVGObject.test.d.ts +1 -0
- package/dist/cjs/components/builders/ArrowBuilder.d.ts +19 -0
- package/dist/cjs/components/builders/ArrowBuilder.js +93 -0
- package/dist/cjs/components/builders/CircleBuilder.d.ts +2 -0
- package/dist/cjs/components/builders/CircleBuilder.js +74 -0
- package/dist/cjs/components/builders/FreehandLineBuilder.d.ts +33 -0
- package/dist/cjs/components/builders/FreehandLineBuilder.js +183 -0
- package/dist/cjs/components/builders/FreehandLineBuilder.test.d.ts +1 -0
- package/dist/cjs/components/builders/LineBuilder.d.ts +18 -0
- package/dist/cjs/components/builders/LineBuilder.js +65 -0
- package/dist/cjs/components/builders/PressureSensitiveFreehandLineBuilder.d.ts +36 -0
- package/dist/cjs/components/builders/PressureSensitiveFreehandLineBuilder.js +351 -0
- package/dist/cjs/components/builders/RectangleBuilder.d.ts +20 -0
- package/dist/cjs/components/builders/RectangleBuilder.js +58 -0
- package/dist/cjs/components/builders/types.d.ts +12 -0
- package/dist/cjs/components/lib.d.ts +14 -0
- package/dist/cjs/components/lib.js +42 -0
- package/dist/cjs/components/localization.js +14 -0
- package/dist/cjs/components/util/StrokeSmoother.d.ts +35 -0
- package/dist/cjs/components/util/StrokeSmoother.js +225 -0
- package/dist/cjs/components/util/describeComponentList.d.ts +4 -0
- package/dist/cjs/components/util/describeComponentList.js +17 -0
- package/dist/cjs/lib.d.ts +66 -0
- package/dist/cjs/lib.js +94 -0
- package/dist/cjs/localization.js +24 -0
- package/dist/cjs/localizations/de.js +17 -0
- package/dist/cjs/localizations/en.js +17 -0
- package/dist/cjs/localizations/es.js +31 -0
- package/dist/cjs/localizations/getLocalizationTable.d.ts +17 -0
- package/dist/cjs/localizations/getLocalizationTable.js +65 -0
- package/dist/cjs/localizations/getLocalizationTable.test.d.ts +1 -0
- package/dist/cjs/math/Mat33.d.ts +123 -0
- package/dist/cjs/math/Mat33.js +340 -0
- package/dist/cjs/math/Mat33.test.d.ts +1 -0
- package/dist/cjs/math/Vec2.js +37 -0
- package/dist/cjs/math/Vec2.test.d.ts +1 -0
- package/dist/cjs/math/Vec3.js +183 -0
- package/dist/cjs/math/Vec3.test.d.ts +1 -0
- package/dist/cjs/math/lib.d.ts +7 -0
- package/dist/cjs/math/lib.js +15 -0
- package/dist/cjs/math/polynomial/solveQuadratic.d.ts +9 -0
- package/dist/cjs/math/polynomial/solveQuadratic.js +39 -0
- package/dist/cjs/math/polynomial/solveQuadratic.test.d.ts +1 -0
- package/dist/cjs/math/rounding.js +140 -0
- package/dist/cjs/math/rounding.test.d.ts +1 -0
- package/dist/cjs/math/shapes/Abstract2DShape.d.ts +49 -0
- package/dist/cjs/math/shapes/Abstract2DShape.js +42 -0
- package/dist/cjs/math/shapes/BezierJSWrapper.d.ts +36 -0
- package/dist/cjs/math/shapes/BezierJSWrapper.js +109 -0
- package/dist/cjs/math/shapes/CubicBezier.d.ts +17 -0
- package/dist/cjs/math/shapes/CubicBezier.js +50 -0
- package/dist/cjs/math/shapes/LineSegment2.d.ts +70 -0
- package/dist/cjs/math/shapes/LineSegment2.js +204 -0
- package/dist/cjs/math/shapes/LineSegment2.test.d.ts +1 -0
- package/dist/cjs/math/shapes/Path.d.ts +93 -0
- package/dist/cjs/math/shapes/Path.fromString.test.d.ts +1 -0
- package/dist/cjs/math/shapes/Path.js +865 -0
- package/dist/cjs/math/shapes/Path.test.d.ts +1 -0
- package/dist/cjs/math/shapes/Path.toString.test.d.ts +1 -0
- package/dist/cjs/math/shapes/PointShape2D.d.ts +18 -0
- package/dist/cjs/math/shapes/PointShape2D.js +46 -0
- package/dist/cjs/math/shapes/QuadraticBezier.d.ts +34 -0
- package/dist/cjs/math/shapes/QuadraticBezier.js +133 -0
- package/dist/cjs/math/shapes/QuadraticBezier.test.d.ts +1 -0
- package/dist/cjs/math/shapes/Rect2.d.ts +57 -0
- package/dist/cjs/math/shapes/Rect2.js +311 -0
- package/dist/cjs/math/shapes/Rect2.test.d.ts +1 -0
- package/dist/cjs/math/shapes/Triangle.d.ts +46 -0
- package/dist/cjs/math/shapes/Triangle.js +148 -0
- package/dist/cjs/math/shapes/Triangle.test.d.ts +1 -0
- package/dist/cjs/rendering/Display.js +222 -0
- package/dist/cjs/rendering/RenderingStyle.d.ts +31 -0
- package/dist/cjs/rendering/RenderingStyle.js +56 -0
- package/dist/cjs/rendering/RenderingStyle.test.d.ts +1 -0
- package/dist/cjs/rendering/TextRenderingStyle.d.ts +43 -0
- package/dist/cjs/rendering/TextRenderingStyle.js +40 -0
- package/dist/cjs/rendering/caching/CacheRecord.d.ts +20 -0
- package/dist/cjs/rendering/caching/CacheRecord.js +59 -0
- package/dist/cjs/rendering/caching/CacheRecord.test.d.ts +1 -0
- package/dist/cjs/rendering/caching/CacheRecordManager.d.ts +12 -0
- package/dist/cjs/rendering/caching/CacheRecordManager.js +48 -0
- package/dist/cjs/rendering/caching/RenderingCache.js +50 -0
- package/dist/cjs/rendering/caching/RenderingCache.test.d.ts +1 -0
- package/dist/cjs/rendering/caching/RenderingCacheNode.d.ts +29 -0
- package/dist/cjs/rendering/caching/RenderingCacheNode.js +340 -0
- package/dist/cjs/rendering/caching/testUtils.js +34 -0
- package/dist/cjs/rendering/lib.js +14 -0
- package/dist/cjs/rendering/localization.js +12 -0
- package/dist/cjs/rendering/renderers/AbstractRenderer.d.ts +85 -0
- package/dist/cjs/rendering/renderers/AbstractRenderer.js +168 -0
- package/dist/cjs/rendering/renderers/CanvasRenderer.d.ts +63 -0
- package/dist/cjs/rendering/renderers/CanvasRenderer.js +263 -0
- package/dist/cjs/rendering/renderers/DummyRenderer.d.ts +35 -0
- package/dist/cjs/rendering/renderers/DummyRenderer.js +132 -0
- package/dist/cjs/rendering/renderers/DummyRenderer.test.d.ts +1 -0
- package/dist/cjs/rendering/renderers/SVGRenderer.d.ts +57 -0
- package/dist/cjs/rendering/renderers/SVGRenderer.js +355 -0
- package/dist/cjs/rendering/renderers/TextOnlyRenderer.d.ts +29 -0
- package/dist/cjs/rendering/renderers/TextOnlyRenderer.js +89 -0
- package/dist/cjs/rendering/renderers/TextOnlyRenderer.test.d.ts +1 -0
- package/dist/cjs/shortcuts/KeyBinding.d.ts +46 -0
- package/dist/cjs/shortcuts/KeyBinding.js +157 -0
- package/dist/cjs/shortcuts/KeyBinding.test.d.ts +1 -0
- package/dist/cjs/shortcuts/KeyboardShortcutManager.d.ts +77 -0
- package/dist/cjs/shortcuts/KeyboardShortcutManager.js +148 -0
- package/dist/cjs/shortcuts/KeyboardShortcutManager.test.d.ts +1 -0
- package/dist/cjs/shortcuts/lib.d.ts +2 -0
- package/dist/cjs/shortcuts/lib.js +7 -0
- package/dist/cjs/testing/createEditor.js +11 -0
- package/dist/cjs/testing/lib.js +7 -0
- package/dist/cjs/testing/sendPenEvent.js +21 -0
- package/dist/cjs/testing/sendTouchEvent.js +73 -0
- package/dist/cjs/toolbar/HTMLToolbar.js +465 -0
- package/dist/cjs/toolbar/IconProvider.js +274 -0
- package/dist/cjs/toolbar/lib.js +21 -0
- package/dist/cjs/toolbar/localization.d.ts +52 -0
- package/dist/cjs/toolbar/localization.js +54 -0
- package/dist/cjs/toolbar/makeColorInput.js +125 -0
- package/dist/cjs/toolbar/widgets/ActionButtonWidget.js +47 -0
- package/dist/cjs/toolbar/widgets/BaseToolWidget.js +64 -0
- package/dist/cjs/toolbar/widgets/BaseWidget.js +359 -0
- package/dist/cjs/toolbar/widgets/DocumentPropertiesWidget.js +196 -0
- package/dist/cjs/toolbar/widgets/EraserToolWidget.js +90 -0
- package/dist/cjs/toolbar/widgets/HandToolWidget.js +211 -0
- package/dist/cjs/toolbar/widgets/InsertImageWidget.js +246 -0
- package/dist/cjs/toolbar/widgets/OverflowWidget.js +103 -0
- package/dist/cjs/toolbar/widgets/PenToolWidget.js +264 -0
- package/dist/cjs/toolbar/widgets/SelectionToolWidget.js +213 -0
- package/dist/cjs/toolbar/widgets/TextToolWidget.js +142 -0
- package/dist/cjs/toolbar/widgets/keybindings.d.ts +2 -0
- package/dist/cjs/toolbar/widgets/keybindings.js +13 -0
- package/dist/cjs/toolbar/widgets/lib.js +23 -0
- package/dist/cjs/tools/BaseTool.js +67 -0
- package/dist/cjs/tools/Eraser.d.ts +24 -0
- package/dist/cjs/tools/Eraser.js +148 -0
- package/dist/cjs/tools/Eraser.test.d.ts +1 -0
- package/dist/cjs/tools/FindTool.d.ts +20 -0
- package/dist/cjs/tools/FindTool.js +137 -0
- package/dist/cjs/tools/PanZoom.d.ts +52 -0
- package/dist/cjs/tools/PanZoom.js +471 -0
- package/dist/cjs/tools/PanZoom.test.d.ts +1 -0
- package/dist/cjs/tools/PasteHandler.js +179 -0
- package/dist/cjs/tools/Pen.d.ts +41 -0
- package/dist/cjs/tools/Pen.js +238 -0
- package/dist/cjs/tools/Pen.test.d.ts +1 -0
- package/dist/cjs/tools/PipetteTool.js +63 -0
- package/dist/cjs/tools/SelectionTool/SelectAllShortcutHandler.d.ts +8 -0
- package/dist/cjs/tools/SelectionTool/SelectAllShortcutHandler.js +44 -0
- package/dist/cjs/tools/SelectionTool/Selection.d.ts +64 -0
- package/dist/cjs/tools/SelectionTool/Selection.js +602 -0
- package/dist/cjs/tools/SelectionTool/SelectionHandle.js +86 -0
- package/dist/cjs/tools/SelectionTool/SelectionTool.d.ts +37 -0
- package/dist/cjs/tools/SelectionTool/SelectionTool.js +441 -0
- package/dist/cjs/tools/SelectionTool/SelectionTool.test.d.ts +1 -0
- package/dist/cjs/tools/SelectionTool/TransformMode.js +107 -0
- package/dist/cjs/tools/SelectionTool/types.js +14 -0
- package/dist/cjs/tools/SoundUITool.js +182 -0
- package/dist/cjs/tools/TextTool.d.ts +34 -0
- package/dist/cjs/tools/TextTool.js +284 -0
- package/dist/cjs/tools/ToolController.js +179 -0
- package/dist/cjs/tools/ToolEnabledGroup.js +16 -0
- package/dist/cjs/tools/ToolSwitcherShortcut.js +54 -0
- package/dist/cjs/tools/ToolbarShortcutHandler.js +50 -0
- package/dist/cjs/tools/UndoRedoShortcut.d.ts +8 -0
- package/dist/cjs/tools/UndoRedoShortcut.js +42 -0
- package/dist/cjs/tools/UndoRedoShortcut.test.d.ts +1 -0
- package/dist/cjs/tools/keybindings.d.ts +17 -0
- package/dist/cjs/tools/keybindings.js +44 -0
- package/dist/cjs/tools/lib.js +35 -0
- package/dist/cjs/tools/localization.js +33 -0
- package/dist/cjs/types.d.ts +154 -0
- package/dist/cjs/types.js +38 -0
- package/dist/cjs/util/assertions.js +54 -0
- package/dist/cjs/util/fileToBase64.js +15 -0
- package/dist/cjs/util/untilNextAnimationFrame.js +9 -0
- package/dist/cjs/util/waitForAll.js +17 -0
- package/dist/cjs/util/waitForTimeout.js +9 -0
- package/dist/mjs/Color4.mjs +260 -0
- package/dist/mjs/Color4.test.d.ts +1 -0
- package/dist/mjs/Editor.d.ts +328 -0
- package/dist/mjs/Editor.loadFrom.test.d.ts +1 -0
- package/dist/mjs/Editor.mjs +1055 -0
- package/dist/mjs/Editor.toSVG.test.d.ts +1 -0
- package/dist/mjs/EditorImage.d.ts +97 -0
- package/dist/mjs/EditorImage.mjs +527 -0
- package/dist/mjs/EditorImage.test.d.ts +1 -0
- package/dist/mjs/EventDispatcher.d.ts +29 -0
- package/dist/mjs/EventDispatcher.mjs +56 -0
- package/dist/mjs/EventDispatcher.test.d.ts +1 -0
- package/dist/mjs/Pointer.d.ts +37 -0
- package/dist/mjs/Pointer.mjs +120 -0
- package/dist/mjs/SVGLoader.d.ts +48 -0
- package/dist/mjs/SVGLoader.mjs +664 -0
- package/dist/mjs/SVGLoader.test.d.ts +1 -0
- package/dist/mjs/UndoRedoHistory.mjs +103 -0
- package/dist/mjs/UndoRedoHistory.test.d.ts +1 -0
- package/dist/mjs/Viewport.d.ts +73 -0
- package/dist/mjs/Viewport.mjs +304 -0
- package/dist/mjs/commands/Command.mjs +58 -0
- package/dist/mjs/commands/Duplicate.mjs +78 -0
- package/dist/mjs/commands/Erase.mjs +99 -0
- package/dist/mjs/commands/SerializableCommand.mjs +55 -0
- package/dist/mjs/commands/UnresolvedCommand.mjs +41 -0
- package/dist/mjs/commands/invertCommand.mjs +75 -0
- package/dist/mjs/commands/localization.d.ts +23 -0
- package/dist/mjs/commands/localization.mjs +21 -0
- package/dist/mjs/commands/uniteCommands.mjs +150 -0
- package/dist/mjs/commands/uniteCommands.test.d.ts +1 -0
- package/dist/mjs/components/AbstractComponent.d.ts +85 -0
- package/dist/mjs/components/AbstractComponent.mjs +298 -0
- package/dist/mjs/components/AbstractComponent.transformBy.test.d.ts +1 -0
- package/dist/mjs/components/BackgroundComponent.d.ts +62 -0
- package/dist/mjs/components/BackgroundComponent.mjs +308 -0
- package/dist/mjs/components/BackgroundComponent.test.d.ts +1 -0
- package/dist/mjs/components/ImageComponent.d.ts +31 -0
- package/dist/mjs/components/ImageComponent.mjs +226 -0
- package/dist/mjs/components/RestylableComponent.mjs +98 -0
- package/dist/mjs/components/SVGGlobalAttributesObject.d.ts +21 -0
- package/dist/mjs/components/SVGGlobalAttributesObject.mjs +80 -0
- package/dist/mjs/components/Stroke.d.ts +76 -0
- package/dist/mjs/components/Stroke.mjs +269 -0
- package/dist/mjs/components/Stroke.test.d.ts +1 -0
- package/dist/mjs/components/TextComponent.d.ts +79 -0
- package/dist/mjs/components/TextComponent.mjs +408 -0
- package/dist/mjs/components/TextComponent.test.d.ts +1 -0
- package/dist/mjs/components/UnknownSVGObject.d.ts +18 -0
- package/dist/mjs/components/UnknownSVGObject.mjs +63 -0
- package/dist/mjs/components/UnknownSVGObject.test.d.ts +1 -0
- package/dist/mjs/components/builders/ArrowBuilder.d.ts +19 -0
- package/dist/mjs/components/builders/ArrowBuilder.mjs +89 -0
- package/dist/mjs/components/builders/CircleBuilder.d.ts +2 -0
- package/dist/mjs/components/builders/CircleBuilder.mjs +70 -0
- package/dist/mjs/components/builders/FreehandLineBuilder.d.ts +33 -0
- package/dist/mjs/components/builders/FreehandLineBuilder.mjs +179 -0
- package/dist/mjs/components/builders/FreehandLineBuilder.test.d.ts +1 -0
- package/dist/mjs/components/builders/LineBuilder.d.ts +18 -0
- package/dist/mjs/components/builders/LineBuilder.mjs +61 -0
- package/dist/mjs/components/builders/PressureSensitiveFreehandLineBuilder.d.ts +36 -0
- package/dist/mjs/components/builders/PressureSensitiveFreehandLineBuilder.mjs +347 -0
- package/dist/mjs/components/builders/RectangleBuilder.d.ts +20 -0
- package/dist/mjs/components/builders/RectangleBuilder.mjs +53 -0
- package/dist/mjs/components/builders/types.d.ts +12 -0
- package/dist/mjs/components/builders/types.mjs +1 -0
- package/dist/mjs/components/lib.d.ts +14 -0
- package/dist/mjs/components/lib.mjs +15 -0
- package/dist/mjs/components/localization.mjs +11 -0
- package/dist/mjs/components/util/StrokeSmoother.d.ts +35 -0
- package/dist/mjs/components/util/StrokeSmoother.mjs +222 -0
- package/dist/mjs/components/util/describeComponentList.d.ts +4 -0
- package/dist/mjs/components/util/describeComponentList.mjs +15 -0
- package/dist/mjs/lib.d.ts +66 -0
- package/dist/mjs/lib.mjs +66 -0
- package/dist/mjs/localization.mjs +21 -0
- package/dist/mjs/localizations/de.mjs +15 -0
- package/dist/mjs/localizations/en.mjs +15 -0
- package/dist/mjs/localizations/es.mjs +29 -0
- package/dist/mjs/localizations/getLocalizationTable.d.ts +17 -0
- package/dist/mjs/localizations/getLocalizationTable.mjs +61 -0
- package/dist/mjs/localizations/getLocalizationTable.test.d.ts +1 -0
- package/dist/mjs/math/Mat33.d.ts +123 -0
- package/dist/mjs/math/Mat33.mjs +338 -0
- package/dist/mjs/math/Mat33.test.d.ts +1 -0
- package/dist/mjs/math/Vec2.mjs +34 -0
- package/dist/mjs/math/Vec2.test.d.ts +1 -0
- package/dist/mjs/math/Vec3.mjs +181 -0
- package/dist/mjs/math/Vec3.test.d.ts +1 -0
- package/dist/mjs/math/lib.d.ts +7 -0
- package/dist/mjs/math/lib.mjs +7 -0
- package/dist/mjs/math/polynomial/solveQuadratic.d.ts +9 -0
- package/dist/mjs/math/polynomial/solveQuadratic.mjs +37 -0
- package/dist/mjs/math/polynomial/solveQuadratic.test.d.ts +1 -0
- package/dist/mjs/math/rounding.mjs +133 -0
- package/dist/mjs/math/rounding.test.d.ts +1 -0
- package/dist/mjs/math/shapes/Abstract2DShape.d.ts +49 -0
- package/dist/mjs/math/shapes/Abstract2DShape.mjs +40 -0
- package/dist/mjs/math/shapes/BezierJSWrapper.d.ts +36 -0
- package/dist/mjs/math/shapes/BezierJSWrapper.mjs +107 -0
- package/dist/mjs/math/shapes/CubicBezier.d.ts +17 -0
- package/dist/mjs/math/shapes/CubicBezier.mjs +48 -0
- package/dist/mjs/math/shapes/LineSegment2.d.ts +70 -0
- package/dist/mjs/math/shapes/LineSegment2.mjs +202 -0
- package/dist/mjs/math/shapes/LineSegment2.test.d.ts +1 -0
- package/dist/mjs/math/shapes/Path.d.ts +93 -0
- package/dist/mjs/math/shapes/Path.fromString.test.d.ts +1 -0
- package/dist/mjs/math/shapes/Path.mjs +862 -0
- package/dist/mjs/math/shapes/Path.test.d.ts +1 -0
- package/dist/mjs/math/shapes/Path.toString.test.d.ts +1 -0
- package/dist/mjs/math/shapes/PointShape2D.d.ts +18 -0
- package/dist/mjs/math/shapes/PointShape2D.mjs +44 -0
- package/dist/mjs/math/shapes/QuadraticBezier.d.ts +34 -0
- package/dist/mjs/math/shapes/QuadraticBezier.mjs +131 -0
- package/dist/mjs/math/shapes/QuadraticBezier.test.d.ts +1 -0
- package/dist/mjs/math/shapes/Rect2.d.ts +57 -0
- package/dist/mjs/math/shapes/Rect2.mjs +309 -0
- package/dist/mjs/math/shapes/Rect2.test.d.ts +1 -0
- package/dist/mjs/math/shapes/Triangle.d.ts +46 -0
- package/dist/mjs/math/shapes/Triangle.mjs +146 -0
- package/dist/mjs/math/shapes/Triangle.test.d.ts +1 -0
- package/dist/mjs/rendering/Display.mjs +219 -0
- package/dist/mjs/rendering/RenderingStyle.d.ts +31 -0
- package/dist/mjs/rendering/RenderingStyle.mjs +49 -0
- package/dist/mjs/rendering/RenderingStyle.test.d.ts +1 -0
- package/dist/mjs/rendering/TextRenderingStyle.d.ts +43 -0
- package/dist/mjs/rendering/TextRenderingStyle.mjs +34 -0
- package/dist/mjs/rendering/caching/CacheRecord.d.ts +20 -0
- package/dist/mjs/rendering/caching/CacheRecord.mjs +57 -0
- package/dist/mjs/rendering/caching/CacheRecord.test.d.ts +1 -0
- package/dist/mjs/rendering/caching/CacheRecordManager.d.ts +12 -0
- package/dist/mjs/rendering/caching/CacheRecordManager.mjs +45 -0
- package/dist/mjs/rendering/caching/RenderingCache.mjs +48 -0
- package/dist/mjs/rendering/caching/RenderingCache.test.d.ts +1 -0
- package/dist/mjs/rendering/caching/RenderingCacheNode.d.ts +29 -0
- package/dist/mjs/rendering/caching/RenderingCacheNode.mjs +338 -0
- package/dist/mjs/rendering/caching/testUtils.mjs +30 -0
- package/dist/mjs/rendering/caching/types.mjs +1 -0
- package/dist/mjs/rendering/localization.mjs +9 -0
- package/dist/mjs/rendering/renderers/AbstractRenderer.d.ts +85 -0
- package/dist/mjs/rendering/renderers/AbstractRenderer.mjs +166 -0
- package/dist/mjs/rendering/renderers/CanvasRenderer.d.ts +63 -0
- package/dist/mjs/rendering/renderers/CanvasRenderer.mjs +261 -0
- package/dist/mjs/rendering/renderers/DummyRenderer.d.ts +35 -0
- package/dist/mjs/rendering/renderers/DummyRenderer.mjs +130 -0
- package/dist/mjs/rendering/renderers/DummyRenderer.test.d.ts +1 -0
- package/dist/mjs/rendering/renderers/SVGRenderer.d.ts +57 -0
- package/dist/mjs/rendering/renderers/SVGRenderer.mjs +352 -0
- package/dist/mjs/rendering/renderers/TextOnlyRenderer.d.ts +29 -0
- package/dist/mjs/rendering/renderers/TextOnlyRenderer.mjs +87 -0
- package/dist/mjs/rendering/renderers/TextOnlyRenderer.test.d.ts +1 -0
- package/dist/mjs/shortcuts/KeyBinding.d.ts +46 -0
- package/dist/mjs/shortcuts/KeyBinding.mjs +155 -0
- package/dist/mjs/shortcuts/KeyBinding.test.d.ts +1 -0
- package/dist/mjs/shortcuts/KeyboardShortcutManager.d.ts +77 -0
- package/dist/mjs/shortcuts/KeyboardShortcutManager.mjs +146 -0
- package/dist/mjs/shortcuts/KeyboardShortcutManager.test.d.ts +1 -0
- package/dist/mjs/shortcuts/lib.d.ts +2 -0
- package/dist/mjs/shortcuts/lib.mjs +2 -0
- package/dist/mjs/testing/createEditor.mjs +9 -0
- package/dist/mjs/testing/sendPenEvent.mjs +19 -0
- package/dist/mjs/testing/sendTouchEvent.mjs +71 -0
- package/dist/mjs/toolbar/HTMLToolbar.mjs +462 -0
- package/dist/mjs/toolbar/IconProvider.mjs +272 -0
- package/dist/mjs/toolbar/localization.d.ts +52 -0
- package/dist/mjs/toolbar/localization.mjs +51 -0
- package/dist/mjs/toolbar/makeColorInput.mjs +121 -0
- package/dist/mjs/toolbar/types.mjs +1 -0
- package/dist/mjs/toolbar/widgets/ActionButtonWidget.mjs +45 -0
- package/dist/mjs/toolbar/widgets/BaseToolWidget.mjs +62 -0
- package/dist/mjs/toolbar/widgets/BaseWidget.mjs +357 -0
- package/dist/mjs/toolbar/widgets/DocumentPropertiesWidget.mjs +194 -0
- package/dist/mjs/toolbar/widgets/EraserToolWidget.mjs +88 -0
- package/dist/mjs/toolbar/widgets/HandToolWidget.mjs +209 -0
- package/dist/mjs/toolbar/widgets/InsertImageWidget.mjs +244 -0
- package/dist/mjs/toolbar/widgets/OverflowWidget.mjs +101 -0
- package/dist/mjs/toolbar/widgets/PenToolWidget.mjs +262 -0
- package/dist/mjs/toolbar/widgets/SelectionToolWidget.mjs +211 -0
- package/dist/mjs/toolbar/widgets/TextToolWidget.mjs +140 -0
- package/dist/mjs/toolbar/widgets/keybindings.d.ts +2 -0
- package/dist/mjs/toolbar/widgets/keybindings.mjs +10 -0
- package/dist/mjs/tools/BaseTool.mjs +65 -0
- package/dist/mjs/tools/Eraser.d.ts +24 -0
- package/dist/mjs/tools/Eraser.mjs +146 -0
- package/dist/mjs/tools/Eraser.test.d.ts +1 -0
- package/dist/mjs/tools/FindTool.d.ts +20 -0
- package/dist/mjs/tools/FindTool.mjs +135 -0
- package/dist/mjs/tools/PanZoom.d.ts +52 -0
- package/dist/mjs/tools/PanZoom.mjs +468 -0
- package/dist/mjs/tools/PanZoom.test.d.ts +1 -0
- package/dist/mjs/tools/PasteHandler.mjs +177 -0
- package/dist/mjs/tools/Pen.d.ts +41 -0
- package/dist/mjs/tools/Pen.mjs +236 -0
- package/dist/mjs/tools/Pen.test.d.ts +1 -0
- package/dist/mjs/tools/PipetteTool.mjs +61 -0
- package/dist/mjs/tools/SelectionTool/SelectAllShortcutHandler.d.ts +8 -0
- package/dist/mjs/tools/SelectionTool/SelectAllShortcutHandler.mjs +42 -0
- package/dist/mjs/tools/SelectionTool/Selection.d.ts +64 -0
- package/dist/mjs/tools/SelectionTool/Selection.mjs +600 -0
- package/dist/mjs/tools/SelectionTool/SelectionHandle.mjs +83 -0
- package/dist/mjs/tools/SelectionTool/SelectionTool.d.ts +37 -0
- package/dist/mjs/tools/SelectionTool/SelectionTool.mjs +438 -0
- package/dist/mjs/tools/SelectionTool/SelectionTool.test.d.ts +1 -0
- package/dist/mjs/tools/SelectionTool/TransformMode.mjs +104 -0
- package/dist/mjs/tools/SoundUITool.mjs +180 -0
- package/dist/mjs/tools/TextTool.d.ts +34 -0
- package/dist/mjs/tools/TextTool.mjs +282 -0
- package/dist/mjs/tools/ToolController.mjs +177 -0
- package/dist/mjs/tools/ToolEnabledGroup.mjs +14 -0
- package/dist/mjs/tools/ToolSwitcherShortcut.mjs +52 -0
- package/dist/mjs/tools/ToolbarShortcutHandler.mjs +48 -0
- package/dist/mjs/tools/UndoRedoShortcut.d.ts +8 -0
- package/dist/mjs/tools/UndoRedoShortcut.mjs +40 -0
- package/dist/mjs/tools/UndoRedoShortcut.test.d.ts +1 -0
- package/dist/mjs/tools/keybindings.d.ts +17 -0
- package/dist/mjs/tools/keybindings.mjs +41 -0
- package/dist/mjs/tools/localization.mjs +30 -0
- package/dist/mjs/types.d.ts +154 -0
- package/dist/mjs/util/assertions.mjs +48 -0
- package/dist/mjs/util/fileToBase64.mjs +13 -0
- package/dist/mjs/util/untilNextAnimationFrame.mjs +7 -0
- package/dist/mjs/util/waitForAll.mjs +15 -0
- package/dist/mjs/util/waitForTimeout.mjs +7 -0
- package/dist-test/test_imports/package-lock.json +13 -0
- package/dist-test/test_imports/package.json +12 -0
- package/dist-test/test_imports/test-imports.js +17 -0
- package/dist-test/test_imports/test-require.cjs +19 -0
- package/package.json +98 -124
- package/src/Color4.test.ts +47 -0
- package/src/Color4.ts +304 -0
- package/src/Editor.loadFrom.test.ts +24 -0
- package/src/Editor.toSVG.test.ts +111 -0
- package/src/Editor.ts +1171 -0
- package/src/EditorImage.test.ts +120 -0
- package/src/EditorImage.ts +603 -0
- package/src/EventDispatcher.test.ts +123 -0
- package/src/EventDispatcher.ts +72 -0
- package/src/Pointer.ts +167 -0
- package/src/SVGLoader.test.ts +114 -0
- package/src/SVGLoader.ts +610 -0
- package/src/UndoRedoHistory.test.ts +33 -0
- package/src/UndoRedoHistory.ts +102 -0
- package/src/Viewport.ts +325 -0
- package/src/bundle/bundled.ts +7 -0
- package/src/commands/Command.ts +45 -0
- package/src/commands/Duplicate.ts +75 -0
- package/src/commands/Erase.ts +94 -0
- package/src/commands/SerializableCommand.ts +49 -0
- package/src/commands/UnresolvedCommand.ts +37 -0
- package/src/commands/invertCommand.ts +58 -0
- package/src/commands/lib.ts +16 -0
- package/src/commands/localization.ts +47 -0
- package/src/commands/uniteCommands.test.ts +23 -0
- package/src/commands/uniteCommands.ts +140 -0
- package/src/components/AbstractComponent.transformBy.test.ts +22 -0
- package/src/components/AbstractComponent.ts +374 -0
- package/src/components/BackgroundComponent.test.ts +45 -0
- package/src/components/BackgroundComponent.ts +353 -0
- package/src/components/ImageComponent.ts +178 -0
- package/src/components/RestylableComponent.ts +161 -0
- package/src/components/SVGGlobalAttributesObject.ts +81 -0
- package/src/components/Stroke.test.ts +139 -0
- package/src/components/Stroke.ts +296 -0
- package/src/components/TextComponent.test.ts +204 -0
- package/src/components/TextComponent.ts +432 -0
- package/src/components/UnknownSVGObject.test.ts +10 -0
- package/src/components/UnknownSVGObject.ts +60 -0
- package/src/components/builders/ArrowBuilder.ts +107 -0
- package/src/components/builders/CircleBuilder.ts +102 -0
- package/src/components/builders/FreehandLineBuilder.test.ts +25 -0
- package/src/components/builders/FreehandLineBuilder.ts +212 -0
- package/src/components/builders/LineBuilder.ts +77 -0
- package/src/components/builders/PressureSensitiveFreehandLineBuilder.ts +454 -0
- package/src/components/builders/RectangleBuilder.ts +74 -0
- package/src/components/builders/types.ts +15 -0
- package/src/components/lib.ts +31 -0
- package/src/components/localization.ts +24 -0
- package/src/components/util/StrokeSmoother.ts +302 -0
- package/src/components/util/describeComponentList.ts +18 -0
- package/src/lib.ts +69 -0
- package/src/localization.ts +34 -0
- package/src/localizations/de.ts +146 -0
- package/src/localizations/en.ts +8 -0
- package/src/localizations/es.ts +74 -0
- package/src/localizations/getLocalizationTable.test.ts +27 -0
- package/src/localizations/getLocalizationTable.ts +74 -0
- package/src/math/Mat33.test.ts +244 -0
- package/src/math/Mat33.ts +442 -0
- package/src/math/Vec2.test.ts +30 -0
- package/src/math/Vec2.ts +40 -0
- package/src/math/Vec3.test.ts +44 -0
- package/src/math/Vec3.ts +218 -0
- package/src/math/lib.ts +15 -0
- package/src/math/polynomial/solveQuadratic.test.ts +39 -0
- package/src/math/polynomial/solveQuadratic.ts +43 -0
- package/src/math/rounding.test.ts +65 -0
- package/src/math/rounding.ts +156 -0
- package/src/math/shapes/Abstract2DShape.ts +63 -0
- package/src/math/shapes/BezierJSWrapper.ts +93 -0
- package/src/math/shapes/CubicBezier.ts +35 -0
- package/src/math/shapes/LineSegment2.test.ts +99 -0
- package/src/math/shapes/LineSegment2.ts +231 -0
- package/src/math/shapes/Path.fromString.test.ts +223 -0
- package/src/math/shapes/Path.test.ts +309 -0
- package/src/math/shapes/Path.toString.test.ts +77 -0
- package/src/math/shapes/Path.ts +1027 -0
- package/src/math/shapes/PointShape2D.ts +33 -0
- package/src/math/shapes/QuadraticBezier.test.ts +31 -0
- package/src/math/shapes/QuadraticBezier.ts +141 -0
- package/src/math/shapes/Rect2.test.ts +209 -0
- package/src/math/shapes/Rect2.ts +344 -0
- package/src/math/shapes/Triangle.test.ts +61 -0
- package/src/math/shapes/Triangle.ts +139 -0
- package/src/rendering/Display.ts +248 -0
- package/src/rendering/RenderingStyle.test.ts +68 -0
- package/src/rendering/RenderingStyle.ts +55 -0
- package/src/rendering/TextRenderingStyle.ts +55 -0
- package/src/rendering/caching/CacheRecord.test.ts +49 -0
- package/src/rendering/caching/CacheRecord.ts +77 -0
- package/src/rendering/caching/CacheRecordManager.ts +71 -0
- package/src/rendering/caching/RenderingCache.test.ts +44 -0
- package/src/rendering/caching/RenderingCache.ts +66 -0
- package/src/rendering/caching/RenderingCacheNode.ts +405 -0
- package/src/rendering/caching/testUtils.ts +35 -0
- package/src/rendering/caching/types.ts +34 -0
- package/src/rendering/lib.ts +8 -0
- package/src/rendering/localization.ts +20 -0
- package/src/rendering/renderers/AbstractRenderer.ts +242 -0
- package/src/rendering/renderers/CanvasRenderer.ts +305 -0
- package/src/rendering/renderers/DummyRenderer.test.ts +42 -0
- package/src/rendering/renderers/DummyRenderer.ts +145 -0
- package/src/rendering/renderers/SVGRenderer.ts +374 -0
- package/src/rendering/renderers/TextOnlyRenderer.test.ts +34 -0
- package/src/rendering/renderers/TextOnlyRenderer.ts +71 -0
- package/src/shortcuts/KeyBinding.test.ts +51 -0
- package/src/shortcuts/KeyBinding.ts +218 -0
- package/src/shortcuts/KeyboardShortcutManager.test.ts +95 -0
- package/src/shortcuts/KeyboardShortcutManager.ts +163 -0
- package/src/shortcuts/lib.ts +3 -0
- package/src/testing/createEditor.ts +11 -0
- package/src/testing/lib.ts +3 -0
- package/src/testing/sendPenEvent.ts +31 -0
- package/src/testing/sendTouchEvent.ts +78 -0
- package/src/toolbar/HTMLToolbar.ts +567 -0
- package/src/toolbar/IconProvider.ts +736 -0
- package/src/toolbar/lib.ts +4 -0
- package/src/toolbar/localization.ts +114 -0
- package/src/toolbar/makeColorInput.ts +159 -0
- package/src/toolbar/types.ts +5 -0
- package/src/toolbar/widgets/ActionButtonWidget.ts +39 -0
- package/src/toolbar/widgets/BaseToolWidget.ts +56 -0
- package/src/toolbar/widgets/BaseWidget.ts +428 -0
- package/src/toolbar/widgets/DocumentPropertiesWidget.ts +234 -0
- package/src/toolbar/widgets/EraserToolWidget.ts +85 -0
- package/src/toolbar/widgets/HandToolWidget.ts +250 -0
- package/src/toolbar/widgets/InsertImageWidget.ts +223 -0
- package/src/toolbar/widgets/OverflowWidget.ts +92 -0
- package/src/toolbar/widgets/PenToolWidget.ts +297 -0
- package/src/toolbar/widgets/SelectionToolWidget.ts +193 -0
- package/src/toolbar/widgets/TextToolWidget.ts +145 -0
- package/src/toolbar/widgets/keybindings.ts +21 -0
- package/src/toolbar/widgets/lib.ts +13 -0
- package/src/tools/BaseTool.ts +76 -0
- package/src/tools/Eraser.test.ts +103 -0
- package/src/tools/Eraser.ts +160 -0
- package/src/tools/FindTool.ts +153 -0
- package/src/tools/PanZoom.test.ts +310 -0
- package/src/tools/PanZoom.ts +502 -0
- package/src/tools/PasteHandler.ts +95 -0
- package/src/tools/Pen.test.ts +194 -0
- package/src/tools/Pen.ts +262 -0
- package/src/tools/PipetteTool.ts +55 -0
- package/src/tools/SelectionTool/SelectAllShortcutHandler.ts +29 -0
- package/src/tools/SelectionTool/Selection.ts +611 -0
- package/src/tools/SelectionTool/SelectionHandle.ts +108 -0
- package/src/tools/SelectionTool/SelectionTool.test.ts +261 -0
- package/src/tools/SelectionTool/SelectionTool.ts +496 -0
- package/src/tools/SelectionTool/TransformMode.ts +114 -0
- package/src/tools/SelectionTool/types.ts +11 -0
- package/src/tools/SoundUITool.ts +212 -0
- package/src/tools/TextTool.ts +340 -0
- package/src/tools/ToolController.ts +185 -0
- package/src/tools/ToolEnabledGroup.ts +14 -0
- package/src/tools/ToolSwitcherShortcut.ts +39 -0
- package/src/tools/ToolbarShortcutHandler.ts +39 -0
- package/src/tools/UndoRedoShortcut.test.ts +56 -0
- package/src/tools/UndoRedoShortcut.ts +24 -0
- package/src/tools/keybindings.ts +85 -0
- package/src/tools/lib.ts +22 -0
- package/src/tools/localization.ts +74 -0
- package/src/types.ts +239 -0
- package/src/util/assertions.ts +55 -0
- package/src/util/fileToBase64.ts +18 -0
- package/src/util/untilNextAnimationFrame.ts +9 -0
- package/src/util/waitForAll.ts +18 -0
- package/src/util/waitForTimeout.ts +9 -0
- package/tools/allLocales.js +4 -0
- package/tsconfig.json +2 -32
- package/.eslintrc.js +0 -60
- package/.firebaserc +0 -5
- package/CHANGELOG.md +0 -390
- package/CONTRIBUTING.md +0 -75
- package/LICENSE +0 -21
- package/README.md +0 -217
- package/__mocks__/coloris.ts +0 -8
- package/__mocks__/styleMock.js +0 -1
- package/dist/cjs/src/Color4.js +0 -264
- package/dist/cjs/src/Editor.d.ts +0 -309
- package/dist/cjs/src/Editor.js +0 -922
- package/dist/cjs/src/EditorImage.d.ts +0 -97
- package/dist/cjs/src/EditorImage.js +0 -492
- package/dist/cjs/src/EventDispatcher.d.ts +0 -30
- package/dist/cjs/src/EventDispatcher.js +0 -57
- package/dist/cjs/src/Pointer.d.ts +0 -26
- package/dist/cjs/src/Pointer.js +0 -109
- package/dist/cjs/src/SVGLoader.d.ts +0 -48
- package/dist/cjs/src/SVGLoader.js +0 -537
- package/dist/cjs/src/UndoRedoHistory.js +0 -93
- package/dist/cjs/src/Viewport.d.ts +0 -73
- package/dist/cjs/src/Viewport.js +0 -268
- package/dist/cjs/src/bundle/bundled.js +0 -24
- package/dist/cjs/src/commands/Command.js +0 -34
- package/dist/cjs/src/commands/Duplicate.js +0 -65
- package/dist/cjs/src/commands/Erase.js +0 -83
- package/dist/cjs/src/commands/SerializableCommand.js +0 -42
- package/dist/cjs/src/commands/UnresolvedCommand.js +0 -28
- package/dist/cjs/src/commands/invertCommand.js +0 -55
- package/dist/cjs/src/commands/lib.js +0 -18
- package/dist/cjs/src/commands/localization.d.ts +0 -23
- package/dist/cjs/src/commands/localization.js +0 -24
- package/dist/cjs/src/commands/uniteCommands.js +0 -122
- package/dist/cjs/src/components/AbstractComponent.d.ts +0 -85
- package/dist/cjs/src/components/AbstractComponent.js +0 -273
- package/dist/cjs/src/components/BackgroundComponent.d.ts +0 -62
- package/dist/cjs/src/components/BackgroundComponent.js +0 -316
- package/dist/cjs/src/components/ImageComponent.d.ts +0 -31
- package/dist/cjs/src/components/ImageComponent.js +0 -157
- package/dist/cjs/src/components/RestylableComponent.js +0 -88
- package/dist/cjs/src/components/SVGGlobalAttributesObject.d.ts +0 -21
- package/dist/cjs/src/components/SVGGlobalAttributesObject.js +0 -65
- package/dist/cjs/src/components/Stroke.d.ts +0 -76
- package/dist/cjs/src/components/Stroke.js +0 -238
- package/dist/cjs/src/components/TextComponent.d.ts +0 -63
- package/dist/cjs/src/components/TextComponent.js +0 -280
- package/dist/cjs/src/components/UnknownSVGObject.d.ts +0 -18
- package/dist/cjs/src/components/UnknownSVGObject.js +0 -50
- package/dist/cjs/src/components/builders/ArrowBuilder.d.ts +0 -19
- package/dist/cjs/src/components/builders/ArrowBuilder.js +0 -117
- package/dist/cjs/src/components/builders/FreehandLineBuilder.d.ts +0 -33
- package/dist/cjs/src/components/builders/FreehandLineBuilder.js +0 -173
- package/dist/cjs/src/components/builders/LineBuilder.d.ts +0 -18
- package/dist/cjs/src/components/builders/LineBuilder.js +0 -89
- package/dist/cjs/src/components/builders/PressureSensitiveFreehandLineBuilder.d.ts +0 -36
- package/dist/cjs/src/components/builders/PressureSensitiveFreehandLineBuilder.js +0 -347
- package/dist/cjs/src/components/builders/RectangleBuilder.d.ts +0 -20
- package/dist/cjs/src/components/builders/RectangleBuilder.js +0 -59
- package/dist/cjs/src/components/builders/types.d.ts +0 -12
- package/dist/cjs/src/components/lib.d.ts +0 -13
- package/dist/cjs/src/components/lib.js +0 -43
- package/dist/cjs/src/components/localization.js +0 -14
- package/dist/cjs/src/components/util/StrokeSmoother.d.ts +0 -35
- package/dist/cjs/src/components/util/StrokeSmoother.js +0 -225
- package/dist/cjs/src/components/util/describeComponentList.d.ts +0 -4
- package/dist/cjs/src/components/util/describeComponentList.js +0 -16
- package/dist/cjs/src/lib.d.ts +0 -64
- package/dist/cjs/src/lib.js +0 -93
- package/dist/cjs/src/localization.js +0 -13
- package/dist/cjs/src/localizations/de.js +0 -6
- package/dist/cjs/src/localizations/en.js +0 -6
- package/dist/cjs/src/localizations/es.js +0 -20
- package/dist/cjs/src/localizations/getLocalizationTable.d.ts +0 -3
- package/dist/cjs/src/localizations/getLocalizationTable.js +0 -50
- package/dist/cjs/src/math/LineSegment2.d.ts +0 -26
- package/dist/cjs/src/math/LineSegment2.js +0 -135
- package/dist/cjs/src/math/Mat33.d.ts +0 -118
- package/dist/cjs/src/math/Mat33.js +0 -332
- package/dist/cjs/src/math/Path.d.ts +0 -92
- package/dist/cjs/src/math/Path.js +0 -876
- package/dist/cjs/src/math/Rect2.d.ts +0 -52
- package/dist/cjs/src/math/Rect2.js +0 -235
- package/dist/cjs/src/math/Triangle.d.ts +0 -11
- package/dist/cjs/src/math/Triangle.js +0 -22
- package/dist/cjs/src/math/Vec2.js +0 -39
- package/dist/cjs/src/math/Vec3.js +0 -177
- package/dist/cjs/src/math/lib.d.ts +0 -7
- package/dist/cjs/src/math/lib.js +0 -18
- package/dist/cjs/src/math/polynomial/QuadraticBezier.d.ts +0 -28
- package/dist/cjs/src/math/polynomial/QuadraticBezier.js +0 -114
- package/dist/cjs/src/math/polynomial/solveQuadratic.d.ts +0 -6
- package/dist/cjs/src/math/polynomial/solveQuadratic.js +0 -36
- package/dist/cjs/src/math/rounding.js +0 -135
- package/dist/cjs/src/rendering/Display.js +0 -213
- package/dist/cjs/src/rendering/RenderingStyle.d.ts +0 -31
- package/dist/cjs/src/rendering/RenderingStyle.js +0 -48
- package/dist/cjs/src/rendering/TextRenderingStyle.d.ts +0 -36
- package/dist/cjs/src/rendering/TextRenderingStyle.js +0 -29
- package/dist/cjs/src/rendering/caching/CacheRecord.d.ts +0 -20
- package/dist/cjs/src/rendering/caching/CacheRecord.js +0 -61
- package/dist/cjs/src/rendering/caching/CacheRecordManager.d.ts +0 -12
- package/dist/cjs/src/rendering/caching/CacheRecordManager.js +0 -50
- package/dist/cjs/src/rendering/caching/RenderingCache.js +0 -51
- package/dist/cjs/src/rendering/caching/RenderingCacheNode.d.ts +0 -29
- package/dist/cjs/src/rendering/caching/RenderingCacheNode.js +0 -326
- package/dist/cjs/src/rendering/caching/testUtils.js +0 -27
- package/dist/cjs/src/rendering/lib.js +0 -17
- package/dist/cjs/src/rendering/localization.js +0 -12
- package/dist/cjs/src/rendering/renderers/AbstractRenderer.d.ts +0 -85
- package/dist/cjs/src/rendering/renderers/AbstractRenderer.js +0 -188
- package/dist/cjs/src/rendering/renderers/CanvasRenderer.d.ts +0 -63
- package/dist/cjs/src/rendering/renderers/CanvasRenderer.js +0 -243
- package/dist/cjs/src/rendering/renderers/DummyRenderer.d.ts +0 -35
- package/dist/cjs/src/rendering/renderers/DummyRenderer.js +0 -112
- package/dist/cjs/src/rendering/renderers/SVGRenderer.d.ts +0 -57
- package/dist/cjs/src/rendering/renderers/SVGRenderer.js +0 -320
- package/dist/cjs/src/rendering/renderers/TextOnlyRenderer.d.ts +0 -29
- package/dist/cjs/src/rendering/renderers/TextOnlyRenderer.js +0 -63
- package/dist/cjs/src/testing/beforeEachFile.js +0 -12
- package/dist/cjs/src/testing/createEditor.js +0 -14
- package/dist/cjs/src/testing/lib.js +0 -10
- package/dist/cjs/src/testing/loadExpectExtensions.d.ts +0 -2
- package/dist/cjs/src/testing/loadExpectExtensions.js +0 -28
- package/dist/cjs/src/testing/sendPenEvent.js +0 -24
- package/dist/cjs/src/testing/sendTouchEvent.js +0 -87
- package/dist/cjs/src/toolbar/HTMLToolbar.js +0 -449
- package/dist/cjs/src/toolbar/IconProvider.js +0 -660
- package/dist/cjs/src/toolbar/lib.js +0 -24
- package/dist/cjs/src/toolbar/localization.d.ts +0 -51
- package/dist/cjs/src/toolbar/localization.js +0 -53
- package/dist/cjs/src/toolbar/makeColorInput.js +0 -128
- package/dist/cjs/src/toolbar/widgets/ActionButtonWidget.js +0 -31
- package/dist/cjs/src/toolbar/widgets/BaseToolWidget.js +0 -49
- package/dist/cjs/src/toolbar/widgets/BaseWidget.js +0 -351
- package/dist/cjs/src/toolbar/widgets/DocumentPropertiesWidget.js +0 -201
- package/dist/cjs/src/toolbar/widgets/EraserToolWidget.js +0 -63
- package/dist/cjs/src/toolbar/widgets/HandToolWidget.js +0 -201
- package/dist/cjs/src/toolbar/widgets/InsertImageWidget.js +0 -176
- package/dist/cjs/src/toolbar/widgets/OverflowWidget.js +0 -77
- package/dist/cjs/src/toolbar/widgets/PenToolWidget.js +0 -226
- package/dist/cjs/src/toolbar/widgets/SelectionToolWidget.js +0 -153
- package/dist/cjs/src/toolbar/widgets/TextToolWidget.js +0 -115
- package/dist/cjs/src/toolbar/widgets/lib.js +0 -26
- package/dist/cjs/src/tools/BaseTool.js +0 -66
- package/dist/cjs/src/tools/Eraser.d.ts +0 -23
- package/dist/cjs/src/tools/Eraser.js +0 -112
- package/dist/cjs/src/tools/FindTool.d.ts +0 -21
- package/dist/cjs/src/tools/FindTool.js +0 -121
- package/dist/cjs/src/tools/PanZoom.d.ts +0 -52
- package/dist/cjs/src/tools/PanZoom.js +0 -421
- package/dist/cjs/src/tools/PasteHandler.js +0 -99
- package/dist/cjs/src/tools/Pen.d.ts +0 -43
- package/dist/cjs/src/tools/Pen.js +0 -202
- package/dist/cjs/src/tools/PipetteTool.js +0 -45
- package/dist/cjs/src/tools/SelectionTool/SelectAllShortcutHandler.d.ts +0 -8
- package/dist/cjs/src/tools/SelectionTool/SelectAllShortcutHandler.js +0 -28
- package/dist/cjs/src/tools/SelectionTool/Selection.d.ts +0 -64
- package/dist/cjs/src/tools/SelectionTool/Selection.js +0 -491
- package/dist/cjs/src/tools/SelectionTool/SelectionHandle.js +0 -85
- package/dist/cjs/src/tools/SelectionTool/SelectionTool.d.ts +0 -37
- package/dist/cjs/src/tools/SelectionTool/SelectionTool.js +0 -413
- package/dist/cjs/src/tools/SelectionTool/TransformMode.js +0 -107
- package/dist/cjs/src/tools/SelectionTool/types.js +0 -14
- package/dist/cjs/src/tools/SoundUITool.js +0 -164
- package/dist/cjs/src/tools/TextTool.d.ts +0 -33
- package/dist/cjs/src/tools/TextTool.js +0 -262
- package/dist/cjs/src/tools/ToolController.js +0 -192
- package/dist/cjs/src/tools/ToolEnabledGroup.js +0 -14
- package/dist/cjs/src/tools/ToolSwitcherShortcut.js +0 -38
- package/dist/cjs/src/tools/ToolbarShortcutHandler.js +0 -29
- package/dist/cjs/src/tools/UndoRedoShortcut.d.ts +0 -8
- package/dist/cjs/src/tools/UndoRedoShortcut.js +0 -28
- package/dist/cjs/src/tools/lib.js +0 -38
- package/dist/cjs/src/tools/localization.js +0 -33
- package/dist/cjs/src/types.d.ts +0 -153
- package/dist/cjs/src/types.js +0 -38
- package/dist/cjs/src/util/assertions.js +0 -51
- package/dist/cjs/src/util/fileToBase64.js +0 -15
- package/dist/cjs/src/util/untilNextAnimationFrame.js +0 -9
- package/dist/cjs/src/util/waitForAll.js +0 -17
- package/dist/cjs/src/util/waitForTimeout.js +0 -9
- package/dist/mjs/src/Color4.mjs +0 -258
- package/dist/mjs/src/Editor.d.ts +0 -309
- package/dist/mjs/src/Editor.mjs +0 -892
- package/dist/mjs/src/EditorImage.d.ts +0 -97
- package/dist/mjs/src/EditorImage.mjs +0 -485
- package/dist/mjs/src/EventDispatcher.d.ts +0 -30
- package/dist/mjs/src/EventDispatcher.mjs +0 -54
- package/dist/mjs/src/Pointer.d.ts +0 -26
- package/dist/mjs/src/Pointer.mjs +0 -105
- package/dist/mjs/src/SVGLoader.d.ts +0 -48
- package/dist/mjs/src/SVGLoader.mjs +0 -507
- package/dist/mjs/src/UndoRedoHistory.mjs +0 -91
- package/dist/mjs/src/Viewport.d.ts +0 -73
- package/dist/mjs/src/Viewport.mjs +0 -261
- package/dist/mjs/src/commands/Command.mjs +0 -31
- package/dist/mjs/src/commands/Duplicate.mjs +0 -59
- package/dist/mjs/src/commands/Erase.mjs +0 -77
- package/dist/mjs/src/commands/SerializableCommand.mjs +0 -37
- package/dist/mjs/src/commands/UnresolvedCommand.mjs +0 -22
- package/dist/mjs/src/commands/invertCommand.mjs +0 -50
- package/dist/mjs/src/commands/localization.d.ts +0 -23
- package/dist/mjs/src/commands/localization.mjs +0 -21
- package/dist/mjs/src/commands/uniteCommands.mjs +0 -117
- package/dist/mjs/src/components/AbstractComponent.d.ts +0 -85
- package/dist/mjs/src/components/AbstractComponent.mjs +0 -268
- package/dist/mjs/src/components/BackgroundComponent.d.ts +0 -62
- package/dist/mjs/src/components/BackgroundComponent.mjs +0 -286
- package/dist/mjs/src/components/ImageComponent.d.ts +0 -31
- package/dist/mjs/src/components/ImageComponent.mjs +0 -151
- package/dist/mjs/src/components/RestylableComponent.mjs +0 -80
- package/dist/mjs/src/components/SVGGlobalAttributesObject.d.ts +0 -21
- package/dist/mjs/src/components/SVGGlobalAttributesObject.mjs +0 -59
- package/dist/mjs/src/components/Stroke.d.ts +0 -76
- package/dist/mjs/src/components/Stroke.mjs +0 -232
- package/dist/mjs/src/components/TextComponent.d.ts +0 -63
- package/dist/mjs/src/components/TextComponent.mjs +0 -275
- package/dist/mjs/src/components/UnknownSVGObject.d.ts +0 -18
- package/dist/mjs/src/components/UnknownSVGObject.mjs +0 -44
- package/dist/mjs/src/components/builders/ArrowBuilder.d.ts +0 -19
- package/dist/mjs/src/components/builders/ArrowBuilder.mjs +0 -86
- package/dist/mjs/src/components/builders/FreehandLineBuilder.d.ts +0 -33
- package/dist/mjs/src/components/builders/FreehandLineBuilder.mjs +0 -165
- package/dist/mjs/src/components/builders/LineBuilder.d.ts +0 -18
- package/dist/mjs/src/components/builders/LineBuilder.mjs +0 -58
- package/dist/mjs/src/components/builders/PressureSensitiveFreehandLineBuilder.d.ts +0 -36
- package/dist/mjs/src/components/builders/PressureSensitiveFreehandLineBuilder.mjs +0 -339
- package/dist/mjs/src/components/builders/RectangleBuilder.d.ts +0 -20
- package/dist/mjs/src/components/builders/RectangleBuilder.mjs +0 -50
- package/dist/mjs/src/components/builders/types.d.ts +0 -12
- package/dist/mjs/src/components/lib.d.ts +0 -13
- package/dist/mjs/src/components/lib.mjs +0 -14
- package/dist/mjs/src/components/localization.mjs +0 -11
- package/dist/mjs/src/components/util/StrokeSmoother.d.ts +0 -35
- package/dist/mjs/src/components/util/StrokeSmoother.mjs +0 -218
- package/dist/mjs/src/components/util/describeComponentList.d.ts +0 -4
- package/dist/mjs/src/components/util/describeComponentList.mjs +0 -14
- package/dist/mjs/src/lib.d.ts +0 -64
- package/dist/mjs/src/lib.mjs +0 -64
- package/dist/mjs/src/localization.mjs +0 -10
- package/dist/mjs/src/localizations/de.mjs +0 -4
- package/dist/mjs/src/localizations/en.mjs +0 -4
- package/dist/mjs/src/localizations/es.mjs +0 -18
- package/dist/mjs/src/localizations/getLocalizationTable.d.ts +0 -3
- package/dist/mjs/src/localizations/getLocalizationTable.mjs +0 -45
- package/dist/mjs/src/math/LineSegment2.d.ts +0 -26
- package/dist/mjs/src/math/LineSegment2.mjs +0 -129
- package/dist/mjs/src/math/Mat33.d.ts +0 -118
- package/dist/mjs/src/math/Mat33.mjs +0 -327
- package/dist/mjs/src/math/Path.d.ts +0 -92
- package/dist/mjs/src/math/Path.mjs +0 -870
- package/dist/mjs/src/math/Rect2.d.ts +0 -52
- package/dist/mjs/src/math/Rect2.mjs +0 -230
- package/dist/mjs/src/math/Triangle.d.ts +0 -11
- package/dist/mjs/src/math/Triangle.mjs +0 -19
- package/dist/mjs/src/math/Vec2.mjs +0 -33
- package/dist/mjs/src/math/Vec3.mjs +0 -175
- package/dist/mjs/src/math/lib.d.ts +0 -7
- package/dist/mjs/src/math/lib.mjs +0 -7
- package/dist/mjs/src/math/polynomial/QuadraticBezier.d.ts +0 -28
- package/dist/mjs/src/math/polynomial/QuadraticBezier.mjs +0 -108
- package/dist/mjs/src/math/polynomial/solveQuadratic.d.ts +0 -6
- package/dist/mjs/src/math/polynomial/solveQuadratic.mjs +0 -34
- package/dist/mjs/src/math/rounding.mjs +0 -128
- package/dist/mjs/src/rendering/Display.mjs +0 -206
- package/dist/mjs/src/rendering/RenderingStyle.d.ts +0 -31
- package/dist/mjs/src/rendering/RenderingStyle.mjs +0 -38
- package/dist/mjs/src/rendering/TextRenderingStyle.d.ts +0 -36
- package/dist/mjs/src/rendering/TextRenderingStyle.mjs +0 -23
- package/dist/mjs/src/rendering/caching/CacheRecord.d.ts +0 -20
- package/dist/mjs/src/rendering/caching/CacheRecord.mjs +0 -55
- package/dist/mjs/src/rendering/caching/CacheRecordManager.d.ts +0 -12
- package/dist/mjs/src/rendering/caching/CacheRecordManager.mjs +0 -43
- package/dist/mjs/src/rendering/caching/RenderingCache.mjs +0 -45
- package/dist/mjs/src/rendering/caching/RenderingCacheNode.d.ts +0 -29
- package/dist/mjs/src/rendering/caching/RenderingCacheNode.mjs +0 -320
- package/dist/mjs/src/rendering/caching/testUtils.mjs +0 -20
- package/dist/mjs/src/rendering/localization.mjs +0 -9
- package/dist/mjs/src/rendering/renderers/AbstractRenderer.d.ts +0 -85
- package/dist/mjs/src/rendering/renderers/AbstractRenderer.mjs +0 -162
- package/dist/mjs/src/rendering/renderers/CanvasRenderer.d.ts +0 -63
- package/dist/mjs/src/rendering/renderers/CanvasRenderer.mjs +0 -237
- package/dist/mjs/src/rendering/renderers/DummyRenderer.d.ts +0 -35
- package/dist/mjs/src/rendering/renderers/DummyRenderer.mjs +0 -106
- package/dist/mjs/src/rendering/renderers/SVGRenderer.d.ts +0 -57
- package/dist/mjs/src/rendering/renderers/SVGRenderer.mjs +0 -313
- package/dist/mjs/src/rendering/renderers/TextOnlyRenderer.d.ts +0 -29
- package/dist/mjs/src/rendering/renderers/TextOnlyRenderer.mjs +0 -57
- package/dist/mjs/src/testing/beforeEachFile.mjs +0 -7
- package/dist/mjs/src/testing/createEditor.mjs +0 -9
- package/dist/mjs/src/testing/loadExpectExtensions.d.ts +0 -2
- package/dist/mjs/src/testing/loadExpectExtensions.mjs +0 -24
- package/dist/mjs/src/testing/sendPenEvent.mjs +0 -19
- package/dist/mjs/src/testing/sendTouchEvent.mjs +0 -62
- package/dist/mjs/src/toolbar/HTMLToolbar.mjs +0 -443
- package/dist/mjs/src/toolbar/IconProvider.mjs +0 -654
- package/dist/mjs/src/toolbar/localization.d.ts +0 -51
- package/dist/mjs/src/toolbar/localization.mjs +0 -50
- package/dist/mjs/src/toolbar/makeColorInput.mjs +0 -121
- package/dist/mjs/src/toolbar/widgets/ActionButtonWidget.mjs +0 -25
- package/dist/mjs/src/toolbar/widgets/BaseToolWidget.mjs +0 -43
- package/dist/mjs/src/toolbar/widgets/BaseWidget.mjs +0 -345
- package/dist/mjs/src/toolbar/widgets/DocumentPropertiesWidget.mjs +0 -173
- package/dist/mjs/src/toolbar/widgets/EraserToolWidget.mjs +0 -58
- package/dist/mjs/src/toolbar/widgets/HandToolWidget.mjs +0 -172
- package/dist/mjs/src/toolbar/widgets/InsertImageWidget.mjs +0 -171
- package/dist/mjs/src/toolbar/widgets/OverflowWidget.mjs +0 -71
- package/dist/mjs/src/toolbar/widgets/PenToolWidget.mjs +0 -221
- package/dist/mjs/src/toolbar/widgets/SelectionToolWidget.mjs +0 -147
- package/dist/mjs/src/toolbar/widgets/TextToolWidget.mjs +0 -110
- package/dist/mjs/src/tools/BaseTool.mjs +0 -63
- package/dist/mjs/src/tools/Eraser.d.ts +0 -23
- package/dist/mjs/src/tools/Eraser.mjs +0 -106
- package/dist/mjs/src/tools/FindTool.d.ts +0 -21
- package/dist/mjs/src/tools/FindTool.mjs +0 -114
- package/dist/mjs/src/tools/PanZoom.d.ts +0 -52
- package/dist/mjs/src/tools/PanZoom.mjs +0 -414
- package/dist/mjs/src/tools/PasteHandler.mjs +0 -93
- package/dist/mjs/src/tools/Pen.d.ts +0 -43
- package/dist/mjs/src/tools/Pen.mjs +0 -196
- package/dist/mjs/src/tools/PipetteTool.mjs +0 -39
- package/dist/mjs/src/tools/SelectionTool/SelectAllShortcutHandler.d.ts +0 -8
- package/dist/mjs/src/tools/SelectionTool/SelectAllShortcutHandler.mjs +0 -22
- package/dist/mjs/src/tools/SelectionTool/Selection.d.ts +0 -64
- package/dist/mjs/src/tools/SelectionTool/Selection.mjs +0 -463
- package/dist/mjs/src/tools/SelectionTool/SelectionHandle.mjs +0 -81
- package/dist/mjs/src/tools/SelectionTool/SelectionTool.d.ts +0 -37
- package/dist/mjs/src/tools/SelectionTool/SelectionTool.mjs +0 -407
- package/dist/mjs/src/tools/SelectionTool/TransformMode.mjs +0 -98
- package/dist/mjs/src/tools/SoundUITool.mjs +0 -158
- package/dist/mjs/src/tools/TextTool.d.ts +0 -33
- package/dist/mjs/src/tools/TextTool.mjs +0 -256
- package/dist/mjs/src/tools/ToolController.mjs +0 -163
- package/dist/mjs/src/tools/ToolEnabledGroup.mjs +0 -11
- package/dist/mjs/src/tools/ToolSwitcherShortcut.mjs +0 -32
- package/dist/mjs/src/tools/ToolbarShortcutHandler.mjs +0 -23
- package/dist/mjs/src/tools/UndoRedoShortcut.d.ts +0 -8
- package/dist/mjs/src/tools/UndoRedoShortcut.mjs +0 -22
- package/dist/mjs/src/tools/localization.mjs +0 -30
- package/dist/mjs/src/types.d.ts +0 -153
- package/dist/mjs/src/util/assertions.mjs +0 -45
- package/dist/mjs/src/util/fileToBase64.mjs +0 -13
- package/dist/mjs/src/util/untilNextAnimationFrame.mjs +0 -7
- package/dist/mjs/src/util/waitForAll.mjs +0 -15
- package/dist/mjs/src/util/waitForTimeout.mjs +0 -7
- package/firebase.json +0 -16
- package/jest.config.js +0 -29
- package/lint-staged.config.js +0 -6
- package/tsconfig-typedoc.json +0 -7
- package/tsconfig.mjs.json +0 -9
- package/typedoc.json +0 -25
- /package/dist/cjs/{src/Color4.d.ts → Color4.d.ts} +0 -0
- /package/dist/cjs/{src/testing/beforeEachFile.d.ts → Color4.test.d.ts} +0 -0
- /package/dist/{mjs/src/components/builders/types.mjs → cjs/Editor.loadFrom.test.d.ts} +0 -0
- /package/dist/{mjs/src/rendering/caching/types.mjs → cjs/Editor.toSVG.test.d.ts} +0 -0
- /package/dist/{mjs/src/testing/beforeEachFile.d.ts → cjs/EditorImage.test.d.ts} +0 -0
- /package/dist/{mjs/src/toolbar/types.mjs → cjs/EventDispatcher.test.d.ts} +0 -0
- /package/dist/cjs/{src/UndoRedoHistory.d.ts → UndoRedoHistory.d.ts} +0 -0
- /package/dist/cjs/{src/bundle → bundle}/bundled.d.ts +0 -0
- /package/dist/cjs/{src/commands → commands}/Command.d.ts +0 -0
- /package/dist/cjs/{src/commands → commands}/Duplicate.d.ts +0 -0
- /package/dist/cjs/{src/commands → commands}/Erase.d.ts +0 -0
- /package/dist/cjs/{src/commands → commands}/SerializableCommand.d.ts +0 -0
- /package/dist/cjs/{src/commands → commands}/UnresolvedCommand.d.ts +0 -0
- /package/dist/cjs/{src/commands → commands}/invertCommand.d.ts +0 -0
- /package/dist/cjs/{src/commands → commands}/lib.d.ts +0 -0
- /package/dist/cjs/{src/commands → commands}/uniteCommands.d.ts +0 -0
- /package/dist/cjs/{src/components → components}/RestylableComponent.d.ts +0 -0
- /package/dist/cjs/{src/components → components}/builders/types.js +0 -0
- /package/dist/cjs/{src/components → components}/localization.d.ts +0 -0
- /package/dist/cjs/{src/localization.d.ts → localization.d.ts} +0 -0
- /package/dist/cjs/{src/localizations → localizations}/de.d.ts +0 -0
- /package/dist/cjs/{src/localizations → localizations}/en.d.ts +0 -0
- /package/dist/cjs/{src/localizations → localizations}/es.d.ts +0 -0
- /package/dist/cjs/{src/math → math}/Vec2.d.ts +0 -0
- /package/dist/cjs/{src/math → math}/Vec3.d.ts +0 -0
- /package/dist/cjs/{src/math → math}/rounding.d.ts +0 -0
- /package/dist/cjs/{src/rendering → rendering}/Display.d.ts +0 -0
- /package/dist/cjs/{src/rendering → rendering}/caching/RenderingCache.d.ts +0 -0
- /package/dist/cjs/{src/rendering → rendering}/caching/testUtils.d.ts +0 -0
- /package/dist/cjs/{src/rendering → rendering}/caching/types.d.ts +0 -0
- /package/dist/cjs/{src/rendering → rendering}/caching/types.js +0 -0
- /package/dist/cjs/{src/rendering → rendering}/lib.d.ts +0 -0
- /package/dist/cjs/{src/rendering → rendering}/localization.d.ts +0 -0
- /package/dist/cjs/{src/testing → testing}/createEditor.d.ts +0 -0
- /package/dist/cjs/{src/testing → testing}/lib.d.ts +0 -0
- /package/dist/cjs/{src/testing → testing}/sendPenEvent.d.ts +0 -0
- /package/dist/cjs/{src/testing → testing}/sendTouchEvent.d.ts +0 -0
- /package/dist/cjs/{src/toolbar → toolbar}/HTMLToolbar.d.ts +0 -0
- /package/dist/cjs/{src/toolbar → toolbar}/IconProvider.d.ts +0 -0
- /package/dist/cjs/{src/toolbar → toolbar}/lib.d.ts +0 -0
- /package/dist/cjs/{src/toolbar → toolbar}/makeColorInput.d.ts +0 -0
- /package/dist/cjs/{src/toolbar → toolbar}/types.d.ts +0 -0
- /package/dist/cjs/{src/toolbar → toolbar}/types.js +0 -0
- /package/dist/cjs/{src/toolbar → toolbar}/widgets/ActionButtonWidget.d.ts +0 -0
- /package/dist/cjs/{src/toolbar → toolbar}/widgets/BaseToolWidget.d.ts +0 -0
- /package/dist/cjs/{src/toolbar → toolbar}/widgets/BaseWidget.d.ts +0 -0
- /package/dist/cjs/{src/toolbar → toolbar}/widgets/DocumentPropertiesWidget.d.ts +0 -0
- /package/dist/cjs/{src/toolbar → toolbar}/widgets/EraserToolWidget.d.ts +0 -0
- /package/dist/cjs/{src/toolbar → toolbar}/widgets/HandToolWidget.d.ts +0 -0
- /package/dist/cjs/{src/toolbar → toolbar}/widgets/InsertImageWidget.d.ts +0 -0
- /package/dist/cjs/{src/toolbar → toolbar}/widgets/OverflowWidget.d.ts +0 -0
- /package/dist/cjs/{src/toolbar → toolbar}/widgets/PenToolWidget.d.ts +0 -0
- /package/dist/cjs/{src/toolbar → toolbar}/widgets/SelectionToolWidget.d.ts +0 -0
- /package/dist/cjs/{src/toolbar → toolbar}/widgets/TextToolWidget.d.ts +0 -0
- /package/dist/cjs/{src/toolbar → toolbar}/widgets/lib.d.ts +0 -0
- /package/dist/cjs/{src/tools → tools}/BaseTool.d.ts +0 -0
- /package/dist/cjs/{src/tools → tools}/PasteHandler.d.ts +0 -0
- /package/dist/cjs/{src/tools → tools}/PipetteTool.d.ts +0 -0
- /package/dist/cjs/{src/tools → tools}/SelectionTool/SelectionHandle.d.ts +0 -0
- /package/dist/cjs/{src/tools → tools}/SelectionTool/TransformMode.d.ts +0 -0
- /package/dist/cjs/{src/tools → tools}/SelectionTool/types.d.ts +0 -0
- /package/dist/cjs/{src/tools → tools}/SoundUITool.d.ts +0 -0
- /package/dist/cjs/{src/tools → tools}/ToolController.d.ts +0 -0
- /package/dist/cjs/{src/tools → tools}/ToolEnabledGroup.d.ts +0 -0
- /package/dist/cjs/{src/tools → tools}/ToolSwitcherShortcut.d.ts +0 -0
- /package/dist/cjs/{src/tools → tools}/ToolbarShortcutHandler.d.ts +0 -0
- /package/dist/cjs/{src/tools → tools}/lib.d.ts +0 -0
- /package/dist/cjs/{src/tools → tools}/localization.d.ts +0 -0
- /package/dist/cjs/{src/util → util}/assertions.d.ts +0 -0
- /package/dist/cjs/{src/util → util}/fileToBase64.d.ts +0 -0
- /package/dist/cjs/{src/util → util}/untilNextAnimationFrame.d.ts +0 -0
- /package/dist/cjs/{src/util → util}/waitForAll.d.ts +0 -0
- /package/dist/cjs/{src/util → util}/waitForTimeout.d.ts +0 -0
- /package/dist/mjs/{src/Color4.d.ts → Color4.d.ts} +0 -0
- /package/dist/mjs/{src/UndoRedoHistory.d.ts → UndoRedoHistory.d.ts} +0 -0
- /package/dist/mjs/{src/bundle → bundle}/bundled.d.ts +0 -0
- /package/dist/mjs/{src/bundle → bundle}/bundled.mjs +0 -0
- /package/dist/mjs/{src/commands → commands}/Command.d.ts +0 -0
- /package/dist/mjs/{src/commands → commands}/Duplicate.d.ts +0 -0
- /package/dist/mjs/{src/commands → commands}/Erase.d.ts +0 -0
- /package/dist/mjs/{src/commands → commands}/SerializableCommand.d.ts +0 -0
- /package/dist/mjs/{src/commands → commands}/UnresolvedCommand.d.ts +0 -0
- /package/dist/mjs/{src/commands → commands}/invertCommand.d.ts +0 -0
- /package/dist/mjs/{src/commands → commands}/lib.d.ts +0 -0
- /package/dist/mjs/{src/commands → commands}/lib.mjs +0 -0
- /package/dist/mjs/{src/commands → commands}/uniteCommands.d.ts +0 -0
- /package/dist/mjs/{src/components → components}/RestylableComponent.d.ts +0 -0
- /package/dist/mjs/{src/components → components}/localization.d.ts +0 -0
- /package/dist/mjs/{src/localization.d.ts → localization.d.ts} +0 -0
- /package/dist/mjs/{src/localizations → localizations}/de.d.ts +0 -0
- /package/dist/mjs/{src/localizations → localizations}/en.d.ts +0 -0
- /package/dist/mjs/{src/localizations → localizations}/es.d.ts +0 -0
- /package/dist/mjs/{src/math → math}/Vec2.d.ts +0 -0
- /package/dist/mjs/{src/math → math}/Vec3.d.ts +0 -0
- /package/dist/mjs/{src/math → math}/rounding.d.ts +0 -0
- /package/dist/mjs/{src/rendering → rendering}/Display.d.ts +0 -0
- /package/dist/mjs/{src/rendering → rendering}/caching/RenderingCache.d.ts +0 -0
- /package/dist/mjs/{src/rendering → rendering}/caching/testUtils.d.ts +0 -0
- /package/dist/mjs/{src/rendering → rendering}/caching/types.d.ts +0 -0
- /package/dist/mjs/{src/rendering → rendering}/lib.d.ts +0 -0
- /package/dist/mjs/{src/rendering → rendering}/lib.mjs +0 -0
- /package/dist/mjs/{src/rendering → rendering}/localization.d.ts +0 -0
- /package/dist/mjs/{src/testing → testing}/createEditor.d.ts +0 -0
- /package/dist/mjs/{src/testing → testing}/lib.d.ts +0 -0
- /package/dist/mjs/{src/testing → testing}/lib.mjs +0 -0
- /package/dist/mjs/{src/testing → testing}/sendPenEvent.d.ts +0 -0
- /package/dist/mjs/{src/testing → testing}/sendTouchEvent.d.ts +0 -0
- /package/dist/mjs/{src/toolbar → toolbar}/HTMLToolbar.d.ts +0 -0
- /package/dist/mjs/{src/toolbar → toolbar}/IconProvider.d.ts +0 -0
- /package/dist/mjs/{src/toolbar → toolbar}/lib.d.ts +0 -0
- /package/dist/mjs/{src/toolbar → toolbar}/lib.mjs +0 -0
- /package/dist/mjs/{src/toolbar → toolbar}/makeColorInput.d.ts +0 -0
- /package/dist/mjs/{src/toolbar → toolbar}/types.d.ts +0 -0
- /package/dist/mjs/{src/toolbar → toolbar}/widgets/ActionButtonWidget.d.ts +0 -0
- /package/dist/mjs/{src/toolbar → toolbar}/widgets/BaseToolWidget.d.ts +0 -0
- /package/dist/mjs/{src/toolbar → toolbar}/widgets/BaseWidget.d.ts +0 -0
- /package/dist/mjs/{src/toolbar → toolbar}/widgets/DocumentPropertiesWidget.d.ts +0 -0
- /package/dist/mjs/{src/toolbar → toolbar}/widgets/EraserToolWidget.d.ts +0 -0
- /package/dist/mjs/{src/toolbar → toolbar}/widgets/HandToolWidget.d.ts +0 -0
- /package/dist/mjs/{src/toolbar → toolbar}/widgets/InsertImageWidget.d.ts +0 -0
- /package/dist/mjs/{src/toolbar → toolbar}/widgets/OverflowWidget.d.ts +0 -0
- /package/dist/mjs/{src/toolbar → toolbar}/widgets/PenToolWidget.d.ts +0 -0
- /package/dist/mjs/{src/toolbar → toolbar}/widgets/SelectionToolWidget.d.ts +0 -0
- /package/dist/mjs/{src/toolbar → toolbar}/widgets/TextToolWidget.d.ts +0 -0
- /package/dist/mjs/{src/toolbar → toolbar}/widgets/lib.d.ts +0 -0
- /package/dist/mjs/{src/toolbar → toolbar}/widgets/lib.mjs +0 -0
- /package/dist/mjs/{src/tools → tools}/BaseTool.d.ts +0 -0
- /package/dist/mjs/{src/tools → tools}/PasteHandler.d.ts +0 -0
- /package/dist/mjs/{src/tools → tools}/PipetteTool.d.ts +0 -0
- /package/dist/mjs/{src/tools → tools}/SelectionTool/SelectionHandle.d.ts +0 -0
- /package/dist/mjs/{src/tools → tools}/SelectionTool/TransformMode.d.ts +0 -0
- /package/dist/mjs/{src/tools → tools}/SelectionTool/types.d.ts +0 -0
- /package/dist/mjs/{src/tools → tools}/SelectionTool/types.mjs +0 -0
- /package/dist/mjs/{src/tools → tools}/SoundUITool.d.ts +0 -0
- /package/dist/mjs/{src/tools → tools}/ToolController.d.ts +0 -0
- /package/dist/mjs/{src/tools → tools}/ToolEnabledGroup.d.ts +0 -0
- /package/dist/mjs/{src/tools → tools}/ToolSwitcherShortcut.d.ts +0 -0
- /package/dist/mjs/{src/tools → tools}/ToolbarShortcutHandler.d.ts +0 -0
- /package/dist/mjs/{src/tools → tools}/lib.d.ts +0 -0
- /package/dist/mjs/{src/tools → tools}/lib.mjs +0 -0
- /package/dist/mjs/{src/tools → tools}/localization.d.ts +0 -0
- /package/dist/mjs/{src/types.mjs → types.mjs} +0 -0
- /package/dist/mjs/{src/util → util}/assertions.d.ts +0 -0
- /package/dist/mjs/{src/util → util}/fileToBase64.d.ts +0 -0
- /package/dist/mjs/{src/util → util}/untilNextAnimationFrame.d.ts +0 -0
- /package/dist/mjs/{src/util → util}/waitForAll.d.ts +0 -0
- /package/dist/mjs/{src/util → util}/waitForTimeout.d.ts +0 -0
package/src/math/Vec3.ts
ADDED
@@ -0,0 +1,218 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
/**
|
4
|
+
* A vector with three components. Can also be used to represent a two-component vector.
|
5
|
+
*
|
6
|
+
* A `Vec3` is immutable.
|
7
|
+
*/
|
8
|
+
export default class Vec3 {
|
9
|
+
private constructor(
|
10
|
+
public readonly x: number,
|
11
|
+
public readonly y: number,
|
12
|
+
public readonly z: number
|
13
|
+
) {
|
14
|
+
}
|
15
|
+
|
16
|
+
/** Returns the x, y components of this. */
|
17
|
+
public get xy(): { x: number; y: number } {
|
18
|
+
// Useful for APIs that behave differently if .z is present.
|
19
|
+
return {
|
20
|
+
x: this.x,
|
21
|
+
y: this.y,
|
22
|
+
};
|
23
|
+
}
|
24
|
+
|
25
|
+
public static of(x: number, y: number, z: number): Vec3 {
|
26
|
+
return new Vec3(x, y, z);
|
27
|
+
}
|
28
|
+
|
29
|
+
/** Returns this' `idx`th component. For example, `Vec3.of(1, 2, 3).at(1) → 2`. */
|
30
|
+
public at(idx: number): number {
|
31
|
+
if (idx === 0) return this.x;
|
32
|
+
if (idx === 1) return this.y;
|
33
|
+
if (idx === 2) return this.z;
|
34
|
+
|
35
|
+
throw new Error(`${idx} out of bounds!`);
|
36
|
+
}
|
37
|
+
|
38
|
+
/** Alias for this.magnitude. */
|
39
|
+
public length(): number {
|
40
|
+
return this.magnitude();
|
41
|
+
}
|
42
|
+
|
43
|
+
public magnitude(): number {
|
44
|
+
return Math.sqrt(this.dot(this));
|
45
|
+
}
|
46
|
+
|
47
|
+
public magnitudeSquared(): number {
|
48
|
+
return this.dot(this);
|
49
|
+
}
|
50
|
+
|
51
|
+
/**
|
52
|
+
* Return this' angle in the XY plane (treats this as a Vec2).
|
53
|
+
*
|
54
|
+
* This is equivalent to `Math.atan2(vec.y, vec.x)`.
|
55
|
+
*/
|
56
|
+
public angle(): number {
|
57
|
+
return Math.atan2(this.y, this.x);
|
58
|
+
}
|
59
|
+
|
60
|
+
/**
|
61
|
+
* Returns a unit vector in the same direction as this.
|
62
|
+
*
|
63
|
+
* If `this` has zero length, the resultant vector has `NaN` components.
|
64
|
+
*/
|
65
|
+
public normalized(): Vec3 {
|
66
|
+
const norm = this.magnitude();
|
67
|
+
return Vec3.of(this.x / norm, this.y / norm, this.z / norm);
|
68
|
+
}
|
69
|
+
|
70
|
+
/** @returns A copy of `this` multiplied by a scalar. */
|
71
|
+
public times(c: number): Vec3 {
|
72
|
+
return Vec3.of(this.x * c, this.y * c, this.z * c);
|
73
|
+
}
|
74
|
+
|
75
|
+
public plus(v: Vec3): Vec3 {
|
76
|
+
return Vec3.of(this.x + v.x, this.y + v.y, this.z + v.z);
|
77
|
+
}
|
78
|
+
|
79
|
+
public minus(v: Vec3): Vec3 {
|
80
|
+
return Vec3.of(this.x - v.x, this.y - v.y, this.z - v.z);
|
81
|
+
}
|
82
|
+
|
83
|
+
public dot(other: Vec3): number {
|
84
|
+
return this.x * other.x + this.y * other.y + this.z * other.z;
|
85
|
+
}
|
86
|
+
|
87
|
+
public cross(other: Vec3): Vec3 {
|
88
|
+
// | i j k |
|
89
|
+
// | x1 y1 z1| = (i)(y1z2 - y2z1) - (j)(x1z2 - x2z1) + (k)(x1y2 - x2y1)
|
90
|
+
// | x2 y2 z2|
|
91
|
+
return Vec3.of(
|
92
|
+
this.y * other.z - other.y * this.z,
|
93
|
+
other.x * this.z - this.x * other.z,
|
94
|
+
this.x * other.y - other.x * this.y
|
95
|
+
);
|
96
|
+
}
|
97
|
+
|
98
|
+
/**
|
99
|
+
* If `other` is a `Vec3`, multiplies `this` component-wise by `other`. Otherwise,
|
100
|
+
* if `other is a `number`, returns the result of scalar multiplication.
|
101
|
+
*
|
102
|
+
* @example
|
103
|
+
* ```
|
104
|
+
* Vec3.of(1, 2, 3).scale(Vec3.of(2, 4, 6)); // → Vec3(2, 8, 18)
|
105
|
+
* ```
|
106
|
+
*/
|
107
|
+
public scale(other: Vec3|number): Vec3 {
|
108
|
+
if (typeof other === 'number') {
|
109
|
+
return this.times(other);
|
110
|
+
}
|
111
|
+
|
112
|
+
return Vec3.of(
|
113
|
+
this.x * other.x,
|
114
|
+
this.y * other.y,
|
115
|
+
this.z * other.z,
|
116
|
+
);
|
117
|
+
}
|
118
|
+
|
119
|
+
/**
|
120
|
+
* Returns a vector orthogonal to this. If this is a Vec2, returns `this` rotated
|
121
|
+
* 90 degrees counter-clockwise.
|
122
|
+
*/
|
123
|
+
public orthog(): Vec3 {
|
124
|
+
// If parallel to the z-axis
|
125
|
+
if (this.dot(Vec3.unitX) === 0 && this.dot(Vec3.unitY) === 0) {
|
126
|
+
return this.dot(Vec3.unitX) === 0 ? Vec3.unitX : this.cross(Vec3.unitX).normalized();
|
127
|
+
}
|
128
|
+
|
129
|
+
return this.cross(Vec3.unitZ.times(-1)).normalized();
|
130
|
+
}
|
131
|
+
|
132
|
+
/** Returns this plus a vector of length `distance` in `direction`. */
|
133
|
+
public extend(distance: number, direction: Vec3): Vec3 {
|
134
|
+
return this.plus(direction.normalized().times(distance));
|
135
|
+
}
|
136
|
+
|
137
|
+
/** Returns a vector `fractionTo` of the way to target from this. */
|
138
|
+
public lerp(target: Vec3, fractionTo: number): Vec3 {
|
139
|
+
return this.times(1 - fractionTo).plus(target.times(fractionTo));
|
140
|
+
}
|
141
|
+
|
142
|
+
/**
|
143
|
+
* `zip` Maps a component of this and a corresponding component of
|
144
|
+
* `other` to a component of the output vector.
|
145
|
+
*
|
146
|
+
* @example
|
147
|
+
* ```
|
148
|
+
* const a = Vec3.of(1, 2, 3);
|
149
|
+
* const b = Vec3.of(0.5, 2.1, 2.9);
|
150
|
+
*
|
151
|
+
* const zipped = a.zip(b, (aComponent, bComponent) => {
|
152
|
+
* return Math.min(aComponent, bComponent);
|
153
|
+
* });
|
154
|
+
*
|
155
|
+
* console.log(zipped.toString()); // → Vec(0.5, 2, 2.9)
|
156
|
+
* ```
|
157
|
+
*/
|
158
|
+
public zip(
|
159
|
+
other: Vec3, zip: (componentInThis: number, componentInOther: number)=> number
|
160
|
+
): Vec3 {
|
161
|
+
return Vec3.of(
|
162
|
+
zip(other.x, this.x),
|
163
|
+
zip(other.y, this.y),
|
164
|
+
zip(other.z, this.z)
|
165
|
+
);
|
166
|
+
}
|
167
|
+
|
168
|
+
/**
|
169
|
+
* Returns a vector with each component acted on by `fn`.
|
170
|
+
*
|
171
|
+
* @example
|
172
|
+
* ```
|
173
|
+
* console.log(Vec3.of(1, 2, 3).map(val => val + 1)); // → Vec(2, 3, 4)
|
174
|
+
* ```
|
175
|
+
*/
|
176
|
+
public map(fn: (component: number, index: number)=> number): Vec3 {
|
177
|
+
return Vec3.of(
|
178
|
+
fn(this.x, 0), fn(this.y, 1), fn(this.z, 2)
|
179
|
+
);
|
180
|
+
}
|
181
|
+
|
182
|
+
public asArray(): [ number, number, number ] {
|
183
|
+
return [this.x, this.y, this.z];
|
184
|
+
}
|
185
|
+
|
186
|
+
/**
|
187
|
+
* [fuzz] The maximum difference between two components for this and [other]
|
188
|
+
* to be considered equal.
|
189
|
+
*
|
190
|
+
* @example
|
191
|
+
* ```
|
192
|
+
* Vec3.of(1, 2, 3).eq(Vec3.of(4, 5, 6), 100); // → true
|
193
|
+
* Vec3.of(1, 2, 3).eq(Vec3.of(4, 5, 6), 0.1); // → false
|
194
|
+
* Vec3.of(1, 2, 3).eq(Vec3.of(4, 5, 6), 3); // → true
|
195
|
+
* Vec3.of(1, 2, 3).eq(Vec3.of(4, 5, 6), 3.01); // → true
|
196
|
+
* Vec3.of(1, 2, 3).eq(Vec3.of(4, 5, 6), 2.99); // → false
|
197
|
+
* ```
|
198
|
+
*/
|
199
|
+
public eq(other: Vec3, fuzz: number = 1e-10): boolean {
|
200
|
+
for (let i = 0; i < 3; i++) {
|
201
|
+
if (Math.abs(other.at(i) - this.at(i)) > fuzz) {
|
202
|
+
return false;
|
203
|
+
}
|
204
|
+
}
|
205
|
+
|
206
|
+
return true;
|
207
|
+
}
|
208
|
+
|
209
|
+
public toString(): string {
|
210
|
+
return `Vec(${this.x}, ${this.y}, ${this.z})`;
|
211
|
+
}
|
212
|
+
|
213
|
+
|
214
|
+
public static unitX = Vec3.of(1, 0, 0);
|
215
|
+
public static unitY = Vec3.of(0, 1, 0);
|
216
|
+
public static unitZ = Vec3.of(0, 0, 1);
|
217
|
+
public static zero = Vec3.of(0, 0, 0);
|
218
|
+
}
|
package/src/math/lib.ts
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
import LineSegment2 from './shapes/LineSegment2';
|
2
|
+
import Mat33 from './Mat33';
|
3
|
+
import Path from './shapes/Path';
|
4
|
+
import Rect2 from './shapes/Rect2';
|
5
|
+
import { Vec2 } from './Vec2';
|
6
|
+
import Vec3 from './Vec3';
|
7
|
+
|
8
|
+
export {
|
9
|
+
LineSegment2,
|
10
|
+
Mat33,
|
11
|
+
Path,
|
12
|
+
Rect2,
|
13
|
+
Vec3,
|
14
|
+
Vec2,
|
15
|
+
};
|
@@ -0,0 +1,39 @@
|
|
1
|
+
|
2
|
+
import solveQuadratic from './solveQuadratic';
|
3
|
+
|
4
|
+
describe('solveQuadratic', () => {
|
5
|
+
it('should solve linear equations', () => {
|
6
|
+
expect(solveQuadratic(0, 1, 2)).toMatchObject([ -2, -2 ]);
|
7
|
+
expect(solveQuadratic(0, 0, 2)[0]).toBeNaN();
|
8
|
+
});
|
9
|
+
|
10
|
+
it('should return both solutions to quadratic equations', () => {
|
11
|
+
type TestCase = [[number, number, number], [number, number]];
|
12
|
+
|
13
|
+
const testCases: TestCase[] = [
|
14
|
+
[ [ 1, 0, 0 ], [ 0, 0 ] ],
|
15
|
+
[ [ 2, 0, 0 ], [ 0, 0 ] ],
|
16
|
+
|
17
|
+
[ [ 1, 0, -1 ], [ 1, -1 ] ],
|
18
|
+
[ [ 1, 0, -4 ], [ 2, -2 ] ],
|
19
|
+
[ [ 1, 0, 4 ], [ NaN, NaN ] ],
|
20
|
+
|
21
|
+
[ [ 1, 1, 0 ], [ 0, -1 ] ],
|
22
|
+
[ [ 1, 2, 0 ], [ 0, -2 ] ],
|
23
|
+
|
24
|
+
[ [ 1, 2, 1 ], [ -1, -1 ] ],
|
25
|
+
[ [ -9, 2, 1/3 ], [ 1/3, -1/9 ] ],
|
26
|
+
];
|
27
|
+
|
28
|
+
for (const [ testCase, solution ] of testCases) {
|
29
|
+
const foundSolutions = solveQuadratic(...testCase);
|
30
|
+
for (let i = 0; i < 2; i++) {
|
31
|
+
if (isNaN(solution[i]) && isNaN(foundSolutions[i])) {
|
32
|
+
expect(foundSolutions[i]).toBeNaN();
|
33
|
+
} else {
|
34
|
+
expect(foundSolutions[i]).toBeCloseTo(solution[i]);
|
35
|
+
}
|
36
|
+
}
|
37
|
+
}
|
38
|
+
});
|
39
|
+
});
|
@@ -0,0 +1,43 @@
|
|
1
|
+
|
2
|
+
/**
|
3
|
+
* Solves an equation of the form ax² + bx + c = 0.
|
4
|
+
* The larger solution is returned first.
|
5
|
+
*
|
6
|
+
* If there are no solutions, returns `[NaN, NaN]`. If there is one solution,
|
7
|
+
* repeats the solution twice in the result.
|
8
|
+
*/
|
9
|
+
const solveQuadratic = (a: number, b: number, c: number): [number, number] => {
|
10
|
+
// See also https://en.wikipedia.org/wiki/Quadratic_formula
|
11
|
+
|
12
|
+
if (a === 0) {
|
13
|
+
let solution;
|
14
|
+
|
15
|
+
if (b === 0) {
|
16
|
+
solution = c === 0 ? 0 : NaN;
|
17
|
+
} else {
|
18
|
+
// Then we have bx + c = 0
|
19
|
+
// which implies bx = -c.
|
20
|
+
// Thus, x = -c/b
|
21
|
+
solution = -c / b;
|
22
|
+
}
|
23
|
+
|
24
|
+
return [ solution, solution ];
|
25
|
+
}
|
26
|
+
|
27
|
+
const discriminant = b * b - 4 * a * c;
|
28
|
+
|
29
|
+
if (discriminant < 0) {
|
30
|
+
return [ NaN, NaN ];
|
31
|
+
}
|
32
|
+
|
33
|
+
const rootDiscriminant = Math.sqrt(discriminant);
|
34
|
+
const solution1 = (-b + rootDiscriminant) / (2 * a);
|
35
|
+
const solution2 = (-b - rootDiscriminant) / (2 * a);
|
36
|
+
|
37
|
+
if (solution1 > solution2) {
|
38
|
+
return [ solution1, solution2 ];
|
39
|
+
} else {
|
40
|
+
return [ solution2, solution1 ];
|
41
|
+
}
|
42
|
+
};
|
43
|
+
export default solveQuadratic;
|
@@ -0,0 +1,65 @@
|
|
1
|
+
import { cleanUpNumber, toRoundedString, toStringOfSamePrecision } from './rounding';
|
2
|
+
|
3
|
+
describe('toRoundedString', () => {
|
4
|
+
it('should round up numbers endings similar to .999999999999999', () => {
|
5
|
+
expect(toRoundedString(0.999999999)).toBe('1');
|
6
|
+
expect(toRoundedString(0.899999999)).toBe('.9');
|
7
|
+
expect(toRoundedString(9.999999999)).toBe('10');
|
8
|
+
expect(toRoundedString(-10.999999999)).toBe('-11');
|
9
|
+
});
|
10
|
+
|
11
|
+
it('should round up numbers similar to 10.999999998', () => {
|
12
|
+
expect(toRoundedString(10.999999998)).toBe('11');
|
13
|
+
});
|
14
|
+
|
15
|
+
it('should round strings with multiple digits after the ending decimal points', () => {
|
16
|
+
expect(toRoundedString(292.2 - 292.8)).toBe('-.6');
|
17
|
+
expect(toRoundedString(4.06425600000023)).toBe('4.064256');
|
18
|
+
});
|
19
|
+
|
20
|
+
it('should round down strings ending endings similar to .00000001', () => {
|
21
|
+
expect(toRoundedString(10.00000001)).toBe('10');
|
22
|
+
expect(toRoundedString(-30.00000001)).toBe('-30');
|
23
|
+
expect(toRoundedString(-14.20000000000002)).toBe('-14.2');
|
24
|
+
});
|
25
|
+
|
26
|
+
it('should not round numbers insufficiently close to the next', () => {
|
27
|
+
expect(toRoundedString(-10.9999)).toBe('-10.9999');
|
28
|
+
expect(toRoundedString(-10.0001)).toBe('-10.0001');
|
29
|
+
expect(toRoundedString(-10.123499)).toBe('-10.123499');
|
30
|
+
expect(toRoundedString(0.00123499)).toBe('.00123499');
|
31
|
+
});
|
32
|
+
});
|
33
|
+
|
34
|
+
it('toStringOfSamePrecision', () => {
|
35
|
+
expect(toStringOfSamePrecision(1.23456, '1.12')).toBe('1.23');
|
36
|
+
expect(toStringOfSamePrecision(1.23456, '1.120')).toBe('1.235');
|
37
|
+
expect(toStringOfSamePrecision(1.23456, '1.1')).toBe('1.2');
|
38
|
+
expect(toStringOfSamePrecision(1.23456, '1.1', '5.32')).toBe('1.23');
|
39
|
+
expect(toStringOfSamePrecision(-1.23456, '1.1', '5.32')).toBe('-1.23');
|
40
|
+
expect(toStringOfSamePrecision(-1.99999, '1.1', '5.32')).toBe('-2');
|
41
|
+
expect(toStringOfSamePrecision(1.99999, '1.1', '5.32')).toBe('2');
|
42
|
+
expect(toStringOfSamePrecision(1.89999, '1.1', '5.32')).toBe('1.9');
|
43
|
+
expect(toStringOfSamePrecision(9.99999999, '-1.1234')).toBe('10');
|
44
|
+
expect(toStringOfSamePrecision(9.999999998999996, '100')).toBe('10');
|
45
|
+
expect(toStringOfSamePrecision(0.000012345, '0.000012')).toBe('.000012');
|
46
|
+
expect(toStringOfSamePrecision(0.000012645, '.000012')).toBe('.000013');
|
47
|
+
expect(toStringOfSamePrecision(-0.09999999999999432, '291.3')).toBe('-.1');
|
48
|
+
expect(toStringOfSamePrecision(-0.9999999999999432, '291.3')).toBe('-1');
|
49
|
+
expect(toStringOfSamePrecision(9998.9, '.1', '-11')).toBe('9998.9');
|
50
|
+
expect(toStringOfSamePrecision(-14.20000000000002, '.000001', '-11')).toBe('-14.2');
|
51
|
+
});
|
52
|
+
|
53
|
+
it('cleanUpNumber', () => {
|
54
|
+
expect(cleanUpNumber('000.0000')).toBe('0');
|
55
|
+
expect(cleanUpNumber('-000.0000')).toBe('0');
|
56
|
+
expect(cleanUpNumber('0.0000')).toBe('0');
|
57
|
+
expect(cleanUpNumber('0.001')).toBe('.001');
|
58
|
+
expect(cleanUpNumber('-0.001')).toBe('-.001');
|
59
|
+
expect(cleanUpNumber('-0.000000001')).toBe('-.000000001');
|
60
|
+
expect(cleanUpNumber('-0.00000000100')).toBe('-.000000001');
|
61
|
+
expect(cleanUpNumber('1234')).toBe('1234');
|
62
|
+
expect(cleanUpNumber('1234.5')).toBe('1234.5');
|
63
|
+
expect(cleanUpNumber('1234.500')).toBe('1234.5');
|
64
|
+
expect(cleanUpNumber('1.1368683772161603e-13')).toBe('0');
|
65
|
+
});
|
@@ -0,0 +1,156 @@
|
|
1
|
+
// @packageDocumentation @internal
|
2
|
+
|
3
|
+
// Clean up stringified numbers
|
4
|
+
export const cleanUpNumber = (text: string) => {
|
5
|
+
// Regular expression substitions can be somewhat expensive. Only do them
|
6
|
+
// if necessary.
|
7
|
+
|
8
|
+
if (text.indexOf('e') > 0) {
|
9
|
+
// Round to zero.
|
10
|
+
if (text.match(/[eE][-]\d{2,}$/)) {
|
11
|
+
return '0';
|
12
|
+
}
|
13
|
+
}
|
14
|
+
|
15
|
+
const lastChar = text.charAt(text.length - 1);
|
16
|
+
if (lastChar === '0' || lastChar === '.') {
|
17
|
+
// Remove trailing zeroes
|
18
|
+
text = text.replace(/([.]\d*[^0]+)0+$/, '$1');
|
19
|
+
text = text.replace(/[.]0+$/, '.');
|
20
|
+
|
21
|
+
// Remove trailing period
|
22
|
+
text = text.replace(/[.]$/, '');
|
23
|
+
}
|
24
|
+
|
25
|
+
const firstChar = text.charAt(0);
|
26
|
+
if (firstChar === '0' || firstChar === '-') {
|
27
|
+
// Remove unnecessary leading zeroes.
|
28
|
+
text = text.replace(/^(0+)[.]/, '.');
|
29
|
+
text = text.replace(/^-(0+)[.]/, '-.');
|
30
|
+
text = text.replace(/^(-?)0+$/, '$10');
|
31
|
+
}
|
32
|
+
|
33
|
+
if (text === '-0') {
|
34
|
+
return '0';
|
35
|
+
}
|
36
|
+
|
37
|
+
return text;
|
38
|
+
};
|
39
|
+
|
40
|
+
export const toRoundedString = (num: number): string => {
|
41
|
+
// Try to remove rounding errors. If the number ends in at least three/four zeroes
|
42
|
+
// (or nines) just one or two digits, it's probably a rounding error.
|
43
|
+
const fixRoundingUpExp = /^([-]?\d*\.\d{3,})0{4,}\d{1,4}$/;
|
44
|
+
const hasRoundingDownExp = /^([-]?)(\d*)\.(\d{3,}9{4,})\d{1,4}$/;
|
45
|
+
|
46
|
+
let text = num.toString(10);
|
47
|
+
if (text.indexOf('.') === -1) {
|
48
|
+
return text;
|
49
|
+
}
|
50
|
+
|
51
|
+
const roundingDownMatch = hasRoundingDownExp.exec(text);
|
52
|
+
if (roundingDownMatch) {
|
53
|
+
const negativeSign = roundingDownMatch[1];
|
54
|
+
const postDecimalString = roundingDownMatch[3];
|
55
|
+
const lastDigit = parseInt(postDecimalString.charAt(postDecimalString.length - 1), 10);
|
56
|
+
const postDecimal = parseInt(postDecimalString, 10);
|
57
|
+
const preDecimal = parseInt(roundingDownMatch[2], 10);
|
58
|
+
|
59
|
+
const origPostDecimalString = roundingDownMatch[3];
|
60
|
+
|
61
|
+
let newPostDecimal = (postDecimal + 10 - lastDigit).toString();
|
62
|
+
let carry = 0;
|
63
|
+
if (newPostDecimal.length > postDecimal.toString().length) {
|
64
|
+
// Left-shift
|
65
|
+
newPostDecimal = newPostDecimal.substring(1);
|
66
|
+
carry = 1;
|
67
|
+
}
|
68
|
+
|
69
|
+
// parseInt(...).toString() removes leading zeroes. Add them back.
|
70
|
+
while (newPostDecimal.length < origPostDecimalString.length) {
|
71
|
+
newPostDecimal = carry.toString(10) + newPostDecimal;
|
72
|
+
carry = 0;
|
73
|
+
}
|
74
|
+
|
75
|
+
text = `${negativeSign + (preDecimal + carry).toString()}.${newPostDecimal}`;
|
76
|
+
}
|
77
|
+
|
78
|
+
text = text.replace(fixRoundingUpExp, '$1');
|
79
|
+
|
80
|
+
return cleanUpNumber(text);
|
81
|
+
};
|
82
|
+
|
83
|
+
const numberExp = /^([-]?)(\d*)[.](\d+)$/;
|
84
|
+
export const getLenAfterDecimal = (numberAsString: string) => {
|
85
|
+
const numberMatch = numberExp.exec(numberAsString);
|
86
|
+
if (!numberMatch) {
|
87
|
+
// If not a match, either the number is exponential notation (or is something
|
88
|
+
// like NaN or Infinity)
|
89
|
+
if (numberAsString.search(/[eE]/) !== -1 || /^[a-zA-Z]+$/.exec(numberAsString)) {
|
90
|
+
return -1;
|
91
|
+
// Or it has no decimal point
|
92
|
+
} else {
|
93
|
+
return 0;
|
94
|
+
}
|
95
|
+
}
|
96
|
+
|
97
|
+
const afterDecimalLen = numberMatch[3].length;
|
98
|
+
return afterDecimalLen;
|
99
|
+
};
|
100
|
+
|
101
|
+
// [reference] should be a string representation of a base-10 number (no exponential (e.g. 10e10))
|
102
|
+
export const toStringOfSamePrecision = (num: number, ...references: string[]): string => {
|
103
|
+
const text = num.toString(10);
|
104
|
+
const textMatch = numberExp.exec(text);
|
105
|
+
if (!textMatch) {
|
106
|
+
return text;
|
107
|
+
}
|
108
|
+
|
109
|
+
let decimalPlaces = -1;
|
110
|
+
for (const reference of references) {
|
111
|
+
decimalPlaces = Math.max(getLenAfterDecimal(reference), decimalPlaces);
|
112
|
+
}
|
113
|
+
|
114
|
+
if (decimalPlaces === -1) {
|
115
|
+
return toRoundedString(num);
|
116
|
+
}
|
117
|
+
|
118
|
+
// Make text's after decimal length match [afterDecimalLen].
|
119
|
+
let postDecimal = textMatch[3].substring(0, decimalPlaces);
|
120
|
+
let preDecimal = textMatch[2];
|
121
|
+
const nextDigit = textMatch[3].charAt(decimalPlaces);
|
122
|
+
|
123
|
+
if (nextDigit !== '') {
|
124
|
+
const asNumber = parseInt(nextDigit, 10);
|
125
|
+
if (asNumber >= 5) {
|
126
|
+
// Don't attempt to parseInt() an empty string.
|
127
|
+
if (postDecimal.length > 0) {
|
128
|
+
const leadingZeroMatch = /^(0+)(\d*)$/.exec(postDecimal);
|
129
|
+
|
130
|
+
let leadingZeroes = '';
|
131
|
+
let postLeading = postDecimal;
|
132
|
+
if (leadingZeroMatch) {
|
133
|
+
leadingZeroes = leadingZeroMatch[1];
|
134
|
+
postLeading = leadingZeroMatch[2];
|
135
|
+
}
|
136
|
+
|
137
|
+
postDecimal = (parseInt(postDecimal) + 1).toString();
|
138
|
+
|
139
|
+
// If postDecimal got longer, remove leading zeroes if possible
|
140
|
+
if (postDecimal.length > postLeading.length && leadingZeroes.length > 0) {
|
141
|
+
leadingZeroes = leadingZeroes.substring(1);
|
142
|
+
}
|
143
|
+
|
144
|
+
postDecimal = leadingZeroes + postDecimal;
|
145
|
+
}
|
146
|
+
|
147
|
+
if (postDecimal.length === 0 || postDecimal.length > decimalPlaces) {
|
148
|
+
preDecimal = (parseInt(preDecimal) + 1).toString();
|
149
|
+
postDecimal = postDecimal.substring(1);
|
150
|
+
}
|
151
|
+
}
|
152
|
+
}
|
153
|
+
|
154
|
+
const negativeSign = textMatch[1];
|
155
|
+
return cleanUpNumber(`${negativeSign}${preDecimal}.${postDecimal}`);
|
156
|
+
};
|
@@ -0,0 +1,63 @@
|
|
1
|
+
import LineSegment2 from './LineSegment2';
|
2
|
+
import { Point2 } from '../Vec2';
|
3
|
+
import Rect2 from './Rect2';
|
4
|
+
|
5
|
+
abstract class Abstract2DShape {
|
6
|
+
protected static readonly smallValue = 1e-12;
|
7
|
+
|
8
|
+
/**
|
9
|
+
* @returns the distance from `point` to this shape. If `point` is within this shape,
|
10
|
+
* this returns the distance from `point` to the edge of this shape.
|
11
|
+
*
|
12
|
+
* @see {@link signedDistance}
|
13
|
+
*/
|
14
|
+
public distance(point: Point2) {
|
15
|
+
return Math.abs(this.signedDistance(point));
|
16
|
+
}
|
17
|
+
|
18
|
+
/**
|
19
|
+
* Computes the [signed distance function](https://en.wikipedia.org/wiki/Signed_distance_function)
|
20
|
+
* for this shape.
|
21
|
+
*/
|
22
|
+
public abstract signedDistance(point: Point2): number;
|
23
|
+
|
24
|
+
/**
|
25
|
+
* @returns points at which this shape intersects the given `lineSegment`.
|
26
|
+
*
|
27
|
+
* If this is a closed shape, returns points where the given `lineSegment` intersects
|
28
|
+
* the **boundary** of this.
|
29
|
+
*/
|
30
|
+
public abstract intersectsLineSegment(lineSegment: LineSegment2): Point2[];
|
31
|
+
|
32
|
+
/**
|
33
|
+
* Returns `true` if and only if the given `point` is contained within this shape.
|
34
|
+
*
|
35
|
+
* `epsilon` is a small number used to counteract floating point error. Thus, if
|
36
|
+
* `point` is within `epsilon` of the inside of this shape, `containsPoint` may also
|
37
|
+
* return `true`.
|
38
|
+
*
|
39
|
+
* The default implementation relies on `signedDistance`.
|
40
|
+
* Subclasses may override this method to provide a more efficient implementation.
|
41
|
+
*/
|
42
|
+
public containsPoint(point: Point2, epsilon: number = Abstract2DShape.smallValue): boolean {
|
43
|
+
return this.signedDistance(point) < epsilon;
|
44
|
+
}
|
45
|
+
|
46
|
+
/**
|
47
|
+
* Returns a bounding box that precisely fits the content of this shape.
|
48
|
+
*/
|
49
|
+
public abstract getTightBoundingBox(): Rect2;
|
50
|
+
|
51
|
+
/**
|
52
|
+
* Returns a bounding box that **loosely** fits the content of this shape.
|
53
|
+
*
|
54
|
+
* The result of this call can be larger than the result of {@link getTightBoundingBox},
|
55
|
+
* **but should not be smaller**. Thus, a call to `getLooseBoundingBox` can be significantly
|
56
|
+
* faster than a call to {@link getTightBoundingBox} for some shapes.
|
57
|
+
*/
|
58
|
+
public getLooseBoundingBox(): Rect2 {
|
59
|
+
return this.getTightBoundingBox();
|
60
|
+
}
|
61
|
+
}
|
62
|
+
|
63
|
+
export default Abstract2DShape;
|
@@ -0,0 +1,93 @@
|
|
1
|
+
import { Bezier } from 'bezier-js';
|
2
|
+
import { Point2, Vec2 } from '../Vec2';
|
3
|
+
import Abstract2DShape from './Abstract2DShape';
|
4
|
+
import LineSegment2 from './LineSegment2';
|
5
|
+
import Rect2 from './Rect2';
|
6
|
+
|
7
|
+
/**
|
8
|
+
* A lazy-initializing wrapper around Bezier-js.
|
9
|
+
*
|
10
|
+
* Subclasses may override `at`, `derivativeAt`, and `normal` with functions
|
11
|
+
* that do not initialize a `bezier-js` `Bezier`.
|
12
|
+
*
|
13
|
+
* Do not use this class directly. It may be removed/replaced in a future release.
|
14
|
+
* @internal
|
15
|
+
*/
|
16
|
+
abstract class BezierJSWrapper extends Abstract2DShape {
|
17
|
+
#bezierJs: Bezier|null = null;
|
18
|
+
|
19
|
+
/** Returns the start, control points, and end point of this Bézier. */
|
20
|
+
public abstract getPoints(): Point2[];
|
21
|
+
|
22
|
+
protected getBezier() {
|
23
|
+
if (!this.#bezierJs) {
|
24
|
+
this.#bezierJs = new Bezier(this.getPoints().map(p => p.xy));
|
25
|
+
}
|
26
|
+
return this.#bezierJs;
|
27
|
+
}
|
28
|
+
|
29
|
+
public override signedDistance(point: Point2): number {
|
30
|
+
// .d: Distance
|
31
|
+
return this.getBezier().project(point.xy).d!;
|
32
|
+
}
|
33
|
+
|
34
|
+
/**
|
35
|
+
* @returns the (more) exact distance from `point` to this.
|
36
|
+
*
|
37
|
+
* @see {@link approximateDistance}
|
38
|
+
*/
|
39
|
+
public override distance(point: Point2) {
|
40
|
+
// A Bézier curve has no interior, thus, signed distance is the same as distance.
|
41
|
+
return this.signedDistance(point);
|
42
|
+
}
|
43
|
+
|
44
|
+
/**
|
45
|
+
* @returns the curve evaluated at `t`.
|
46
|
+
*/
|
47
|
+
public at(t: number): Point2 {
|
48
|
+
return Vec2.ofXY(this.getBezier().get(t));
|
49
|
+
}
|
50
|
+
|
51
|
+
public derivativeAt(t: number): Point2 {
|
52
|
+
return Vec2.ofXY(this.getBezier().derivative(t));
|
53
|
+
}
|
54
|
+
|
55
|
+
public normal(t: number): Vec2 {
|
56
|
+
return Vec2.ofXY(this.getBezier().normal(t));
|
57
|
+
}
|
58
|
+
|
59
|
+
public override getTightBoundingBox(): Rect2 {
|
60
|
+
const bbox = this.getBezier().bbox();
|
61
|
+
const width = bbox.x.max - bbox.x.min;
|
62
|
+
const height = bbox.y.max - bbox.y.min;
|
63
|
+
|
64
|
+
return new Rect2(bbox.x.min, bbox.y.min, width, height);
|
65
|
+
}
|
66
|
+
|
67
|
+
public override intersectsLineSegment(line: LineSegment2): Point2[] {
|
68
|
+
const bezier = this.getBezier();
|
69
|
+
|
70
|
+
const intersectionPoints = bezier.intersects(line).map(t => {
|
71
|
+
// We're using the .intersects(line) function, which is documented
|
72
|
+
// to always return numbers. However, to satisfy the type checker (and
|
73
|
+
// possibly improperly-defined types),
|
74
|
+
if (typeof t === 'string') {
|
75
|
+
t = parseFloat(t);
|
76
|
+
}
|
77
|
+
|
78
|
+
const point = Vec2.ofXY(bezier.get(t));
|
79
|
+
|
80
|
+
// Ensure that the intersection is on the line segment
|
81
|
+
if (point.minus(line.p1).magnitude() > line.length
|
82
|
+
|| point.minus(line.p2).magnitude() > line.length) {
|
83
|
+
return null;
|
84
|
+
}
|
85
|
+
|
86
|
+
return point;
|
87
|
+
}).filter(entry => entry !== null) as Point2[];
|
88
|
+
|
89
|
+
return intersectionPoints;
|
90
|
+
}
|
91
|
+
}
|
92
|
+
|
93
|
+
export default BezierJSWrapper;
|