js-draw 0.18.1 → 0.18.2
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/CHANGELOG.md +3 -0
- package/dist/cjs/src/Color4.d.ts +61 -0
- package/dist/cjs/src/Color4.js +197 -0
- package/dist/cjs/src/Editor.d.ts +308 -0
- package/dist/cjs/src/Editor.js +904 -0
- package/dist/cjs/src/EditorImage.d.ts +97 -0
- package/dist/cjs/src/EditorImage.js +486 -0
- package/dist/cjs/src/EventDispatcher.d.ts +30 -0
- package/dist/cjs/src/EventDispatcher.js +57 -0
- package/dist/cjs/src/Pointer.d.ts +24 -0
- package/dist/cjs/src/Pointer.js +84 -0
- package/dist/cjs/src/SVGLoader.d.ts +48 -0
- package/dist/cjs/src/SVGLoader.js +472 -0
- package/dist/cjs/src/UndoRedoHistory.d.ts +19 -0
- package/dist/cjs/src/UndoRedoHistory.js +93 -0
- package/dist/cjs/src/Viewport.d.ts +71 -0
- package/dist/cjs/src/Viewport.js +264 -0
- package/dist/cjs/src/bundle/bundled.d.ts +4 -0
- package/dist/cjs/src/bundle/bundled.js +24 -0
- package/dist/cjs/src/commands/Command.d.ts +16 -0
- package/dist/cjs/src/commands/Command.js +34 -0
- package/dist/cjs/src/commands/Duplicate.d.ts +14 -0
- package/dist/cjs/src/commands/Duplicate.js +39 -0
- package/dist/cjs/src/commands/Erase.d.ts +14 -0
- package/dist/cjs/src/commands/Erase.js +63 -0
- package/dist/cjs/src/commands/SerializableCommand.d.ts +12 -0
- package/dist/cjs/src/commands/SerializableCommand.js +42 -0
- package/dist/cjs/src/commands/UnresolvedCommand.d.ts +14 -0
- package/dist/cjs/src/commands/UnresolvedCommand.js +28 -0
- package/dist/cjs/src/commands/invertCommand.d.ts +4 -0
- package/dist/cjs/src/commands/invertCommand.js +49 -0
- package/dist/cjs/src/commands/lib.d.ts +7 -0
- package/dist/cjs/src/commands/lib.js +18 -0
- package/dist/cjs/src/commands/localization.d.ts +23 -0
- package/dist/cjs/src/commands/localization.js +24 -0
- package/dist/cjs/src/commands/uniteCommands.d.ts +4 -0
- package/dist/cjs/src/commands/uniteCommands.js +121 -0
- package/dist/cjs/src/components/AbstractComponent.d.ts +73 -0
- package/dist/cjs/src/components/AbstractComponent.js +258 -0
- package/dist/cjs/src/components/ImageBackground.d.ts +42 -0
- package/dist/cjs/src/components/ImageBackground.js +146 -0
- package/dist/cjs/src/components/ImageComponent.d.ts +31 -0
- package/dist/cjs/src/components/ImageComponent.js +152 -0
- package/dist/cjs/src/components/RestylableComponent.d.ts +24 -0
- package/dist/cjs/src/components/RestylableComponent.js +88 -0
- package/dist/cjs/src/components/SVGGlobalAttributesObject.d.ts +21 -0
- package/dist/cjs/src/components/SVGGlobalAttributesObject.js +65 -0
- package/dist/cjs/src/components/Stroke.d.ts +40 -0
- package/dist/cjs/src/components/Stroke.js +191 -0
- package/dist/cjs/src/components/TextComponent.d.ts +53 -0
- package/dist/cjs/src/components/TextComponent.js +258 -0
- package/dist/cjs/src/components/UnknownSVGObject.d.ts +18 -0
- package/dist/cjs/src/components/UnknownSVGObject.js +50 -0
- package/dist/cjs/src/components/builders/ArrowBuilder.d.ts +19 -0
- package/dist/cjs/src/components/builders/ArrowBuilder.js +117 -0
- package/dist/cjs/src/components/builders/FreehandLineBuilder.d.ts +33 -0
- package/dist/cjs/src/components/builders/FreehandLineBuilder.js +173 -0
- package/dist/cjs/src/components/builders/LineBuilder.d.ts +18 -0
- package/dist/cjs/src/components/builders/LineBuilder.js +89 -0
- package/dist/cjs/src/components/builders/PressureSensitiveFreehandLineBuilder.d.ts +36 -0
- package/dist/cjs/src/components/builders/PressureSensitiveFreehandLineBuilder.js +347 -0
- package/dist/cjs/src/components/builders/RectangleBuilder.d.ts +20 -0
- package/dist/cjs/src/components/builders/RectangleBuilder.js +59 -0
- package/dist/cjs/src/components/builders/types.d.ts +12 -0
- package/dist/cjs/src/components/builders/types.js +2 -0
- package/dist/cjs/src/components/lib.d.ts +12 -0
- package/dist/cjs/src/components/lib.js +43 -0
- package/dist/cjs/src/components/localization.d.ts +11 -0
- package/dist/cjs/src/components/localization.js +13 -0
- package/dist/cjs/src/components/util/StrokeSmoother.d.ts +35 -0
- package/dist/cjs/src/components/util/StrokeSmoother.js +217 -0
- package/dist/cjs/src/components/util/describeComponentList.d.ts +4 -0
- package/dist/cjs/src/components/util/describeComponentList.js +16 -0
- package/dist/cjs/src/lib.d.ts +34 -0
- package/dist/cjs/src/lib.js +63 -0
- package/dist/cjs/src/localization.d.ts +14 -0
- package/dist/cjs/src/localization.js +13 -0
- package/dist/cjs/src/localizations/de.d.ts +3 -0
- package/dist/cjs/src/localizations/de.js +6 -0
- package/dist/cjs/src/localizations/en.d.ts +3 -0
- package/dist/cjs/src/localizations/en.js +6 -0
- package/dist/cjs/src/localizations/es.d.ts +3 -0
- package/dist/cjs/src/localizations/es.js +20 -0
- package/dist/cjs/src/localizations/getLocalizationTable.d.ts +3 -0
- package/dist/cjs/src/localizations/getLocalizationTable.js +50 -0
- package/dist/cjs/src/math/LineSegment2.d.ts +24 -0
- package/dist/cjs/src/math/LineSegment2.js +131 -0
- package/dist/cjs/src/math/Mat33.d.ts +118 -0
- package/dist/cjs/src/math/Mat33.js +332 -0
- package/dist/cjs/src/math/Path.d.ts +71 -0
- package/dist/cjs/src/math/Path.js +655 -0
- package/dist/cjs/src/math/Rect2.d.ts +52 -0
- package/dist/cjs/src/math/Rect2.js +234 -0
- package/dist/cjs/src/math/Triangle.d.ts +11 -0
- package/dist/cjs/src/math/Triangle.js +22 -0
- package/dist/cjs/src/math/Vec2.d.ts +13 -0
- package/dist/cjs/src/math/Vec2.js +19 -0
- package/dist/cjs/src/math/Vec3.d.ts +106 -0
- package/dist/cjs/src/math/Vec3.js +177 -0
- package/dist/cjs/src/math/lib.d.ts +7 -0
- package/dist/cjs/src/math/lib.js +18 -0
- package/dist/cjs/src/math/rounding.d.ts +4 -0
- package/dist/cjs/src/math/rounding.js +135 -0
- package/dist/cjs/src/rendering/Display.d.ts +75 -0
- package/dist/cjs/src/rendering/Display.js +214 -0
- package/dist/cjs/src/rendering/RenderingStyle.d.ts +31 -0
- package/dist/cjs/src/rendering/RenderingStyle.js +48 -0
- package/dist/cjs/src/rendering/TextRenderingStyle.d.ts +36 -0
- package/dist/cjs/src/rendering/TextRenderingStyle.js +29 -0
- package/dist/cjs/src/rendering/caching/CacheRecord.d.ts +20 -0
- package/dist/cjs/src/rendering/caching/CacheRecord.js +61 -0
- package/dist/cjs/src/rendering/caching/CacheRecordManager.d.ts +12 -0
- package/dist/cjs/src/rendering/caching/CacheRecordManager.js +50 -0
- package/dist/cjs/src/rendering/caching/RenderingCache.d.ts +11 -0
- package/dist/cjs/src/rendering/caching/RenderingCache.js +51 -0
- package/dist/cjs/src/rendering/caching/RenderingCacheNode.d.ts +29 -0
- package/dist/cjs/src/rendering/caching/RenderingCacheNode.js +326 -0
- package/dist/cjs/src/rendering/caching/testUtils.d.ts +9 -0
- package/dist/cjs/src/rendering/caching/testUtils.js +27 -0
- package/dist/cjs/src/rendering/caching/types.d.ts +19 -0
- package/dist/cjs/src/rendering/caching/types.js +2 -0
- package/dist/cjs/src/rendering/lib.d.ts +5 -0
- package/dist/cjs/src/rendering/lib.js +17 -0
- package/dist/cjs/src/rendering/localization.d.ts +10 -0
- package/dist/cjs/src/rendering/localization.js +12 -0
- package/dist/cjs/src/rendering/renderers/AbstractRenderer.d.ts +68 -0
- package/dist/cjs/src/rendering/renderers/AbstractRenderer.js +170 -0
- package/dist/cjs/src/rendering/renderers/CanvasRenderer.d.ts +63 -0
- package/dist/cjs/src/rendering/renderers/CanvasRenderer.js +236 -0
- package/dist/cjs/src/rendering/renderers/DummyRenderer.d.ts +35 -0
- package/dist/cjs/src/rendering/renderers/DummyRenderer.js +112 -0
- package/dist/cjs/src/rendering/renderers/SVGRenderer.d.ts +57 -0
- package/dist/cjs/src/rendering/renderers/SVGRenderer.js +311 -0
- package/dist/cjs/src/rendering/renderers/TextOnlyRenderer.d.ts +29 -0
- package/dist/cjs/src/rendering/renderers/TextOnlyRenderer.js +63 -0
- package/dist/cjs/src/testing/beforeEachFile.d.ts +1 -0
- package/dist/cjs/src/testing/beforeEachFile.js +12 -0
- package/dist/cjs/src/testing/createEditor.d.ts +4 -0
- package/dist/cjs/src/testing/createEditor.js +14 -0
- package/dist/cjs/src/testing/lib.d.ts +2 -0
- package/dist/cjs/src/testing/lib.js +10 -0
- package/dist/cjs/src/testing/loadExpectExtensions.d.ts +2 -0
- package/dist/cjs/src/testing/loadExpectExtensions.js +28 -0
- package/dist/cjs/src/testing/sendPenEvent.d.ts +12 -0
- package/dist/cjs/src/testing/sendPenEvent.js +24 -0
- package/dist/cjs/src/testing/sendTouchEvent.d.ts +42 -0
- package/dist/cjs/src/testing/sendTouchEvent.js +87 -0
- package/dist/cjs/src/toolbar/HTMLToolbar.d.ts +103 -0
- package/dist/cjs/src/toolbar/HTMLToolbar.js +383 -0
- package/dist/cjs/src/toolbar/IconProvider.d.ts +62 -0
- package/dist/cjs/src/toolbar/IconProvider.js +660 -0
- package/dist/cjs/src/toolbar/lib.d.ts +3 -0
- package/dist/cjs/src/toolbar/lib.js +24 -0
- package/dist/cjs/src/toolbar/localization.d.ts +49 -0
- package/dist/cjs/src/toolbar/localization.js +51 -0
- package/dist/cjs/src/toolbar/makeColorInput.d.ts +6 -0
- package/dist/cjs/src/toolbar/makeColorInput.js +120 -0
- package/dist/cjs/src/toolbar/types.d.ts +4 -0
- package/dist/cjs/src/toolbar/types.js +2 -0
- package/dist/cjs/src/toolbar/widgets/ActionButtonWidget.d.ts +15 -0
- package/dist/cjs/src/toolbar/widgets/ActionButtonWidget.js +31 -0
- package/dist/cjs/src/toolbar/widgets/BaseToolWidget.d.ts +11 -0
- package/dist/cjs/src/toolbar/widgets/BaseToolWidget.js +50 -0
- package/dist/cjs/src/toolbar/widgets/BaseWidget.d.ts +72 -0
- package/dist/cjs/src/toolbar/widgets/BaseWidget.js +313 -0
- package/dist/cjs/src/toolbar/widgets/DocumentPropertiesWidget.d.ts +18 -0
- package/dist/cjs/src/toolbar/widgets/DocumentPropertiesWidget.js +126 -0
- package/dist/cjs/src/toolbar/widgets/EraserToolWidget.d.ts +17 -0
- package/dist/cjs/src/toolbar/widgets/EraserToolWidget.js +63 -0
- package/dist/cjs/src/toolbar/widgets/HandToolWidget.d.ts +17 -0
- package/dist/cjs/src/toolbar/widgets/HandToolWidget.js +201 -0
- package/dist/cjs/src/toolbar/widgets/InsertImageWidget.d.ts +19 -0
- package/dist/cjs/src/toolbar/widgets/InsertImageWidget.js +176 -0
- package/dist/cjs/src/toolbar/widgets/OverflowWidget.d.ts +25 -0
- package/dist/cjs/src/toolbar/widgets/OverflowWidget.js +77 -0
- package/dist/cjs/src/toolbar/widgets/PenToolWidget.d.ts +27 -0
- package/dist/cjs/src/toolbar/widgets/PenToolWidget.js +226 -0
- package/dist/cjs/src/toolbar/widgets/SelectionToolWidget.d.ts +13 -0
- package/dist/cjs/src/toolbar/widgets/SelectionToolWidget.js +153 -0
- package/dist/cjs/src/toolbar/widgets/TextToolWidget.d.ts +16 -0
- package/dist/cjs/src/toolbar/widgets/TextToolWidget.js +115 -0
- package/dist/cjs/src/toolbar/widgets/lib.d.ts +10 -0
- package/dist/cjs/src/toolbar/widgets/lib.js +26 -0
- package/dist/cjs/src/tools/BaseTool.d.ts +22 -0
- package/dist/cjs/src/tools/BaseTool.js +66 -0
- package/dist/cjs/src/tools/Eraser.d.ts +23 -0
- package/dist/cjs/src/tools/Eraser.js +112 -0
- package/dist/cjs/src/tools/FindTool.d.ts +21 -0
- package/dist/cjs/src/tools/FindTool.js +121 -0
- package/dist/cjs/src/tools/PanZoom.d.ts +52 -0
- package/dist/cjs/src/tools/PanZoom.js +421 -0
- package/dist/cjs/src/tools/PasteHandler.d.ts +23 -0
- package/dist/cjs/src/tools/PasteHandler.js +99 -0
- package/dist/cjs/src/tools/Pen.d.ts +39 -0
- package/dist/cjs/src/tools/Pen.js +179 -0
- package/dist/cjs/src/tools/PipetteTool.d.ts +18 -0
- package/dist/cjs/src/tools/PipetteTool.js +45 -0
- package/dist/cjs/src/tools/SelectionTool/SelectAllShortcutHandler.d.ts +8 -0
- package/dist/cjs/src/tools/SelectionTool/SelectAllShortcutHandler.js +28 -0
- package/dist/cjs/src/tools/SelectionTool/Selection.d.ts +64 -0
- package/dist/cjs/src/tools/SelectionTool/Selection.js +488 -0
- package/dist/cjs/src/tools/SelectionTool/SelectionHandle.d.ts +38 -0
- package/dist/cjs/src/tools/SelectionTool/SelectionHandle.js +85 -0
- package/dist/cjs/src/tools/SelectionTool/SelectionTool.d.ts +36 -0
- package/dist/cjs/src/tools/SelectionTool/SelectionTool.js +405 -0
- package/dist/cjs/src/tools/SelectionTool/TransformMode.d.ts +34 -0
- package/dist/cjs/src/tools/SelectionTool/TransformMode.js +107 -0
- package/dist/cjs/src/tools/SelectionTool/types.d.ts +9 -0
- package/dist/cjs/src/tools/SelectionTool/types.js +14 -0
- package/dist/cjs/src/tools/TextTool.d.ts +33 -0
- package/dist/cjs/src/tools/TextTool.js +262 -0
- package/dist/cjs/src/tools/ToolController.d.ts +18 -0
- package/dist/cjs/src/tools/ToolController.js +187 -0
- package/dist/cjs/src/tools/ToolEnabledGroup.d.ts +6 -0
- package/dist/cjs/src/tools/ToolEnabledGroup.js +14 -0
- package/dist/cjs/src/tools/ToolSwitcherShortcut.d.ts +16 -0
- package/dist/cjs/src/tools/ToolSwitcherShortcut.js +38 -0
- package/dist/cjs/src/tools/ToolbarShortcutHandler.d.ts +12 -0
- package/dist/cjs/src/tools/ToolbarShortcutHandler.js +29 -0
- package/dist/cjs/src/tools/UndoRedoShortcut.d.ts +8 -0
- package/dist/cjs/src/tools/UndoRedoShortcut.js +28 -0
- package/dist/cjs/src/tools/lib.d.ts +16 -0
- package/dist/cjs/src/tools/lib.js +36 -0
- package/dist/cjs/src/tools/localization.d.ts +28 -0
- package/dist/cjs/src/tools/localization.js +30 -0
- package/dist/cjs/src/types.d.ts +151 -0
- package/dist/cjs/src/types.js +38 -0
- package/dist/cjs/src/util/assertions.d.ts +23 -0
- package/dist/cjs/src/util/assertions.js +51 -0
- package/dist/cjs/src/util/fileToBase64.d.ts +3 -0
- package/dist/cjs/src/util/fileToBase64.js +15 -0
- package/dist/cjs/src/util/untilNextAnimationFrame.d.ts +3 -0
- package/dist/cjs/src/util/untilNextAnimationFrame.js +9 -0
- package/dist/cjs/src/util/waitForTimeout.d.ts +2 -0
- package/dist/cjs/src/util/waitForTimeout.js +9 -0
- package/dist/mjs/src/Color4.d.ts +61 -0
- package/dist/mjs/src/Color4.mjs +193 -0
- package/dist/mjs/src/Editor.d.ts +308 -0
- package/dist/mjs/src/Editor.mjs +874 -0
- package/dist/mjs/src/EditorImage.d.ts +97 -0
- package/dist/mjs/src/EditorImage.mjs +477 -0
- package/dist/mjs/src/EventDispatcher.d.ts +30 -0
- package/dist/mjs/src/EventDispatcher.mjs +54 -0
- package/dist/mjs/src/Pointer.d.ts +24 -0
- package/dist/mjs/src/Pointer.mjs +80 -0
- package/dist/mjs/src/SVGLoader.d.ts +48 -0
- package/dist/mjs/src/SVGLoader.mjs +442 -0
- package/dist/mjs/src/UndoRedoHistory.d.ts +19 -0
- package/dist/mjs/src/UndoRedoHistory.mjs +91 -0
- package/dist/mjs/src/Viewport.d.ts +71 -0
- package/dist/mjs/src/Viewport.mjs +256 -0
- package/dist/mjs/src/bundle/bundled.d.ts +4 -0
- package/dist/mjs/src/bundle/bundled.mjs +5 -0
- package/dist/mjs/src/commands/Command.d.ts +16 -0
- package/dist/mjs/src/commands/Command.mjs +30 -0
- package/dist/mjs/src/commands/Duplicate.d.ts +14 -0
- package/dist/mjs/src/commands/Duplicate.mjs +33 -0
- package/dist/mjs/src/commands/Erase.d.ts +14 -0
- package/dist/mjs/src/commands/Erase.mjs +57 -0
- package/dist/mjs/src/commands/SerializableCommand.d.ts +12 -0
- package/dist/mjs/src/commands/SerializableCommand.mjs +36 -0
- package/dist/mjs/src/commands/UnresolvedCommand.d.ts +14 -0
- package/dist/mjs/src/commands/UnresolvedCommand.mjs +22 -0
- package/dist/mjs/src/commands/invertCommand.d.ts +4 -0
- package/dist/mjs/src/commands/invertCommand.mjs +44 -0
- package/dist/mjs/src/commands/lib.d.ts +7 -0
- package/dist/mjs/src/commands/lib.mjs +7 -0
- package/dist/mjs/src/commands/localization.d.ts +23 -0
- package/dist/mjs/src/commands/localization.mjs +21 -0
- package/dist/mjs/src/commands/uniteCommands.d.ts +4 -0
- package/dist/mjs/src/commands/uniteCommands.mjs +116 -0
- package/dist/mjs/src/components/AbstractComponent.d.ts +73 -0
- package/dist/mjs/src/components/AbstractComponent.mjs +252 -0
- package/dist/mjs/src/components/ImageBackground.d.ts +42 -0
- package/dist/mjs/src/components/ImageBackground.mjs +139 -0
- package/dist/mjs/src/components/ImageComponent.d.ts +31 -0
- package/dist/mjs/src/components/ImageComponent.mjs +146 -0
- package/dist/mjs/src/components/RestylableComponent.d.ts +24 -0
- package/dist/mjs/src/components/RestylableComponent.mjs +80 -0
- package/dist/mjs/src/components/SVGGlobalAttributesObject.d.ts +21 -0
- package/dist/mjs/src/components/SVGGlobalAttributesObject.mjs +59 -0
- package/dist/mjs/src/components/Stroke.d.ts +40 -0
- package/dist/mjs/src/components/Stroke.mjs +185 -0
- package/dist/mjs/src/components/TextComponent.d.ts +53 -0
- package/dist/mjs/src/components/TextComponent.mjs +252 -0
- package/dist/mjs/src/components/UnknownSVGObject.d.ts +18 -0
- package/dist/mjs/src/components/UnknownSVGObject.mjs +44 -0
- package/dist/mjs/src/components/builders/ArrowBuilder.d.ts +19 -0
- package/dist/mjs/src/components/builders/ArrowBuilder.mjs +86 -0
- package/dist/mjs/src/components/builders/FreehandLineBuilder.d.ts +33 -0
- package/dist/mjs/src/components/builders/FreehandLineBuilder.mjs +165 -0
- package/dist/mjs/src/components/builders/LineBuilder.d.ts +18 -0
- package/dist/mjs/src/components/builders/LineBuilder.mjs +58 -0
- package/dist/mjs/src/components/builders/PressureSensitiveFreehandLineBuilder.d.ts +36 -0
- package/dist/mjs/src/components/builders/PressureSensitiveFreehandLineBuilder.mjs +339 -0
- package/dist/mjs/src/components/builders/RectangleBuilder.d.ts +20 -0
- package/dist/mjs/src/components/builders/RectangleBuilder.mjs +50 -0
- package/dist/mjs/src/components/builders/types.d.ts +12 -0
- package/dist/mjs/src/components/builders/types.mjs +1 -0
- package/dist/mjs/src/components/lib.d.ts +12 -0
- package/dist/mjs/src/components/lib.mjs +12 -0
- package/dist/mjs/src/components/localization.d.ts +11 -0
- package/dist/mjs/src/components/localization.mjs +10 -0
- package/dist/mjs/src/components/util/StrokeSmoother.d.ts +35 -0
- package/dist/mjs/src/components/util/StrokeSmoother.mjs +210 -0
- package/dist/mjs/src/components/util/describeComponentList.d.ts +4 -0
- package/dist/mjs/src/components/util/describeComponentList.mjs +14 -0
- package/dist/mjs/src/lib.d.ts +34 -0
- package/dist/mjs/src/lib.mjs +34 -0
- package/dist/mjs/src/localization.d.ts +14 -0
- package/dist/mjs/src/localization.mjs +10 -0
- package/dist/mjs/src/localizations/de.d.ts +3 -0
- package/dist/mjs/src/localizations/de.mjs +4 -0
- package/dist/mjs/src/localizations/en.d.ts +3 -0
- package/dist/mjs/src/localizations/en.mjs +4 -0
- package/dist/mjs/src/localizations/es.d.ts +3 -0
- package/dist/mjs/src/localizations/es.mjs +18 -0
- package/dist/mjs/src/localizations/getLocalizationTable.d.ts +3 -0
- package/dist/mjs/src/localizations/getLocalizationTable.mjs +45 -0
- package/dist/mjs/src/math/LineSegment2.d.ts +24 -0
- package/dist/mjs/src/math/LineSegment2.mjs +125 -0
- package/dist/mjs/src/math/Mat33.d.ts +118 -0
- package/dist/mjs/src/math/Mat33.mjs +326 -0
- package/dist/mjs/src/math/Path.d.ts +71 -0
- package/dist/mjs/src/math/Path.mjs +648 -0
- package/dist/mjs/src/math/Rect2.d.ts +52 -0
- package/dist/mjs/src/math/Rect2.mjs +228 -0
- package/dist/mjs/src/math/Triangle.d.ts +11 -0
- package/dist/mjs/src/math/Triangle.mjs +19 -0
- package/dist/mjs/src/math/Vec2.d.ts +13 -0
- package/dist/mjs/src/math/Vec2.mjs +13 -0
- package/dist/mjs/src/math/Vec3.d.ts +106 -0
- package/dist/mjs/src/math/Vec3.mjs +174 -0
- package/dist/mjs/src/math/lib.d.ts +7 -0
- package/dist/mjs/src/math/lib.mjs +7 -0
- package/dist/mjs/src/math/rounding.d.ts +4 -0
- package/dist/mjs/src/math/rounding.mjs +128 -0
- package/dist/mjs/src/rendering/Display.d.ts +75 -0
- package/dist/mjs/src/rendering/Display.mjs +207 -0
- package/dist/mjs/src/rendering/RenderingStyle.d.ts +31 -0
- package/dist/mjs/src/rendering/RenderingStyle.mjs +38 -0
- package/dist/mjs/src/rendering/TextRenderingStyle.d.ts +36 -0
- package/dist/mjs/src/rendering/TextRenderingStyle.mjs +23 -0
- package/dist/mjs/src/rendering/caching/CacheRecord.d.ts +20 -0
- package/dist/mjs/src/rendering/caching/CacheRecord.mjs +55 -0
- package/dist/mjs/src/rendering/caching/CacheRecordManager.d.ts +12 -0
- package/dist/mjs/src/rendering/caching/CacheRecordManager.mjs +43 -0
- package/dist/mjs/src/rendering/caching/RenderingCache.d.ts +11 -0
- package/dist/mjs/src/rendering/caching/RenderingCache.mjs +45 -0
- package/dist/mjs/src/rendering/caching/RenderingCacheNode.d.ts +29 -0
- package/dist/mjs/src/rendering/caching/RenderingCacheNode.mjs +320 -0
- package/dist/mjs/src/rendering/caching/testUtils.d.ts +9 -0
- package/dist/mjs/src/rendering/caching/testUtils.mjs +20 -0
- package/dist/mjs/src/rendering/caching/types.d.ts +19 -0
- package/dist/mjs/src/rendering/caching/types.mjs +1 -0
- package/dist/mjs/src/rendering/lib.d.ts +5 -0
- package/dist/mjs/src/rendering/lib.mjs +5 -0
- package/dist/mjs/src/rendering/localization.d.ts +10 -0
- package/dist/mjs/src/rendering/localization.mjs +9 -0
- package/dist/mjs/src/rendering/renderers/AbstractRenderer.d.ts +68 -0
- package/dist/mjs/src/rendering/renderers/AbstractRenderer.mjs +144 -0
- package/dist/mjs/src/rendering/renderers/CanvasRenderer.d.ts +63 -0
- package/dist/mjs/src/rendering/renderers/CanvasRenderer.mjs +230 -0
- package/dist/mjs/src/rendering/renderers/DummyRenderer.d.ts +35 -0
- package/dist/mjs/src/rendering/renderers/DummyRenderer.mjs +106 -0
- package/dist/mjs/src/rendering/renderers/SVGRenderer.d.ts +57 -0
- package/dist/mjs/src/rendering/renderers/SVGRenderer.mjs +304 -0
- package/dist/mjs/src/rendering/renderers/TextOnlyRenderer.d.ts +29 -0
- package/dist/mjs/src/rendering/renderers/TextOnlyRenderer.mjs +57 -0
- package/dist/mjs/src/testing/beforeEachFile.d.ts +1 -0
- package/dist/mjs/src/testing/beforeEachFile.mjs +7 -0
- package/dist/mjs/src/testing/createEditor.d.ts +4 -0
- package/dist/mjs/src/testing/createEditor.mjs +9 -0
- package/dist/mjs/src/testing/lib.d.ts +2 -0
- package/dist/mjs/src/testing/lib.mjs +2 -0
- package/dist/mjs/src/testing/loadExpectExtensions.d.ts +2 -0
- package/dist/mjs/src/testing/loadExpectExtensions.mjs +24 -0
- package/dist/mjs/src/testing/sendPenEvent.d.ts +12 -0
- package/dist/mjs/src/testing/sendPenEvent.mjs +19 -0
- package/dist/mjs/src/testing/sendTouchEvent.d.ts +42 -0
- package/dist/mjs/src/testing/sendTouchEvent.mjs +62 -0
- package/dist/mjs/src/toolbar/HTMLToolbar.d.ts +103 -0
- package/dist/mjs/src/toolbar/HTMLToolbar.mjs +376 -0
- package/dist/mjs/src/toolbar/IconProvider.d.ts +62 -0
- package/dist/mjs/src/toolbar/IconProvider.mjs +654 -0
- package/dist/mjs/src/toolbar/lib.d.ts +3 -0
- package/dist/mjs/src/toolbar/lib.mjs +3 -0
- package/dist/mjs/src/toolbar/localization.d.ts +49 -0
- package/dist/mjs/src/toolbar/localization.mjs +48 -0
- package/dist/mjs/src/toolbar/makeColorInput.d.ts +6 -0
- package/dist/mjs/src/toolbar/makeColorInput.mjs +113 -0
- package/dist/mjs/src/toolbar/types.d.ts +4 -0
- package/dist/mjs/src/toolbar/types.mjs +1 -0
- package/dist/mjs/src/toolbar/widgets/ActionButtonWidget.d.ts +15 -0
- package/dist/mjs/src/toolbar/widgets/ActionButtonWidget.mjs +25 -0
- package/dist/mjs/src/toolbar/widgets/BaseToolWidget.d.ts +11 -0
- package/dist/mjs/src/toolbar/widgets/BaseToolWidget.mjs +44 -0
- package/dist/mjs/src/toolbar/widgets/BaseWidget.d.ts +72 -0
- package/dist/mjs/src/toolbar/widgets/BaseWidget.mjs +307 -0
- package/dist/mjs/src/toolbar/widgets/DocumentPropertiesWidget.d.ts +18 -0
- package/dist/mjs/src/toolbar/widgets/DocumentPropertiesWidget.mjs +120 -0
- package/dist/mjs/src/toolbar/widgets/EraserToolWidget.d.ts +17 -0
- package/dist/mjs/src/toolbar/widgets/EraserToolWidget.mjs +57 -0
- package/dist/mjs/src/toolbar/widgets/HandToolWidget.d.ts +17 -0
- package/dist/mjs/src/toolbar/widgets/HandToolWidget.mjs +172 -0
- package/dist/mjs/src/toolbar/widgets/InsertImageWidget.d.ts +19 -0
- package/dist/mjs/src/toolbar/widgets/InsertImageWidget.mjs +170 -0
- package/dist/mjs/src/toolbar/widgets/OverflowWidget.d.ts +25 -0
- package/dist/mjs/src/toolbar/widgets/OverflowWidget.mjs +71 -0
- package/dist/mjs/src/toolbar/widgets/PenToolWidget.d.ts +27 -0
- package/dist/mjs/src/toolbar/widgets/PenToolWidget.mjs +220 -0
- package/dist/mjs/src/toolbar/widgets/SelectionToolWidget.d.ts +13 -0
- package/dist/mjs/src/toolbar/widgets/SelectionToolWidget.mjs +147 -0
- package/dist/mjs/src/toolbar/widgets/TextToolWidget.d.ts +16 -0
- package/dist/mjs/src/toolbar/widgets/TextToolWidget.mjs +109 -0
- package/dist/mjs/src/toolbar/widgets/lib.d.ts +10 -0
- package/dist/mjs/src/toolbar/widgets/lib.mjs +10 -0
- package/dist/mjs/src/tools/BaseTool.d.ts +22 -0
- package/dist/mjs/src/tools/BaseTool.mjs +63 -0
- package/dist/mjs/src/tools/Eraser.d.ts +23 -0
- package/dist/mjs/src/tools/Eraser.mjs +106 -0
- package/dist/mjs/src/tools/FindTool.d.ts +21 -0
- package/dist/mjs/src/tools/FindTool.mjs +114 -0
- package/dist/mjs/src/tools/PanZoom.d.ts +52 -0
- package/dist/mjs/src/tools/PanZoom.mjs +414 -0
- package/dist/mjs/src/tools/PasteHandler.d.ts +23 -0
- package/dist/mjs/src/tools/PasteHandler.mjs +93 -0
- package/dist/mjs/src/tools/Pen.d.ts +39 -0
- package/dist/mjs/src/tools/Pen.mjs +173 -0
- package/dist/mjs/src/tools/PipetteTool.d.ts +18 -0
- package/dist/mjs/src/tools/PipetteTool.mjs +39 -0
- package/dist/mjs/src/tools/SelectionTool/SelectAllShortcutHandler.d.ts +8 -0
- package/dist/mjs/src/tools/SelectionTool/SelectAllShortcutHandler.mjs +22 -0
- package/dist/mjs/src/tools/SelectionTool/Selection.d.ts +64 -0
- package/dist/mjs/src/tools/SelectionTool/Selection.mjs +459 -0
- package/dist/mjs/src/tools/SelectionTool/SelectionHandle.d.ts +38 -0
- package/dist/mjs/src/tools/SelectionTool/SelectionHandle.mjs +81 -0
- package/dist/mjs/src/tools/SelectionTool/SelectionTool.d.ts +36 -0
- package/dist/mjs/src/tools/SelectionTool/SelectionTool.mjs +398 -0
- package/dist/mjs/src/tools/SelectionTool/TransformMode.d.ts +34 -0
- package/dist/mjs/src/tools/SelectionTool/TransformMode.mjs +98 -0
- package/dist/mjs/src/tools/SelectionTool/types.d.ts +9 -0
- package/dist/mjs/src/tools/SelectionTool/types.mjs +11 -0
- package/dist/mjs/src/tools/TextTool.d.ts +33 -0
- package/dist/mjs/src/tools/TextTool.mjs +256 -0
- package/dist/mjs/src/tools/ToolController.d.ts +18 -0
- package/dist/mjs/src/tools/ToolController.mjs +158 -0
- package/dist/mjs/src/tools/ToolEnabledGroup.d.ts +6 -0
- package/dist/mjs/src/tools/ToolEnabledGroup.mjs +11 -0
- package/dist/mjs/src/tools/ToolSwitcherShortcut.d.ts +16 -0
- package/dist/mjs/src/tools/ToolSwitcherShortcut.mjs +32 -0
- package/dist/mjs/src/tools/ToolbarShortcutHandler.d.ts +12 -0
- package/dist/mjs/src/tools/ToolbarShortcutHandler.mjs +23 -0
- package/dist/mjs/src/tools/UndoRedoShortcut.d.ts +8 -0
- package/dist/mjs/src/tools/UndoRedoShortcut.mjs +22 -0
- package/dist/mjs/src/tools/lib.d.ts +16 -0
- package/dist/mjs/src/tools/lib.mjs +16 -0
- package/dist/mjs/src/tools/localization.d.ts +28 -0
- package/dist/mjs/src/tools/localization.mjs +27 -0
- package/dist/mjs/src/types.d.ts +151 -0
- package/dist/mjs/src/types.mjs +35 -0
- package/dist/mjs/src/util/assertions.d.ts +23 -0
- package/dist/mjs/src/util/assertions.mjs +45 -0
- package/dist/mjs/src/util/fileToBase64.d.ts +3 -0
- package/dist/mjs/src/util/fileToBase64.mjs +13 -0
- package/dist/mjs/src/util/untilNextAnimationFrame.d.ts +3 -0
- package/dist/mjs/src/util/untilNextAnimationFrame.mjs +7 -0
- package/dist/mjs/src/util/waitForTimeout.d.ts +2 -0
- package/dist/mjs/src/util/waitForTimeout.mjs +7 -0
- package/package.json +1 -1
- package/src/Color4.test.ts +40 -0
- package/src/Color4.ts +236 -0
- package/src/Editor.css +86 -0
- package/src/Editor.loadFrom.test.ts +24 -0
- package/src/Editor.toSVG.test.ts +111 -0
- package/src/Editor.ts +1122 -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 +71 -0
- package/src/Pointer.ts +127 -0
- package/src/SVGLoader.test.ts +114 -0
- package/src/SVGLoader.ts +511 -0
- package/src/UndoRedoHistory.test.ts +33 -0
- package/src/UndoRedoHistory.ts +102 -0
- package/src/Viewport.ts +319 -0
- package/src/bundle/bundled.ts +7 -0
- package/src/commands/Command.ts +45 -0
- package/src/commands/Duplicate.ts +48 -0
- package/src/commands/Erase.ts +74 -0
- package/src/commands/SerializableCommand.ts +49 -0
- package/src/commands/UnresolvedCommand.ts +37 -0
- package/src/commands/invertCommand.ts +51 -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 +135 -0
- package/src/components/AbstractComponent.transformBy.test.ts +22 -0
- package/src/components/AbstractComponent.ts +364 -0
- package/src/components/ImageBackground.test.ts +35 -0
- package/src/components/ImageBackground.ts +176 -0
- package/src/components/ImageComponent.ts +171 -0
- package/src/components/RestylableComponent.ts +142 -0
- package/src/components/SVGGlobalAttributesObject.ts +81 -0
- package/src/components/Stroke.test.ts +139 -0
- package/src/components/Stroke.ts +245 -0
- package/src/components/TextComponent.test.ts +99 -0
- package/src/components/TextComponent.ts +315 -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/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 +25 -0
- package/src/components/localization.ts +22 -0
- package/src/components/util/StrokeSmoother.ts +293 -0
- package/src/components/util/describeComponentList.ts +18 -0
- package/src/lib.ts +37 -0
- package/src/localization.ts +34 -0
- package/src/localizations/de.ts +98 -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 +55 -0
- package/src/math/LineSegment2.test.ts +99 -0
- package/src/math/LineSegment2.ts +160 -0
- package/src/math/Mat33.test.ts +244 -0
- package/src/math/Mat33.ts +437 -0
- package/src/math/Path.fromString.test.ts +223 -0
- package/src/math/Path.test.ts +198 -0
- package/src/math/Path.toString.test.ts +77 -0
- package/src/math/Path.ts +790 -0
- package/src/math/Rect2.test.ts +204 -0
- package/src/math/Rect2.ts +315 -0
- package/src/math/Triangle.ts +29 -0
- package/src/math/Vec2.test.ts +30 -0
- package/src/math/Vec2.ts +18 -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/rounding.test.ts +65 -0
- package/src/math/rounding.ts +156 -0
- package/src/rendering/Display.ts +249 -0
- package/src/rendering/RenderingStyle.test.ts +68 -0
- package/src/rendering/RenderingStyle.ts +55 -0
- package/src/rendering/TextRenderingStyle.ts +45 -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 +6 -0
- package/src/rendering/localization.ts +20 -0
- package/src/rendering/renderers/AbstractRenderer.ts +222 -0
- package/src/rendering/renderers/CanvasRenderer.ts +296 -0
- package/src/rendering/renderers/DummyRenderer.test.ts +42 -0
- package/src/rendering/renderers/DummyRenderer.ts +136 -0
- package/src/rendering/renderers/SVGRenderer.ts +354 -0
- package/src/rendering/renderers/TextOnlyRenderer.ts +70 -0
- package/src/styles.js +7 -0
- package/src/testing/beforeEachFile.ts +8 -0
- package/src/testing/createEditor.ts +11 -0
- package/src/testing/global.d.ts +17 -0
- package/src/testing/lib.ts +3 -0
- package/src/testing/loadExpectExtensions.ts +25 -0
- package/src/testing/sendPenEvent.ts +31 -0
- package/src/testing/sendTouchEvent.ts +78 -0
- package/src/toolbar/HTMLToolbar.ts +492 -0
- package/src/toolbar/IconProvider.ts +736 -0
- package/src/toolbar/lib.ts +4 -0
- package/src/toolbar/localization.ts +106 -0
- package/src/toolbar/makeColorInput.ts +145 -0
- package/src/toolbar/toolbar.css +213 -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 +377 -0
- package/src/toolbar/widgets/DocumentPropertiesWidget.ts +167 -0
- package/src/toolbar/widgets/EraserToolWidget.ts +85 -0
- package/src/toolbar/widgets/HandToolWidget.ts +250 -0
- package/src/toolbar/widgets/InsertImageWidget.css +44 -0
- package/src/toolbar/widgets/InsertImageWidget.ts +223 -0
- package/src/toolbar/widgets/OverflowWidget.css +27 -0
- package/src/toolbar/widgets/OverflowWidget.ts +92 -0
- package/src/toolbar/widgets/PenToolWidget.ts +288 -0
- package/src/toolbar/widgets/SelectionToolWidget.ts +190 -0
- package/src/toolbar/widgets/TextToolWidget.ts +145 -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 +139 -0
- package/src/tools/FindTool.css +7 -0
- package/src/tools/FindTool.ts +152 -0
- package/src/tools/PanZoom.test.ts +310 -0
- package/src/tools/PanZoom.ts +520 -0
- package/src/tools/PasteHandler.ts +95 -0
- package/src/tools/Pen.test.ts +194 -0
- package/src/tools/Pen.ts +226 -0
- package/src/tools/PipetteTool.ts +55 -0
- package/src/tools/SelectionTool/SelectAllShortcutHandler.ts +28 -0
- package/src/tools/SelectionTool/Selection.ts +607 -0
- package/src/tools/SelectionTool/SelectionHandle.ts +108 -0
- package/src/tools/SelectionTool/SelectionTool.css +23 -0
- package/src/tools/SelectionTool/SelectionTool.test.ts +261 -0
- package/src/tools/SelectionTool/SelectionTool.ts +480 -0
- package/src/tools/SelectionTool/TransformMode.ts +114 -0
- package/src/tools/SelectionTool/types.ts +11 -0
- package/src/tools/TextTool.ts +326 -0
- package/src/tools/ToolController.ts +178 -0
- package/src/tools/ToolEnabledGroup.ts +14 -0
- package/src/tools/ToolSwitcherShortcut.ts +39 -0
- package/src/tools/ToolbarShortcutHandler.ts +34 -0
- package/src/tools/UndoRedoShortcut.test.ts +56 -0
- package/src/tools/UndoRedoShortcut.ts +25 -0
- package/src/tools/lib.ts +21 -0
- package/src/tools/localization.ts +66 -0
- package/src/types.ts +234 -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/waitForTimeout.ts +9 -0
@@ -0,0 +1,654 @@
|
|
1
|
+
import Color4 from '../Color4.mjs';
|
2
|
+
import { Vec2 } from '../math/Vec2.mjs';
|
3
|
+
import SVGRenderer from '../rendering/renderers/SVGRenderer.mjs';
|
4
|
+
import Viewport from '../Viewport.mjs';
|
5
|
+
const svgNamespace = 'http://www.w3.org/2000/svg';
|
6
|
+
const iconColorFill = `
|
7
|
+
style='fill: var(--icon-color);'
|
8
|
+
`;
|
9
|
+
const iconColorStrokeFill = `
|
10
|
+
style='fill: var(--icon-color); stroke: var(--icon-color);'
|
11
|
+
`;
|
12
|
+
const checkerboardPatternDef = `
|
13
|
+
<pattern
|
14
|
+
id='checkerboard'
|
15
|
+
viewBox='0,0,10,10'
|
16
|
+
width='20%'
|
17
|
+
height='20%'
|
18
|
+
patternUnits='userSpaceOnUse'
|
19
|
+
>
|
20
|
+
<rect x=0 y=0 width=10 height=10 fill='white'/>
|
21
|
+
<rect x=0 y=0 width=5 height=5 fill='gray'/>
|
22
|
+
<rect x=5 y=5 width=5 height=5 fill='gray'/>
|
23
|
+
</pattern>
|
24
|
+
`;
|
25
|
+
const checkerboardPatternRef = 'url(#checkerboard)';
|
26
|
+
/**
|
27
|
+
* Provides icons that can be used in the toolbar, etc.
|
28
|
+
* Extend this class and override methods to customize icons.
|
29
|
+
*
|
30
|
+
* @example
|
31
|
+
* ```ts
|
32
|
+
* class CustomIconProvider extends jsdraw.IconProvider {
|
33
|
+
* // Use '☺' instead of the default dropdown symbol.
|
34
|
+
* public makeDropdownIcon() {
|
35
|
+
* const icon = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
36
|
+
* icon.innerHTML = `
|
37
|
+
* <text x='5' y='55' style='fill: var(--icon-color); font-size: 50pt;'>☺</text>
|
38
|
+
* `;
|
39
|
+
* icon.setAttribute('viewBox', '0 0 100 100');
|
40
|
+
* return icon;
|
41
|
+
* }
|
42
|
+
* }
|
43
|
+
*
|
44
|
+
* const icons = new CustomIconProvider();
|
45
|
+
* const editor = new jsdraw.Editor(document.body, {
|
46
|
+
* iconProvider: icons,
|
47
|
+
* });
|
48
|
+
*
|
49
|
+
* // Add a toolbar that uses these icons
|
50
|
+
* editor.addToolbar();
|
51
|
+
* ```
|
52
|
+
*/
|
53
|
+
export default class IconProvider {
|
54
|
+
makeUndoIcon() {
|
55
|
+
return this.makeRedoIcon(true);
|
56
|
+
}
|
57
|
+
// @param mirror - reflect across the x-axis. This parameter is internal.
|
58
|
+
// @returns a redo icon.
|
59
|
+
makeRedoIcon(mirror = false) {
|
60
|
+
const icon = document.createElementNS(svgNamespace, 'svg');
|
61
|
+
icon.innerHTML = `
|
62
|
+
<style>
|
63
|
+
.toolbar-svg-undo-redo-icon {
|
64
|
+
stroke: var(--icon-color);
|
65
|
+
stroke-width: 12;
|
66
|
+
stroke-linejoin: round;
|
67
|
+
stroke-linecap: round;
|
68
|
+
fill: none;
|
69
|
+
|
70
|
+
transform-origin: center;
|
71
|
+
}
|
72
|
+
</style>
|
73
|
+
<path
|
74
|
+
d='M20,20 A15,15 0 0 1 70,80 L80,90 L60,70 L65,90 L87,90 L65,80'
|
75
|
+
class='toolbar-svg-undo-redo-icon'
|
76
|
+
style='${mirror ? 'transform: scale(-1, 1);' : ''}'/>
|
77
|
+
`;
|
78
|
+
icon.setAttribute('viewBox', '0 0 100 100');
|
79
|
+
return icon;
|
80
|
+
}
|
81
|
+
makeDropdownIcon() {
|
82
|
+
const icon = document.createElementNS(svgNamespace, 'svg');
|
83
|
+
icon.innerHTML = `
|
84
|
+
<g>
|
85
|
+
<path
|
86
|
+
d='M5,10 L50,90 L95,10 Z'
|
87
|
+
${iconColorFill}
|
88
|
+
/>
|
89
|
+
</g>
|
90
|
+
`;
|
91
|
+
icon.setAttribute('viewBox', '0 0 100 100');
|
92
|
+
return icon;
|
93
|
+
}
|
94
|
+
makeEraserIcon(eraserSize) {
|
95
|
+
const icon = document.createElementNS(svgNamespace, 'svg');
|
96
|
+
eraserSize !== null && eraserSize !== void 0 ? eraserSize : (eraserSize = 10);
|
97
|
+
const scaledSize = eraserSize / 4;
|
98
|
+
const eraserColor = '#ff70af';
|
99
|
+
// Draw an eraser-like shape. Created with Inkscape
|
100
|
+
icon.innerHTML = `
|
101
|
+
<g>
|
102
|
+
<path
|
103
|
+
style="fill:${eraserColor}"
|
104
|
+
stroke="black"
|
105
|
+
transform="rotate(41.35)"
|
106
|
+
d="M 52.5 27
|
107
|
+
C 50 28.9 48.9 31.7 48.9 34.8
|
108
|
+
L 48.9 39.8
|
109
|
+
C 48.9 45.3 53.4 49.8 58.9 49.8
|
110
|
+
L 103.9 49.8
|
111
|
+
C 105.8 49.8 107.6 49.2 109.1 48.3
|
112
|
+
L 110.2 ${scaledSize + 49.5} L 159.7 ${scaledSize + 5}
|
113
|
+
L 157.7 ${-scaledSize + 5.2} L 112.4 ${49.5 - scaledSize}
|
114
|
+
C 113.4 43.5 113.9 41.7 113.9 39.8
|
115
|
+
L 113.9 34.8
|
116
|
+
C 113.9 29.3 109.4 24.8 103.9 24.8
|
117
|
+
L 58.9 24.8
|
118
|
+
C 56.5 24.8 54.3 25.7 52.5 27
|
119
|
+
z "
|
120
|
+
id="path438" />
|
121
|
+
|
122
|
+
<rect
|
123
|
+
stroke="#cc8077"
|
124
|
+
${iconColorFill}
|
125
|
+
id="rect218"
|
126
|
+
width="65"
|
127
|
+
height="75"
|
128
|
+
x="48.9"
|
129
|
+
y="-38.7"
|
130
|
+
transform="rotate(41.35)" />
|
131
|
+
</g>
|
132
|
+
`;
|
133
|
+
icon.setAttribute('viewBox', '0 0 120 120');
|
134
|
+
return icon;
|
135
|
+
}
|
136
|
+
makeSelectionIcon() {
|
137
|
+
const icon = document.createElementNS(svgNamespace, 'svg');
|
138
|
+
// Draw a cursor-like shape
|
139
|
+
icon.innerHTML = `
|
140
|
+
<g>
|
141
|
+
<rect x=10 y=10 width=70 height=70 fill='pink' stroke='black'/>
|
142
|
+
<rect x=75 y=75 width=10 height=10 fill='white' stroke='black'/>
|
143
|
+
</g>
|
144
|
+
`;
|
145
|
+
icon.setAttribute('viewBox', '0 0 100 100');
|
146
|
+
return icon;
|
147
|
+
}
|
148
|
+
/**
|
149
|
+
* @param pathData - SVG path data (e.g. `m10,10l30,30z`)
|
150
|
+
* @param fill - A valid CSS color (e.g. `var(--icon-color)` or `#f0f`). This can be `none`.
|
151
|
+
*/
|
152
|
+
makeIconFromPath(pathData, fill = 'var(--icon-color)', strokeColor = 'none', strokeWidth = '0px') {
|
153
|
+
const icon = document.createElementNS(svgNamespace, 'svg');
|
154
|
+
const path = document.createElementNS(svgNamespace, 'path');
|
155
|
+
path.setAttribute('d', pathData);
|
156
|
+
path.style.fill = fill;
|
157
|
+
path.style.stroke = strokeColor;
|
158
|
+
path.style.strokeWidth = strokeWidth;
|
159
|
+
icon.appendChild(path);
|
160
|
+
icon.setAttribute('viewBox', '0 0 100 100');
|
161
|
+
return icon;
|
162
|
+
}
|
163
|
+
makeHandToolIcon() {
|
164
|
+
const fill = 'none';
|
165
|
+
const strokeColor = 'var(--icon-color)';
|
166
|
+
const strokeWidth = '3';
|
167
|
+
// Draw a cursor-like shape
|
168
|
+
return this.makeIconFromPath(`
|
169
|
+
m 10,60
|
170
|
+
5,30
|
171
|
+
H 90
|
172
|
+
V 30
|
173
|
+
C 90,20 75,20 75,30
|
174
|
+
V 60
|
175
|
+
20
|
176
|
+
C 75,10 60,10 60,20
|
177
|
+
V 60
|
178
|
+
15
|
179
|
+
C 60,5 45,5 45,15
|
180
|
+
V 60
|
181
|
+
25
|
182
|
+
C 45,15 30,15 30,25
|
183
|
+
V 60
|
184
|
+
75
|
185
|
+
L 25,60
|
186
|
+
C 20,45 10,50 10,60
|
187
|
+
Z
|
188
|
+
`, fill, strokeColor, strokeWidth);
|
189
|
+
}
|
190
|
+
makeTouchPanningIcon() {
|
191
|
+
const fill = 'none';
|
192
|
+
const strokeColor = 'var(--icon-color)';
|
193
|
+
const strokeWidth = '3';
|
194
|
+
return this.makeIconFromPath(`
|
195
|
+
M 5,5.5
|
196
|
+
V 17.2
|
197
|
+
L 16.25,5.46
|
198
|
+
Z
|
199
|
+
|
200
|
+
m 33.75,0
|
201
|
+
L 50,17
|
202
|
+
V 5.5
|
203
|
+
Z
|
204
|
+
|
205
|
+
M 5,40.7
|
206
|
+
v 11.7
|
207
|
+
h 11.25
|
208
|
+
z
|
209
|
+
|
210
|
+
M 26,19
|
211
|
+
C 19.8,19.4 17.65,30.4 21.9,34.8
|
212
|
+
L 50,70
|
213
|
+
H 27.5
|
214
|
+
c -11.25,0 -11.25,17.6 0,17.6
|
215
|
+
H 61.25
|
216
|
+
C 94.9,87.8 95,87.6 95,40.7 78.125,23 67,29 55.6,46.5
|
217
|
+
L 33.1,23
|
218
|
+
C 30.3125,20.128192 27.9,19 25.830078,19.119756
|
219
|
+
Z
|
220
|
+
`, fill, strokeColor, strokeWidth);
|
221
|
+
}
|
222
|
+
makeAllDevicePanningIcon() {
|
223
|
+
const fill = 'none';
|
224
|
+
const strokeColor = 'var(--icon-color)';
|
225
|
+
const strokeWidth = '3';
|
226
|
+
return this.makeIconFromPath(`
|
227
|
+
M 5 5
|
228
|
+
L 5 17.5
|
229
|
+
17.5 5
|
230
|
+
5 5
|
231
|
+
z
|
232
|
+
|
233
|
+
M 42.5 5
|
234
|
+
L 55 17.5
|
235
|
+
55 5
|
236
|
+
42.5 5
|
237
|
+
z
|
238
|
+
|
239
|
+
M 70 10
|
240
|
+
L 70 21
|
241
|
+
61 15
|
242
|
+
55.5 23
|
243
|
+
66 30
|
244
|
+
56 37
|
245
|
+
61 45
|
246
|
+
70 39
|
247
|
+
70 50
|
248
|
+
80 50
|
249
|
+
80 39
|
250
|
+
89 45
|
251
|
+
95 36
|
252
|
+
84 30
|
253
|
+
95 23
|
254
|
+
89 15
|
255
|
+
80 21
|
256
|
+
80 10
|
257
|
+
70 10
|
258
|
+
z
|
259
|
+
|
260
|
+
M 27.5 26.25
|
261
|
+
L 27.5 91.25
|
262
|
+
L 43.75 83.125
|
263
|
+
L 52 99
|
264
|
+
L 68 91
|
265
|
+
L 60 75
|
266
|
+
L 76.25 66.875
|
267
|
+
L 27.5 26.25
|
268
|
+
z
|
269
|
+
|
270
|
+
M 5 42.5
|
271
|
+
L 5 55
|
272
|
+
L 17.5 55
|
273
|
+
L 5 42.5
|
274
|
+
z
|
275
|
+
`, fill, strokeColor, strokeWidth);
|
276
|
+
}
|
277
|
+
makeZoomIcon() {
|
278
|
+
const icon = document.createElementNS(svgNamespace, 'svg');
|
279
|
+
icon.setAttribute('viewBox', '0 0 100 100');
|
280
|
+
const addTextNode = (text, x, y) => {
|
281
|
+
const textNode = document.createElementNS(svgNamespace, 'text');
|
282
|
+
textNode.appendChild(document.createTextNode(text));
|
283
|
+
textNode.setAttribute('x', x.toString());
|
284
|
+
textNode.setAttribute('y', y.toString());
|
285
|
+
textNode.style.textAlign = 'center';
|
286
|
+
textNode.style.textAnchor = 'middle';
|
287
|
+
textNode.style.fontSize = '55px';
|
288
|
+
textNode.style.fill = 'var(--icon-color)';
|
289
|
+
textNode.style.fontFamily = 'monospace';
|
290
|
+
icon.appendChild(textNode);
|
291
|
+
};
|
292
|
+
addTextNode('+', 40, 45);
|
293
|
+
addTextNode('-', 70, 75);
|
294
|
+
return icon;
|
295
|
+
}
|
296
|
+
makeRotationLockIcon() {
|
297
|
+
const icon = this.makeIconFromPath(`
|
298
|
+
M 40.1 25.1
|
299
|
+
C 32.5 25 27.9 34.1 27.9 34.1
|
300
|
+
L 25.7 30
|
301
|
+
L 28 44.7
|
302
|
+
L 36.6 40.3
|
303
|
+
L 32.3 38.3
|
304
|
+
C 33.6 28 38.1 25.2 45.1 31.8
|
305
|
+
L 49.4 29.6
|
306
|
+
C 45.9 26.3 42.8 25.1 40.1 25.1
|
307
|
+
z
|
308
|
+
|
309
|
+
M 51.7 34.2
|
310
|
+
L 43.5 39.1
|
311
|
+
L 48 40.8
|
312
|
+
C 47.4 51.1 43.1 54.3 35.7 48.2
|
313
|
+
L 31.6 50.7
|
314
|
+
C 45.5 62.1 52.6 44.6 52.6 44.6
|
315
|
+
L 55.1 48.6
|
316
|
+
L 51.7 34.2
|
317
|
+
z
|
318
|
+
|
319
|
+
M 56.9 49.9
|
320
|
+
C 49.8 49.9 49.2 57.3 49.3 60.9
|
321
|
+
L 47.6 60.9
|
322
|
+
L 47.6 73.7
|
323
|
+
L 66.1 73.7
|
324
|
+
L 66.1 60.9
|
325
|
+
L 64.4 60.9
|
326
|
+
C 64.5 57.3 63.9 49.9 56.9 49.9
|
327
|
+
z
|
328
|
+
|
329
|
+
M 56.9 53.5
|
330
|
+
C 60.8 53.5 61 58.2 60.8 60.9
|
331
|
+
L 52.9 60.9
|
332
|
+
C 52.7 58.2 52.9 53.5 56.9 53.5
|
333
|
+
z
|
334
|
+
`);
|
335
|
+
icon.setAttribute('viewBox', '10 10 70 70');
|
336
|
+
return icon;
|
337
|
+
}
|
338
|
+
makeInsertImageIcon() {
|
339
|
+
return this.makeIconFromPath(`
|
340
|
+
M 5 10 L 5 90 L 95 90 L 95 10 L 5 10 z
|
341
|
+
M 10 15 L 90 15 L 90 50 L 70 75 L 40 50 L 10 75 L 10 15 z
|
342
|
+
M 22.5 25 A 7.5 7.5 0 0 0 15 32.5 A 7.5 7.5 0 0 0 22.5 40 A 7.5 7.5 0 0 0 30 32.5 A 7.5 7.5 0 0 0 22.5 25 z
|
343
|
+
`);
|
344
|
+
}
|
345
|
+
makeTextIcon(textStyle) {
|
346
|
+
var _a, _b;
|
347
|
+
const icon = document.createElementNS(svgNamespace, 'svg');
|
348
|
+
icon.setAttribute('viewBox', '0 0 100 100');
|
349
|
+
const textNode = document.createElementNS(svgNamespace, 'text');
|
350
|
+
textNode.appendChild(document.createTextNode('T'));
|
351
|
+
textNode.style.fontFamily = textStyle.fontFamily;
|
352
|
+
textNode.style.fontWeight = (_a = textStyle.fontWeight) !== null && _a !== void 0 ? _a : '';
|
353
|
+
textNode.style.fontVariant = (_b = textStyle.fontVariant) !== null && _b !== void 0 ? _b : '';
|
354
|
+
textNode.style.fill = textStyle.renderingStyle.fill.toHexString();
|
355
|
+
textNode.style.textAnchor = 'middle';
|
356
|
+
textNode.setAttribute('x', '50');
|
357
|
+
textNode.setAttribute('y', '75');
|
358
|
+
textNode.style.fontSize = '65px';
|
359
|
+
textNode.style.filter = 'drop-shadow(0px 0px 10px var(--primary-shadow-color))';
|
360
|
+
icon.appendChild(textNode);
|
361
|
+
return icon;
|
362
|
+
}
|
363
|
+
makePenIcon(strokeSize, color, rounded) {
|
364
|
+
if (color instanceof Color4) {
|
365
|
+
color = color.toHexString();
|
366
|
+
}
|
367
|
+
const icon = document.createElementNS(svgNamespace, 'svg');
|
368
|
+
icon.setAttribute('viewBox', '0 0 100 100');
|
369
|
+
const tipThickness = strokeSize / 2;
|
370
|
+
const inkTipPath = `
|
371
|
+
M ${15 - tipThickness},${80 - tipThickness}
|
372
|
+
${15 - tipThickness},${80 + tipThickness}
|
373
|
+
30,83
|
374
|
+
15,65
|
375
|
+
Z
|
376
|
+
`;
|
377
|
+
const trailStartEndY = 80 + tipThickness;
|
378
|
+
const inkTrailPath = `
|
379
|
+
m ${15 - tipThickness * 1.1},${trailStartEndY}
|
380
|
+
c 35,10 55,15 60,30
|
381
|
+
l ${35 + tipThickness * 1.2},${-10 - tipThickness}
|
382
|
+
C 80.47,98.32 50.5,${90 + tipThickness} 20,${trailStartEndY} Z
|
383
|
+
`;
|
384
|
+
const colorBubblePath = `
|
385
|
+
M 72.45,35.67
|
386
|
+
A 10,15 41.8 0 1 55,40.2 10,15 41.8 0 1 57.55,22.3 10,15 41.8 0 1 75,17.8 10,15 41.8 0 1 72.5,35.67
|
387
|
+
Z
|
388
|
+
`;
|
389
|
+
let gripMainPath = 'M 85,-25 25,35 h 10 v 10 h 10 v 10 h 10 v 10 h 10 l -5,10 60,-60 z';
|
390
|
+
let gripShadow1Path = 'M 25,35 H 35 L 90,-15 85,-25 Z';
|
391
|
+
let gripShadow2Path = 'M 60,75 65,65 H 55 l 55,-55 10,5 z';
|
392
|
+
if (rounded) {
|
393
|
+
gripMainPath = 'M 85,-25 25,35 c 15,0 40,30 35,40 l 60,-60 z';
|
394
|
+
gripShadow1Path = 'm 25,35 c 3.92361,0.384473 7.644275,0.980572 10,3 l 55,-53 -5,-10 z';
|
395
|
+
gripShadow2Path = 'M 60,75 C 61,66 59,65 56,59 l 54,-54 10,10 z';
|
396
|
+
}
|
397
|
+
const penTipPath = `M 25,35 ${10 - tipThickness / 4},${70 - tipThickness / 2} 20,75 25,85 60,75 70,55 45,25 Z`;
|
398
|
+
const pencilTipColor = Color4.fromHex('#f4d7d7');
|
399
|
+
const tipColor = pencilTipColor.mix(Color4.fromString(color), tipThickness / 40 - 0.1).toHexString();
|
400
|
+
const ink = `
|
401
|
+
<path
|
402
|
+
fill="${checkerboardPatternRef}"
|
403
|
+
d="${inkTipPath}"
|
404
|
+
/>
|
405
|
+
<path
|
406
|
+
fill="${checkerboardPatternRef}"
|
407
|
+
d="${inkTrailPath}"
|
408
|
+
/>
|
409
|
+
<path
|
410
|
+
fill="${color}"
|
411
|
+
d="${inkTipPath}"
|
412
|
+
/>
|
413
|
+
<path
|
414
|
+
fill="${color}"
|
415
|
+
d="${inkTrailPath}"
|
416
|
+
/>
|
417
|
+
`;
|
418
|
+
const penTip = `
|
419
|
+
<path
|
420
|
+
fill="${checkerboardPatternRef}"
|
421
|
+
d="${penTipPath}"
|
422
|
+
/>
|
423
|
+
<path
|
424
|
+
fill="${tipColor}"
|
425
|
+
stroke="${color}"
|
426
|
+
d="${penTipPath}"
|
427
|
+
/>
|
428
|
+
`;
|
429
|
+
const grip = `
|
430
|
+
<path
|
431
|
+
${iconColorStrokeFill}
|
432
|
+
d="${gripMainPath}"
|
433
|
+
/>
|
434
|
+
|
435
|
+
<!-- shadows -->
|
436
|
+
<path
|
437
|
+
fill="rgba(150, 150, 150, 0.3)"
|
438
|
+
d="${gripShadow1Path}"
|
439
|
+
/>
|
440
|
+
<path
|
441
|
+
fill="rgba(100, 100, 100, 0.2)"
|
442
|
+
d="${gripShadow2Path}"
|
443
|
+
/>
|
444
|
+
|
445
|
+
<!-- color bubble -->
|
446
|
+
<path
|
447
|
+
fill="${checkerboardPatternRef}"
|
448
|
+
d="${colorBubblePath}"
|
449
|
+
/>
|
450
|
+
<path
|
451
|
+
fill="${color}"
|
452
|
+
d="${colorBubblePath}"
|
453
|
+
/>
|
454
|
+
`;
|
455
|
+
icon.innerHTML = `
|
456
|
+
<defs>
|
457
|
+
${checkerboardPatternDef}
|
458
|
+
</defs>
|
459
|
+
<g>
|
460
|
+
${ink}
|
461
|
+
${penTip}
|
462
|
+
${grip}
|
463
|
+
</g>
|
464
|
+
`;
|
465
|
+
return icon;
|
466
|
+
}
|
467
|
+
makeIconFromFactory(pen, factory) {
|
468
|
+
// Increase the thickness we use to generate the icon less with larger actual thicknesses.
|
469
|
+
// We want the icon to be recognisable with a large range of thicknesses.
|
470
|
+
const thickness = Math.sqrt(pen.getThickness()) * 3;
|
471
|
+
const nowTime = (new Date()).getTime();
|
472
|
+
const startPoint = {
|
473
|
+
pos: Vec2.of(10, 10),
|
474
|
+
width: thickness,
|
475
|
+
color: pen.getColor(),
|
476
|
+
time: nowTime - 100,
|
477
|
+
};
|
478
|
+
const endPoint = {
|
479
|
+
pos: Vec2.of(90, 90),
|
480
|
+
width: thickness,
|
481
|
+
color: pen.getColor(),
|
482
|
+
time: nowTime,
|
483
|
+
};
|
484
|
+
const viewport = new Viewport(() => { });
|
485
|
+
const builder = factory(startPoint, viewport);
|
486
|
+
builder.addPoint(endPoint);
|
487
|
+
const icon = document.createElementNS(svgNamespace, 'svg');
|
488
|
+
icon.setAttribute('viewBox', '0 0 100 100');
|
489
|
+
viewport.updateScreenSize(Vec2.of(100, 100));
|
490
|
+
const renderer = new SVGRenderer(icon, viewport);
|
491
|
+
builder.preview(renderer);
|
492
|
+
return icon;
|
493
|
+
}
|
494
|
+
makePipetteIcon(color) {
|
495
|
+
const icon = document.createElementNS(svgNamespace, 'svg');
|
496
|
+
const pipette = document.createElementNS(svgNamespace, 'path');
|
497
|
+
pipette.setAttribute('d', `
|
498
|
+
M 47,6
|
499
|
+
C 35,5 25,15 35,30
|
500
|
+
c -9.2,1.3 -15,0 -15,3
|
501
|
+
0,2 5,5 15,7
|
502
|
+
V 81
|
503
|
+
L 40,90
|
504
|
+
h 6
|
505
|
+
L 40,80
|
506
|
+
V 40
|
507
|
+
h 15
|
508
|
+
v 40
|
509
|
+
l -6,10
|
510
|
+
h 6
|
511
|
+
l 5,-9.2
|
512
|
+
V 40
|
513
|
+
C 70,38 75,35 75,33
|
514
|
+
75,30 69.2,31.2 60,30
|
515
|
+
65,15 65,5 47,6
|
516
|
+
Z
|
517
|
+
`);
|
518
|
+
pipette.style.fill = 'var(--icon-color)';
|
519
|
+
if (color) {
|
520
|
+
const defs = document.createElementNS(svgNamespace, 'defs');
|
521
|
+
defs.innerHTML = checkerboardPatternDef;
|
522
|
+
icon.appendChild(defs);
|
523
|
+
const fluidBackground = document.createElementNS(svgNamespace, 'path');
|
524
|
+
const fluid = document.createElementNS(svgNamespace, 'path');
|
525
|
+
const fluidPathData = `
|
526
|
+
m 40,50 c 5,5 10,0 15,-5 V 80 L 50,90 H 45 L 40,80 Z
|
527
|
+
`;
|
528
|
+
fluid.setAttribute('d', fluidPathData);
|
529
|
+
fluidBackground.setAttribute('d', fluidPathData);
|
530
|
+
fluid.style.fill = color.toHexString();
|
531
|
+
fluidBackground.style.fill = checkerboardPatternRef;
|
532
|
+
icon.appendChild(fluidBackground);
|
533
|
+
icon.appendChild(fluid);
|
534
|
+
}
|
535
|
+
icon.appendChild(pipette);
|
536
|
+
icon.setAttribute('viewBox', '0 0 100 100');
|
537
|
+
return icon;
|
538
|
+
}
|
539
|
+
makeFormatSelectionIcon() {
|
540
|
+
return this.makeIconFromPath(`
|
541
|
+
M 5 10
|
542
|
+
L 5 20 L 10 20 L 10 15 L 20 15 L 20 40 L 15 40 L 15 45 L 35 45 L 35 40 L 30 40 L 30 15 L 40 15 L 40 20 L 45 20 L 45 15 L 45 10 L 5 10 z
|
543
|
+
M 90 10 C 90 10 86.5 13.8 86 14 C 86 14 76.2 24.8 76 25 L 60 25 L 60 65 C 75 70 85 70 90 65 L 90 25 L 80 25 L 76.7 25 L 90 10 z
|
544
|
+
M 60 25 L 55 25 L 50 30 L 60 25 z
|
545
|
+
M 10 55 L 10 90 L 41 90 L 41 86 L 45 86 L 45 55 L 10 55 z
|
546
|
+
M 42 87 L 42 93 L 48 93 L 48 87 L 42 87 z
|
547
|
+
`);
|
548
|
+
}
|
549
|
+
makeResizeViewportIcon() {
|
550
|
+
return this.makeIconFromPath(`
|
551
|
+
M 75 5 75 10 90 10 90 25 95 25 95 5 75 5 z
|
552
|
+
M 15 15 15 30 20 30 20 20 30 20 30 15 15 15 z
|
553
|
+
M 84 15 82 17 81 16 81 20 85 20 84 19 86 17 84 15 z
|
554
|
+
M 26 24 24 26 26 28 25 29 29 29 29 25 28 26 26 24 z
|
555
|
+
M 25 71 26 72 24 74 26 76 28 74 29 75 29 71 25 71 z
|
556
|
+
M 15 75 15 85 25 85 25 80 20 80 20 75 15 75 z
|
557
|
+
M 90 75 90 90 75 90 75 95 95 95 95 75 90 75 z
|
558
|
+
M 81 81 81 85 82 84 84 86 86 84 84 82 85 81 81 81 z
|
559
|
+
`);
|
560
|
+
}
|
561
|
+
makeDuplicateSelectionIcon() {
|
562
|
+
return this.makeIconFromPath(`
|
563
|
+
M 45,10 45,55 90,55 90,10 45,10 z
|
564
|
+
M 10,25 10,90 70,90 70,60 40,60 40,25 10,25 z
|
565
|
+
`);
|
566
|
+
}
|
567
|
+
makePasteIcon() {
|
568
|
+
const icon = this.makeIconFromPath(`
|
569
|
+
M 50 0 L 50 5 L 35 5 L 40 24.75 L 20 25 L 20 100 L 85 100 L 100 90 L 100 24 L 75.1 24.3 L 80 5 L 65 5 L 65 0 L 50 0 z
|
570
|
+
M 10 15 L 10 115 L 110 115 L 110 15 L 85 15 L 83 20 L 105 20 L 105 110 L 15 110 L 15 20 L 32 20 L 30 15 L 10 15 z
|
571
|
+
M 25 35 L 90 35 L 90 40 L 25 40 L 25 35 z
|
572
|
+
M 25 45 L 90 45 L 90 50 L 25 50 L 25 45 z
|
573
|
+
M 25 55 L 85 55 L 85 60 L 25 60 L 25 55 z
|
574
|
+
M 25 65 L 90 65 L 90 70 L 25 70 L 25 65 z
|
575
|
+
`);
|
576
|
+
icon.setAttribute('viewBox', '0 0 120 120');
|
577
|
+
return icon;
|
578
|
+
}
|
579
|
+
makeDeleteSelectionIcon() {
|
580
|
+
const strokeWidth = '5px';
|
581
|
+
const strokeColor = 'var(--icon-color)';
|
582
|
+
const fillColor = 'none';
|
583
|
+
return this.makeIconFromPath(`
|
584
|
+
M 10,10 90,90
|
585
|
+
M 10,90 90,10
|
586
|
+
`, fillColor, strokeColor, strokeWidth);
|
587
|
+
}
|
588
|
+
makeSaveIcon() {
|
589
|
+
const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
590
|
+
svg.innerHTML = `
|
591
|
+
<style>
|
592
|
+
.toolbar-save-icon {
|
593
|
+
stroke: var(--icon-color);
|
594
|
+
stroke-width: 10;
|
595
|
+
stroke-linejoin: round;
|
596
|
+
stroke-linecap: round;
|
597
|
+
fill: none;
|
598
|
+
}
|
599
|
+
</style>
|
600
|
+
<path
|
601
|
+
d='
|
602
|
+
M 15,55 30,70 85,20
|
603
|
+
'
|
604
|
+
class='toolbar-save-icon'
|
605
|
+
/>
|
606
|
+
`;
|
607
|
+
svg.setAttribute('viewBox', '0 0 100 100');
|
608
|
+
return svg;
|
609
|
+
}
|
610
|
+
makeConfigureDocumentIcon() {
|
611
|
+
const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
612
|
+
svg.innerHTML = `
|
613
|
+
<path
|
614
|
+
d='
|
615
|
+
M 5,5 V 95 H 95 V 5 Z m 5,5 H 90 V 90 H 10 Z
|
616
|
+
m 5,10 V 30 H 50 V 25 H 20 v -5 z
|
617
|
+
m 40,0 V 50 H 85 V 20 Z
|
618
|
+
m 2,2 H 83 V 39 L 77,28 70,42 64,35 57,45 Z
|
619
|
+
m 8.5,5 C 64.67,27 64,27.67 64,28.5 64,29.33 64.67,30 65.5,30 66.33,30 67,29.33 67,28.5 67,27.67 66.33,27 65.5,27 Z
|
620
|
+
M 15,40 v 5 h 35 v -5 z
|
621
|
+
m 0,15 v 5 h 70 v -5 z
|
622
|
+
m 0,15 v 5 h 70 v -5 z
|
623
|
+
'
|
624
|
+
style='fill: var(--icon-color);'
|
625
|
+
/>
|
626
|
+
`;
|
627
|
+
svg.setAttribute('viewBox', '0 0 100 100');
|
628
|
+
return svg;
|
629
|
+
}
|
630
|
+
makeOverflowIcon() {
|
631
|
+
return this.makeIconFromPath(`
|
632
|
+
M 15 40
|
633
|
+
A 12.5 12.5 0 0 0 2.5 52.5
|
634
|
+
A 12.5 12.5 0 0 0 15 65
|
635
|
+
A 12.5 12.5 0 0 0 27.5 52.5
|
636
|
+
A 12.5 12.5 0 0 0 15 40
|
637
|
+
z
|
638
|
+
|
639
|
+
M 50 40
|
640
|
+
A 12.5 12.5 0 0 0 37.5 52.5
|
641
|
+
A 12.5 12.5 0 0 0 50 65
|
642
|
+
A 12.5 12.5 0 0 0 62.5 52.5
|
643
|
+
A 12.5 12.5 0 0 0 50 40
|
644
|
+
z
|
645
|
+
|
646
|
+
M 85 40
|
647
|
+
A 12.5 12.5 0 0 0 72.5 52.5
|
648
|
+
A 12.5 12.5 0 0 0 85 65
|
649
|
+
A 12.5 12.5 0 0 0 97.5 52.5
|
650
|
+
A 12.5 12.5 0 0 0 85 40
|
651
|
+
z
|
652
|
+
`);
|
653
|
+
}
|
654
|
+
}
|
@@ -0,0 +1,49 @@
|
|
1
|
+
export interface ToolbarLocalization {
|
2
|
+
fontLabel: string;
|
3
|
+
textSize: string;
|
4
|
+
touchPanning: string;
|
5
|
+
lockRotation: string;
|
6
|
+
outlinedRectanglePen: string;
|
7
|
+
filledRectanglePen: string;
|
8
|
+
linePen: string;
|
9
|
+
arrowPen: string;
|
10
|
+
image: string;
|
11
|
+
inputAltText: string;
|
12
|
+
chooseFile: string;
|
13
|
+
cancel: string;
|
14
|
+
submit: string;
|
15
|
+
freehandPen: string;
|
16
|
+
pressureSensitiveFreehandPen: string;
|
17
|
+
selectObjectType: string;
|
18
|
+
colorLabel: string;
|
19
|
+
pen: string;
|
20
|
+
eraser: string;
|
21
|
+
select: string;
|
22
|
+
handTool: string;
|
23
|
+
thicknessLabel: string;
|
24
|
+
resizeImageToSelection: string;
|
25
|
+
deleteSelection: string;
|
26
|
+
duplicateSelection: string;
|
27
|
+
pickColorFromScreen: string;
|
28
|
+
clickToPickColorAnnouncement: string;
|
29
|
+
reformatSelection: string;
|
30
|
+
undo: string;
|
31
|
+
redo: string;
|
32
|
+
zoom: string;
|
33
|
+
resetView: string;
|
34
|
+
selectionToolKeyboardShortcuts: string;
|
35
|
+
paste: string;
|
36
|
+
documentProperties: string;
|
37
|
+
backgroundColor: string;
|
38
|
+
imageWidthOption: string;
|
39
|
+
imageHeightOption: string;
|
40
|
+
toggleOverflow: string;
|
41
|
+
errorImageHasZeroSize: string;
|
42
|
+
dropdownShown: (toolName: string) => string;
|
43
|
+
dropdownHidden: (toolName: string) => string;
|
44
|
+
zoomLevel: (zoomPercentage: number) => string;
|
45
|
+
colorChangedAnnouncement: (color: string) => string;
|
46
|
+
imageSize: (size: number, units: string) => string;
|
47
|
+
imageLoadError: (message: string) => string;
|
48
|
+
}
|
49
|
+
export declare const defaultToolbarLocalization: ToolbarLocalization;
|