js-draw 0.17.4 → 0.18.1
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 +8 -0
- package/dist/bundle.js +9 -1
- package/package.json +35 -33
- package/tsconfig.json +3 -2
- package/tsconfig.mjs.json +9 -0
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -34
- package/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
- package/.github/ISSUE_TEMPLATE/translation.yml +0 -902
- package/.github/pull_request_template.md +0 -15
- package/.github/workflows/firebase-hosting-merge.yml +0 -32
- package/.github/workflows/firebase-hosting-pull-request.yml +0 -32
- package/.github/workflows/github-pages.yml +0 -56
- package/.husky/pre-commit +0 -4
- package/build_tools/BundledFile.ts +0 -167
- package/build_tools/buildTranslationTemplate.ts +0 -121
- package/build_tools/bundle.ts +0 -11
- package/dist/build_tools/BundledFile.d.ts +0 -13
- package/dist/build_tools/BundledFile.js +0 -157
- package/dist/build_tools/buildTranslationTemplate.d.ts +0 -1
- package/dist/build_tools/buildTranslationTemplate.js +0 -94
- package/dist/build_tools/bundle.d.ts +0 -1
- package/dist/build_tools/bundle.js +0 -5
- package/dist/src/Color4.d.ts +0 -60
- package/dist/src/Color4.js +0 -192
- package/dist/src/Editor.d.ts +0 -308
- package/dist/src/Editor.js +0 -874
- package/dist/src/EditorImage.d.ts +0 -97
- package/dist/src/EditorImage.js +0 -477
- package/dist/src/EventDispatcher.d.ts +0 -30
- package/dist/src/EventDispatcher.js +0 -54
- package/dist/src/Pointer.d.ts +0 -24
- package/dist/src/Pointer.js +0 -80
- package/dist/src/SVGLoader.d.ts +0 -48
- package/dist/src/SVGLoader.js +0 -442
- package/dist/src/UndoRedoHistory.d.ts +0 -19
- package/dist/src/UndoRedoHistory.js +0 -91
- package/dist/src/Viewport.d.ts +0 -71
- package/dist/src/Viewport.js +0 -256
- package/dist/src/bundle/bundled.d.ts +0 -4
- package/dist/src/bundle/bundled.js +0 -5
- package/dist/src/commands/Command.d.ts +0 -16
- package/dist/src/commands/Command.js +0 -30
- package/dist/src/commands/Duplicate.d.ts +0 -14
- package/dist/src/commands/Duplicate.js +0 -33
- package/dist/src/commands/Erase.d.ts +0 -14
- package/dist/src/commands/Erase.js +0 -57
- package/dist/src/commands/SerializableCommand.d.ts +0 -12
- package/dist/src/commands/SerializableCommand.js +0 -36
- package/dist/src/commands/UnresolvedCommand.d.ts +0 -14
- package/dist/src/commands/UnresolvedCommand.js +0 -22
- package/dist/src/commands/invertCommand.d.ts +0 -4
- package/dist/src/commands/invertCommand.js +0 -44
- package/dist/src/commands/lib.d.ts +0 -7
- package/dist/src/commands/lib.js +0 -7
- package/dist/src/commands/localization.d.ts +0 -23
- package/dist/src/commands/localization.js +0 -21
- package/dist/src/commands/uniteCommands.d.ts +0 -4
- package/dist/src/commands/uniteCommands.js +0 -116
- package/dist/src/components/AbstractComponent.d.ts +0 -73
- package/dist/src/components/AbstractComponent.js +0 -252
- package/dist/src/components/ImageBackground.d.ts +0 -42
- package/dist/src/components/ImageBackground.js +0 -139
- package/dist/src/components/ImageComponent.d.ts +0 -31
- package/dist/src/components/ImageComponent.js +0 -146
- package/dist/src/components/RestylableComponent.d.ts +0 -24
- package/dist/src/components/RestylableComponent.js +0 -80
- package/dist/src/components/SVGGlobalAttributesObject.d.ts +0 -21
- package/dist/src/components/SVGGlobalAttributesObject.js +0 -59
- package/dist/src/components/Stroke.d.ts +0 -40
- package/dist/src/components/Stroke.js +0 -185
- package/dist/src/components/TextComponent.d.ts +0 -53
- package/dist/src/components/TextComponent.js +0 -252
- package/dist/src/components/UnknownSVGObject.d.ts +0 -18
- package/dist/src/components/UnknownSVGObject.js +0 -44
- package/dist/src/components/builders/ArrowBuilder.d.ts +0 -19
- package/dist/src/components/builders/ArrowBuilder.js +0 -86
- package/dist/src/components/builders/FreehandLineBuilder.d.ts +0 -33
- package/dist/src/components/builders/FreehandLineBuilder.js +0 -165
- package/dist/src/components/builders/LineBuilder.d.ts +0 -18
- package/dist/src/components/builders/LineBuilder.js +0 -58
- package/dist/src/components/builders/PressureSensitiveFreehandLineBuilder.d.ts +0 -36
- package/dist/src/components/builders/PressureSensitiveFreehandLineBuilder.js +0 -339
- package/dist/src/components/builders/RectangleBuilder.d.ts +0 -20
- package/dist/src/components/builders/RectangleBuilder.js +0 -50
- package/dist/src/components/builders/types.d.ts +0 -12
- package/dist/src/components/builders/types.js +0 -1
- package/dist/src/components/lib.d.ts +0 -12
- package/dist/src/components/lib.js +0 -12
- package/dist/src/components/localization.d.ts +0 -11
- package/dist/src/components/localization.js +0 -10
- package/dist/src/components/util/StrokeSmoother.d.ts +0 -35
- package/dist/src/components/util/StrokeSmoother.js +0 -210
- package/dist/src/components/util/describeComponentList.d.ts +0 -4
- package/dist/src/components/util/describeComponentList.js +0 -14
- package/dist/src/lib.d.ts +0 -34
- package/dist/src/lib.js +0 -34
- package/dist/src/localization.d.ts +0 -14
- package/dist/src/localization.js +0 -10
- package/dist/src/localizations/de.d.ts +0 -3
- package/dist/src/localizations/de.js +0 -4
- package/dist/src/localizations/en.d.ts +0 -3
- package/dist/src/localizations/en.js +0 -4
- package/dist/src/localizations/es.d.ts +0 -3
- package/dist/src/localizations/es.js +0 -18
- package/dist/src/localizations/getLocalizationTable.d.ts +0 -3
- package/dist/src/localizations/getLocalizationTable.js +0 -45
- package/dist/src/math/LineSegment2.d.ts +0 -24
- package/dist/src/math/LineSegment2.js +0 -125
- package/dist/src/math/Mat33.d.ts +0 -118
- package/dist/src/math/Mat33.js +0 -326
- package/dist/src/math/Path.d.ts +0 -71
- package/dist/src/math/Path.js +0 -648
- package/dist/src/math/Rect2.d.ts +0 -52
- package/dist/src/math/Rect2.js +0 -228
- package/dist/src/math/Triangle.d.ts +0 -11
- package/dist/src/math/Triangle.js +0 -19
- package/dist/src/math/Vec2.d.ts +0 -13
- package/dist/src/math/Vec2.js +0 -13
- package/dist/src/math/Vec3.d.ts +0 -106
- package/dist/src/math/Vec3.js +0 -174
- package/dist/src/math/lib.d.ts +0 -7
- package/dist/src/math/lib.js +0 -7
- package/dist/src/math/rounding.d.ts +0 -4
- package/dist/src/math/rounding.js +0 -128
- package/dist/src/rendering/Display.d.ts +0 -75
- package/dist/src/rendering/Display.js +0 -207
- package/dist/src/rendering/RenderingStyle.d.ts +0 -31
- package/dist/src/rendering/RenderingStyle.js +0 -38
- package/dist/src/rendering/TextRenderingStyle.d.ts +0 -36
- package/dist/src/rendering/TextRenderingStyle.js +0 -23
- package/dist/src/rendering/caching/CacheRecord.d.ts +0 -20
- package/dist/src/rendering/caching/CacheRecord.js +0 -55
- package/dist/src/rendering/caching/CacheRecordManager.d.ts +0 -12
- package/dist/src/rendering/caching/CacheRecordManager.js +0 -43
- package/dist/src/rendering/caching/RenderingCache.d.ts +0 -11
- package/dist/src/rendering/caching/RenderingCache.js +0 -45
- package/dist/src/rendering/caching/RenderingCacheNode.d.ts +0 -29
- package/dist/src/rendering/caching/RenderingCacheNode.js +0 -320
- package/dist/src/rendering/caching/testUtils.d.ts +0 -9
- package/dist/src/rendering/caching/testUtils.js +0 -20
- package/dist/src/rendering/caching/types.d.ts +0 -19
- package/dist/src/rendering/caching/types.js +0 -1
- package/dist/src/rendering/lib.d.ts +0 -5
- package/dist/src/rendering/lib.js +0 -5
- package/dist/src/rendering/localization.d.ts +0 -10
- package/dist/src/rendering/localization.js +0 -9
- package/dist/src/rendering/renderers/AbstractRenderer.d.ts +0 -68
- package/dist/src/rendering/renderers/AbstractRenderer.js +0 -144
- package/dist/src/rendering/renderers/CanvasRenderer.d.ts +0 -63
- package/dist/src/rendering/renderers/CanvasRenderer.js +0 -230
- package/dist/src/rendering/renderers/DummyRenderer.d.ts +0 -35
- package/dist/src/rendering/renderers/DummyRenderer.js +0 -106
- package/dist/src/rendering/renderers/SVGRenderer.d.ts +0 -57
- package/dist/src/rendering/renderers/SVGRenderer.js +0 -304
- package/dist/src/rendering/renderers/TextOnlyRenderer.d.ts +0 -29
- package/dist/src/rendering/renderers/TextOnlyRenderer.js +0 -57
- package/dist/src/testing/beforeEachFile.d.ts +0 -1
- package/dist/src/testing/beforeEachFile.js +0 -7
- package/dist/src/testing/createEditor.d.ts +0 -4
- package/dist/src/testing/createEditor.js +0 -9
- package/dist/src/testing/lib.d.ts +0 -2
- package/dist/src/testing/lib.js +0 -2
- package/dist/src/testing/loadExpectExtensions.d.ts +0 -2
- package/dist/src/testing/loadExpectExtensions.js +0 -24
- package/dist/src/testing/sendPenEvent.d.ts +0 -12
- package/dist/src/testing/sendPenEvent.js +0 -19
- package/dist/src/testing/sendTouchEvent.d.ts +0 -42
- package/dist/src/testing/sendTouchEvent.js +0 -62
- package/dist/src/toolbar/HTMLToolbar.d.ts +0 -103
- package/dist/src/toolbar/HTMLToolbar.js +0 -376
- package/dist/src/toolbar/IconProvider.d.ts +0 -62
- package/dist/src/toolbar/IconProvider.js +0 -654
- package/dist/src/toolbar/lib.d.ts +0 -3
- package/dist/src/toolbar/lib.js +0 -3
- package/dist/src/toolbar/localization.d.ts +0 -49
- package/dist/src/toolbar/localization.js +0 -48
- package/dist/src/toolbar/makeColorInput.d.ts +0 -6
- package/dist/src/toolbar/makeColorInput.js +0 -113
- package/dist/src/toolbar/types.d.ts +0 -4
- package/dist/src/toolbar/types.js +0 -1
- package/dist/src/toolbar/widgets/ActionButtonWidget.d.ts +0 -15
- package/dist/src/toolbar/widgets/ActionButtonWidget.js +0 -25
- package/dist/src/toolbar/widgets/BaseToolWidget.d.ts +0 -11
- package/dist/src/toolbar/widgets/BaseToolWidget.js +0 -44
- package/dist/src/toolbar/widgets/BaseWidget.d.ts +0 -72
- package/dist/src/toolbar/widgets/BaseWidget.js +0 -307
- package/dist/src/toolbar/widgets/DocumentPropertiesWidget.d.ts +0 -18
- package/dist/src/toolbar/widgets/DocumentPropertiesWidget.js +0 -120
- package/dist/src/toolbar/widgets/EraserToolWidget.d.ts +0 -17
- package/dist/src/toolbar/widgets/EraserToolWidget.js +0 -57
- package/dist/src/toolbar/widgets/HandToolWidget.d.ts +0 -17
- package/dist/src/toolbar/widgets/HandToolWidget.js +0 -172
- package/dist/src/toolbar/widgets/InsertImageWidget.d.ts +0 -19
- package/dist/src/toolbar/widgets/InsertImageWidget.js +0 -170
- package/dist/src/toolbar/widgets/OverflowWidget.d.ts +0 -25
- package/dist/src/toolbar/widgets/OverflowWidget.js +0 -71
- package/dist/src/toolbar/widgets/PenToolWidget.d.ts +0 -27
- package/dist/src/toolbar/widgets/PenToolWidget.js +0 -220
- package/dist/src/toolbar/widgets/SelectionToolWidget.d.ts +0 -13
- package/dist/src/toolbar/widgets/SelectionToolWidget.js +0 -147
- package/dist/src/toolbar/widgets/TextToolWidget.d.ts +0 -16
- package/dist/src/toolbar/widgets/TextToolWidget.js +0 -109
- package/dist/src/toolbar/widgets/lib.d.ts +0 -10
- package/dist/src/toolbar/widgets/lib.js +0 -10
- package/dist/src/tools/BaseTool.d.ts +0 -22
- package/dist/src/tools/BaseTool.js +0 -63
- package/dist/src/tools/Eraser.d.ts +0 -23
- package/dist/src/tools/Eraser.js +0 -106
- package/dist/src/tools/FindTool.d.ts +0 -21
- package/dist/src/tools/FindTool.js +0 -114
- package/dist/src/tools/PanZoom.d.ts +0 -52
- package/dist/src/tools/PanZoom.js +0 -414
- package/dist/src/tools/PasteHandler.d.ts +0 -23
- package/dist/src/tools/PasteHandler.js +0 -93
- package/dist/src/tools/Pen.d.ts +0 -39
- package/dist/src/tools/Pen.js +0 -173
- package/dist/src/tools/PipetteTool.d.ts +0 -18
- package/dist/src/tools/PipetteTool.js +0 -39
- package/dist/src/tools/SelectionTool/SelectAllShortcutHandler.d.ts +0 -8
- package/dist/src/tools/SelectionTool/SelectAllShortcutHandler.js +0 -22
- package/dist/src/tools/SelectionTool/Selection.d.ts +0 -64
- package/dist/src/tools/SelectionTool/Selection.js +0 -459
- package/dist/src/tools/SelectionTool/SelectionHandle.d.ts +0 -38
- package/dist/src/tools/SelectionTool/SelectionHandle.js +0 -81
- package/dist/src/tools/SelectionTool/SelectionTool.d.ts +0 -36
- package/dist/src/tools/SelectionTool/SelectionTool.js +0 -398
- package/dist/src/tools/SelectionTool/TransformMode.d.ts +0 -34
- package/dist/src/tools/SelectionTool/TransformMode.js +0 -98
- package/dist/src/tools/SelectionTool/types.d.ts +0 -9
- package/dist/src/tools/SelectionTool/types.js +0 -11
- package/dist/src/tools/TextTool.d.ts +0 -33
- package/dist/src/tools/TextTool.js +0 -256
- package/dist/src/tools/ToolController.d.ts +0 -18
- package/dist/src/tools/ToolController.js +0 -158
- package/dist/src/tools/ToolEnabledGroup.d.ts +0 -6
- package/dist/src/tools/ToolEnabledGroup.js +0 -11
- package/dist/src/tools/ToolSwitcherShortcut.d.ts +0 -16
- package/dist/src/tools/ToolSwitcherShortcut.js +0 -32
- package/dist/src/tools/ToolbarShortcutHandler.d.ts +0 -12
- package/dist/src/tools/ToolbarShortcutHandler.js +0 -23
- package/dist/src/tools/UndoRedoShortcut.d.ts +0 -8
- package/dist/src/tools/UndoRedoShortcut.js +0 -22
- package/dist/src/tools/lib.d.ts +0 -16
- package/dist/src/tools/lib.js +0 -16
- package/dist/src/tools/localization.d.ts +0 -28
- package/dist/src/tools/localization.js +0 -27
- package/dist/src/types.d.ts +0 -151
- package/dist/src/types.js +0 -35
- package/dist/src/util/assertions.d.ts +0 -23
- package/dist/src/util/assertions.js +0 -45
- package/dist/src/util/fileToBase64.d.ts +0 -3
- package/dist/src/util/fileToBase64.js +0 -13
- package/dist/src/util/untilNextAnimationFrame.d.ts +0 -3
- package/dist/src/util/untilNextAnimationFrame.js +0 -7
- package/dist/src/util/waitForTimeout.d.ts +0 -2
- package/dist/src/util/waitForTimeout.js +0 -7
- package/src/Color4.test.ts +0 -40
- package/src/Color4.ts +0 -234
- package/src/Editor.css +0 -86
- package/src/Editor.loadFrom.test.ts +0 -24
- package/src/Editor.toSVG.test.ts +0 -111
- package/src/Editor.ts +0 -1122
- package/src/EditorImage.test.ts +0 -120
- package/src/EditorImage.ts +0 -603
- package/src/EventDispatcher.test.ts +0 -123
- package/src/EventDispatcher.ts +0 -71
- package/src/Pointer.ts +0 -127
- package/src/SVGLoader.test.ts +0 -114
- package/src/SVGLoader.ts +0 -511
- package/src/UndoRedoHistory.test.ts +0 -33
- package/src/UndoRedoHistory.ts +0 -102
- package/src/Viewport.ts +0 -319
- package/src/bundle/bundled.ts +0 -7
- package/src/commands/Command.ts +0 -45
- package/src/commands/Duplicate.ts +0 -48
- package/src/commands/Erase.ts +0 -74
- package/src/commands/SerializableCommand.ts +0 -49
- package/src/commands/UnresolvedCommand.ts +0 -37
- package/src/commands/invertCommand.ts +0 -51
- package/src/commands/lib.ts +0 -16
- package/src/commands/localization.ts +0 -47
- package/src/commands/uniteCommands.test.ts +0 -23
- package/src/commands/uniteCommands.ts +0 -135
- package/src/components/AbstractComponent.transformBy.test.ts +0 -22
- package/src/components/AbstractComponent.ts +0 -364
- package/src/components/ImageBackground.test.ts +0 -35
- package/src/components/ImageBackground.ts +0 -176
- package/src/components/ImageComponent.ts +0 -171
- package/src/components/RestylableComponent.ts +0 -142
- package/src/components/SVGGlobalAttributesObject.ts +0 -81
- package/src/components/Stroke.test.ts +0 -139
- package/src/components/Stroke.ts +0 -245
- package/src/components/TextComponent.test.ts +0 -99
- package/src/components/TextComponent.ts +0 -315
- package/src/components/UnknownSVGObject.test.ts +0 -10
- package/src/components/UnknownSVGObject.ts +0 -60
- package/src/components/builders/ArrowBuilder.ts +0 -107
- package/src/components/builders/FreehandLineBuilder.ts +0 -212
- package/src/components/builders/LineBuilder.ts +0 -77
- package/src/components/builders/PressureSensitiveFreehandLineBuilder.ts +0 -454
- package/src/components/builders/RectangleBuilder.ts +0 -74
- package/src/components/builders/types.ts +0 -15
- package/src/components/lib.ts +0 -25
- package/src/components/localization.ts +0 -22
- package/src/components/util/StrokeSmoother.ts +0 -293
- package/src/components/util/describeComponentList.ts +0 -18
- package/src/lib.ts +0 -37
- package/src/localization.ts +0 -34
- package/src/localizations/de.ts +0 -98
- package/src/localizations/en.ts +0 -8
- package/src/localizations/es.ts +0 -74
- package/src/localizations/getLocalizationTable.test.ts +0 -27
- package/src/localizations/getLocalizationTable.ts +0 -55
- package/src/math/LineSegment2.test.ts +0 -99
- package/src/math/LineSegment2.ts +0 -160
- package/src/math/Mat33.test.ts +0 -244
- package/src/math/Mat33.ts +0 -437
- package/src/math/Path.fromString.test.ts +0 -223
- package/src/math/Path.test.ts +0 -198
- package/src/math/Path.toString.test.ts +0 -77
- package/src/math/Path.ts +0 -790
- package/src/math/Rect2.test.ts +0 -204
- package/src/math/Rect2.ts +0 -315
- package/src/math/Triangle.ts +0 -29
- package/src/math/Vec2.test.ts +0 -30
- package/src/math/Vec2.ts +0 -18
- package/src/math/Vec3.test.ts +0 -44
- package/src/math/Vec3.ts +0 -218
- package/src/math/lib.ts +0 -15
- package/src/math/rounding.test.ts +0 -65
- package/src/math/rounding.ts +0 -156
- package/src/rendering/Display.ts +0 -249
- package/src/rendering/RenderingStyle.test.ts +0 -68
- package/src/rendering/RenderingStyle.ts +0 -55
- package/src/rendering/TextRenderingStyle.ts +0 -45
- package/src/rendering/caching/CacheRecord.test.ts +0 -49
- package/src/rendering/caching/CacheRecord.ts +0 -77
- package/src/rendering/caching/CacheRecordManager.ts +0 -71
- package/src/rendering/caching/RenderingCache.test.ts +0 -44
- package/src/rendering/caching/RenderingCache.ts +0 -66
- package/src/rendering/caching/RenderingCacheNode.ts +0 -405
- package/src/rendering/caching/testUtils.ts +0 -35
- package/src/rendering/caching/types.ts +0 -34
- package/src/rendering/lib.ts +0 -6
- package/src/rendering/localization.ts +0 -20
- package/src/rendering/renderers/AbstractRenderer.ts +0 -222
- package/src/rendering/renderers/CanvasRenderer.ts +0 -296
- package/src/rendering/renderers/DummyRenderer.test.ts +0 -42
- package/src/rendering/renderers/DummyRenderer.ts +0 -136
- package/src/rendering/renderers/SVGRenderer.ts +0 -354
- package/src/rendering/renderers/TextOnlyRenderer.ts +0 -70
- package/src/styles.js +0 -7
- package/src/testing/beforeEachFile.ts +0 -8
- package/src/testing/createEditor.ts +0 -11
- package/src/testing/global.d.ts +0 -17
- package/src/testing/lib.ts +0 -3
- package/src/testing/loadExpectExtensions.ts +0 -25
- package/src/testing/sendPenEvent.ts +0 -31
- package/src/testing/sendTouchEvent.ts +0 -78
- package/src/toolbar/HTMLToolbar.ts +0 -492
- package/src/toolbar/IconProvider.ts +0 -736
- package/src/toolbar/lib.ts +0 -4
- package/src/toolbar/localization.ts +0 -106
- package/src/toolbar/makeColorInput.ts +0 -145
- package/src/toolbar/toolbar.css +0 -213
- package/src/toolbar/types.ts +0 -5
- package/src/toolbar/widgets/ActionButtonWidget.ts +0 -39
- package/src/toolbar/widgets/BaseToolWidget.ts +0 -56
- package/src/toolbar/widgets/BaseWidget.ts +0 -377
- package/src/toolbar/widgets/DocumentPropertiesWidget.ts +0 -167
- package/src/toolbar/widgets/EraserToolWidget.ts +0 -85
- package/src/toolbar/widgets/HandToolWidget.ts +0 -250
- package/src/toolbar/widgets/InsertImageWidget.css +0 -44
- package/src/toolbar/widgets/InsertImageWidget.ts +0 -223
- package/src/toolbar/widgets/OverflowWidget.css +0 -27
- package/src/toolbar/widgets/OverflowWidget.ts +0 -92
- package/src/toolbar/widgets/PenToolWidget.ts +0 -288
- package/src/toolbar/widgets/SelectionToolWidget.ts +0 -190
- package/src/toolbar/widgets/TextToolWidget.ts +0 -145
- package/src/toolbar/widgets/lib.ts +0 -13
- package/src/tools/BaseTool.ts +0 -76
- package/src/tools/Eraser.test.ts +0 -103
- package/src/tools/Eraser.ts +0 -139
- package/src/tools/FindTool.css +0 -7
- package/src/tools/FindTool.ts +0 -152
- package/src/tools/PanZoom.test.ts +0 -310
- package/src/tools/PanZoom.ts +0 -520
- package/src/tools/PasteHandler.ts +0 -95
- package/src/tools/Pen.test.ts +0 -194
- package/src/tools/Pen.ts +0 -226
- package/src/tools/PipetteTool.ts +0 -55
- package/src/tools/SelectionTool/SelectAllShortcutHandler.ts +0 -28
- package/src/tools/SelectionTool/Selection.ts +0 -607
- package/src/tools/SelectionTool/SelectionHandle.ts +0 -108
- package/src/tools/SelectionTool/SelectionTool.css +0 -23
- package/src/tools/SelectionTool/SelectionTool.test.ts +0 -261
- package/src/tools/SelectionTool/SelectionTool.ts +0 -480
- package/src/tools/SelectionTool/TransformMode.ts +0 -114
- package/src/tools/SelectionTool/types.ts +0 -11
- package/src/tools/TextTool.ts +0 -326
- package/src/tools/ToolController.ts +0 -178
- package/src/tools/ToolEnabledGroup.ts +0 -14
- package/src/tools/ToolSwitcherShortcut.ts +0 -39
- package/src/tools/ToolbarShortcutHandler.ts +0 -34
- package/src/tools/UndoRedoShortcut.test.ts +0 -56
- package/src/tools/UndoRedoShortcut.ts +0 -25
- package/src/tools/lib.ts +0 -21
- package/src/tools/localization.ts +0 -66
- package/src/types.ts +0 -234
- package/src/util/assertions.ts +0 -55
- package/src/util/fileToBase64.ts +0 -18
- package/src/util/untilNextAnimationFrame.ts +0 -9
- package/src/util/waitForTimeout.ts +0 -9
package/dist/src/tools/Eraser.js
DELETED
@@ -1,106 +0,0 @@
|
|
1
|
-
import { EditorEventType } from '../types';
|
2
|
-
import BaseTool from './BaseTool';
|
3
|
-
import { Vec2 } from '../math/Vec2';
|
4
|
-
import LineSegment2 from '../math/LineSegment2';
|
5
|
-
import Erase from '../commands/Erase';
|
6
|
-
import { PointerDevice } from '../Pointer';
|
7
|
-
import Color4 from '../Color4';
|
8
|
-
import Rect2 from '../math/Rect2';
|
9
|
-
export default class Eraser extends BaseTool {
|
10
|
-
constructor(editor, description) {
|
11
|
-
super(editor.notifier, description);
|
12
|
-
this.editor = editor;
|
13
|
-
this.lastPoint = null;
|
14
|
-
this.isFirstEraseEvt = true;
|
15
|
-
this.thickness = 10;
|
16
|
-
// Commands that each remove one element
|
17
|
-
this.partialCommands = [];
|
18
|
-
}
|
19
|
-
clearPreview() {
|
20
|
-
this.editor.clearWetInk();
|
21
|
-
}
|
22
|
-
getSizeOnCanvas() {
|
23
|
-
return this.thickness / this.editor.viewport.getScaleFactor();
|
24
|
-
}
|
25
|
-
drawPreviewAt(point) {
|
26
|
-
this.clearPreview();
|
27
|
-
const size = this.getSizeOnCanvas();
|
28
|
-
const renderer = this.editor.display.getWetInkRenderer();
|
29
|
-
const rect = this.getEraserRect(point);
|
30
|
-
const fill = {
|
31
|
-
fill: Color4.gray,
|
32
|
-
};
|
33
|
-
renderer.drawRect(rect, size / 4, fill);
|
34
|
-
}
|
35
|
-
getEraserRect(centerPoint) {
|
36
|
-
const size = this.getSizeOnCanvas();
|
37
|
-
const halfSize = Vec2.of(size / 2, size / 2);
|
38
|
-
return Rect2.fromCorners(centerPoint.minus(halfSize), centerPoint.plus(halfSize));
|
39
|
-
}
|
40
|
-
eraseTo(currentPoint) {
|
41
|
-
if (!this.isFirstEraseEvt && currentPoint.minus(this.lastPoint).magnitude() === 0) {
|
42
|
-
return;
|
43
|
-
}
|
44
|
-
this.isFirstEraseEvt = false;
|
45
|
-
// Currently only objects within eraserRect or that intersect a straight line
|
46
|
-
// from the center of the current rect to the previous are erased. TODO: Erase
|
47
|
-
// all objects as if there were pointerMove events between the two points.
|
48
|
-
const eraserRect = this.getEraserRect(currentPoint);
|
49
|
-
const line = new LineSegment2(this.lastPoint, currentPoint);
|
50
|
-
const region = Rect2.union(line.bbox, eraserRect);
|
51
|
-
const intersectingElems = this.editor.image.getElementsIntersectingRegion(region).filter(component => {
|
52
|
-
return component.intersects(line) || component.intersectsRect(eraserRect);
|
53
|
-
});
|
54
|
-
// Only erase components that could be selected (and thus interacted with)
|
55
|
-
// by the user.
|
56
|
-
const toErase = intersectingElems.filter(elem => elem.isSelectable());
|
57
|
-
// Remove any intersecting elements.
|
58
|
-
this.toRemove.push(...toErase);
|
59
|
-
// Create new Erase commands for the now-to-be-erased elements and apply them.
|
60
|
-
const newPartialCommands = toErase.map(elem => new Erase([elem]));
|
61
|
-
newPartialCommands.forEach(cmd => cmd.apply(this.editor));
|
62
|
-
this.partialCommands.push(...newPartialCommands);
|
63
|
-
this.drawPreviewAt(currentPoint);
|
64
|
-
this.lastPoint = currentPoint;
|
65
|
-
}
|
66
|
-
onPointerDown(event) {
|
67
|
-
if (event.allPointers.length === 1 || event.current.device === PointerDevice.Eraser) {
|
68
|
-
this.lastPoint = event.current.canvasPos;
|
69
|
-
this.toRemove = [];
|
70
|
-
this.isFirstEraseEvt = true;
|
71
|
-
this.drawPreviewAt(event.current.canvasPos);
|
72
|
-
return true;
|
73
|
-
}
|
74
|
-
return false;
|
75
|
-
}
|
76
|
-
onPointerMove(event) {
|
77
|
-
const currentPoint = event.current.canvasPos;
|
78
|
-
this.eraseTo(currentPoint);
|
79
|
-
}
|
80
|
-
onPointerUp(event) {
|
81
|
-
this.eraseTo(event.current.canvasPos);
|
82
|
-
if (this.toRemove.length > 0) {
|
83
|
-
// Undo commands for each individual component and unite into a single command.
|
84
|
-
this.partialCommands.forEach(cmd => cmd.unapply(this.editor));
|
85
|
-
this.partialCommands = [];
|
86
|
-
const command = new Erase(this.toRemove);
|
87
|
-
this.editor.dispatch(command); // dispatch: Makes undo-able.
|
88
|
-
}
|
89
|
-
this.clearPreview();
|
90
|
-
}
|
91
|
-
onGestureCancel() {
|
92
|
-
this.partialCommands.forEach(cmd => cmd.unapply(this.editor));
|
93
|
-
this.partialCommands = [];
|
94
|
-
this.clearPreview();
|
95
|
-
}
|
96
|
-
getThickness() {
|
97
|
-
return this.thickness;
|
98
|
-
}
|
99
|
-
setThickness(thickness) {
|
100
|
-
this.thickness = thickness;
|
101
|
-
this.editor.notifier.dispatch(EditorEventType.ToolUpdated, {
|
102
|
-
kind: EditorEventType.ToolUpdated,
|
103
|
-
tool: this,
|
104
|
-
});
|
105
|
-
}
|
106
|
-
}
|
@@ -1,21 +0,0 @@
|
|
1
|
-
import Editor from '../Editor';
|
2
|
-
import { KeyPressEvent } from '../types';
|
3
|
-
import BaseTool from './BaseTool';
|
4
|
-
export declare const cssPrefix = "find-tool";
|
5
|
-
export default class FindTool extends BaseTool {
|
6
|
-
private editor;
|
7
|
-
private overlay;
|
8
|
-
private searchInput;
|
9
|
-
private currentMatchIdx;
|
10
|
-
constructor(editor: Editor);
|
11
|
-
private getMatches;
|
12
|
-
private focusCurrentMatch;
|
13
|
-
private toNextMatch;
|
14
|
-
private toPrevMatch;
|
15
|
-
private fillOverlay;
|
16
|
-
private isVisible;
|
17
|
-
private setVisible;
|
18
|
-
private toggleVisible;
|
19
|
-
onKeyPress(event: KeyPressEvent): boolean;
|
20
|
-
setEnabled(enabled: boolean): void;
|
21
|
-
}
|
@@ -1,114 +0,0 @@
|
|
1
|
-
// Displays a find dialog that allows the user to search for and focus text.
|
2
|
-
//
|
3
|
-
// @packageDocumentation
|
4
|
-
import TextComponent from '../components/TextComponent';
|
5
|
-
import BaseTool from './BaseTool';
|
6
|
-
export const cssPrefix = 'find-tool';
|
7
|
-
export default class FindTool extends BaseTool {
|
8
|
-
constructor(editor) {
|
9
|
-
super(editor.notifier, editor.localization.findLabel);
|
10
|
-
this.editor = editor;
|
11
|
-
this.currentMatchIdx = 0;
|
12
|
-
this.overlay = document.createElement('div');
|
13
|
-
this.fillOverlay();
|
14
|
-
editor.createHTMLOverlay(this.overlay);
|
15
|
-
this.overlay.style.display = 'none';
|
16
|
-
this.overlay.classList.add(`${cssPrefix}-overlay`);
|
17
|
-
}
|
18
|
-
getMatches(searchFor) {
|
19
|
-
searchFor = searchFor.toLocaleLowerCase();
|
20
|
-
const allTextComponents = this.editor.image.getAllElements()
|
21
|
-
.filter(elem => elem instanceof TextComponent);
|
22
|
-
const matches = allTextComponents.filter(text => text.getText().toLocaleLowerCase().indexOf(searchFor) !== -1);
|
23
|
-
return matches.map(match => match.getBBox());
|
24
|
-
}
|
25
|
-
focusCurrentMatch() {
|
26
|
-
const matches = this.getMatches(this.searchInput.value);
|
27
|
-
let matchIdx = this.currentMatchIdx % matches.length;
|
28
|
-
if (matchIdx < 0) {
|
29
|
-
matchIdx = matches.length + matchIdx;
|
30
|
-
}
|
31
|
-
if (matchIdx < matches.length) {
|
32
|
-
const undoable = false;
|
33
|
-
this.editor.dispatch(this.editor.viewport.zoomTo(matches[matchIdx], true, true), undoable);
|
34
|
-
this.editor.announceForAccessibility(this.editor.localization.focusedFoundText(matchIdx + 1, matches.length));
|
35
|
-
}
|
36
|
-
}
|
37
|
-
toNextMatch() {
|
38
|
-
this.currentMatchIdx++;
|
39
|
-
this.focusCurrentMatch();
|
40
|
-
}
|
41
|
-
toPrevMatch() {
|
42
|
-
this.currentMatchIdx--;
|
43
|
-
this.focusCurrentMatch();
|
44
|
-
}
|
45
|
-
fillOverlay() {
|
46
|
-
const label = document.createElement('label');
|
47
|
-
this.searchInput = document.createElement('input');
|
48
|
-
const nextBtn = document.createElement('button');
|
49
|
-
const closeBtn = document.createElement('button');
|
50
|
-
// Math.random() ensures that the ID is unique (to allow us to refer to it
|
51
|
-
// with an htmlFor).
|
52
|
-
this.searchInput.setAttribute('id', `${cssPrefix}-searchInput-${Math.random()}`);
|
53
|
-
label.htmlFor = this.searchInput.getAttribute('id');
|
54
|
-
label.innerText = this.editor.localization.findLabel;
|
55
|
-
nextBtn.innerText = this.editor.localization.toNextMatch;
|
56
|
-
closeBtn.innerText = this.editor.localization.closeFindDialog;
|
57
|
-
this.searchInput.onkeydown = (ev) => {
|
58
|
-
if (ev.key === 'Enter') {
|
59
|
-
if (ev.shiftKey) {
|
60
|
-
this.toPrevMatch();
|
61
|
-
}
|
62
|
-
else {
|
63
|
-
this.toNextMatch();
|
64
|
-
}
|
65
|
-
}
|
66
|
-
else if (ev.key === 'Escape') {
|
67
|
-
this.setVisible(false);
|
68
|
-
}
|
69
|
-
else if (ev.key === 'f' && ev.ctrlKey) {
|
70
|
-
ev.preventDefault();
|
71
|
-
this.toggleVisible();
|
72
|
-
}
|
73
|
-
};
|
74
|
-
nextBtn.onclick = () => {
|
75
|
-
this.toNextMatch();
|
76
|
-
};
|
77
|
-
closeBtn.onclick = () => {
|
78
|
-
this.setVisible(false);
|
79
|
-
};
|
80
|
-
this.overlay.replaceChildren(label, this.searchInput, nextBtn, closeBtn);
|
81
|
-
}
|
82
|
-
isVisible() {
|
83
|
-
return this.overlay.style.display !== 'none';
|
84
|
-
}
|
85
|
-
setVisible(visible) {
|
86
|
-
if (visible !== this.isVisible()) {
|
87
|
-
this.overlay.style.display = visible ? 'block' : 'none';
|
88
|
-
if (visible) {
|
89
|
-
this.searchInput.focus();
|
90
|
-
this.editor.announceForAccessibility(this.editor.localization.findDialogShown);
|
91
|
-
}
|
92
|
-
else {
|
93
|
-
this.editor.focus();
|
94
|
-
this.editor.announceForAccessibility(this.editor.localization.findDialogHidden);
|
95
|
-
}
|
96
|
-
}
|
97
|
-
}
|
98
|
-
toggleVisible() {
|
99
|
-
this.setVisible(!this.isVisible());
|
100
|
-
}
|
101
|
-
onKeyPress(event) {
|
102
|
-
if (event.ctrlKey && event.key === 'f') {
|
103
|
-
this.toggleVisible();
|
104
|
-
return true;
|
105
|
-
}
|
106
|
-
return false;
|
107
|
-
}
|
108
|
-
setEnabled(enabled) {
|
109
|
-
super.setEnabled(enabled);
|
110
|
-
if (enabled) {
|
111
|
-
this.setVisible(false);
|
112
|
-
}
|
113
|
-
}
|
114
|
-
}
|
@@ -1,52 +0,0 @@
|
|
1
|
-
import { Editor } from '../Editor';
|
2
|
-
import { Point2 } from '../math/Vec2';
|
3
|
-
import Pointer from '../Pointer';
|
4
|
-
import { KeyPressEvent, PointerEvt, WheelEvt } from '../types';
|
5
|
-
import BaseTool from './BaseTool';
|
6
|
-
interface PinchData {
|
7
|
-
canvasCenter: Point2;
|
8
|
-
screenCenter: Point2;
|
9
|
-
angle: number;
|
10
|
-
dist: number;
|
11
|
-
}
|
12
|
-
export declare enum PanZoomMode {
|
13
|
-
OneFingerTouchGestures = 1,
|
14
|
-
TwoFingerTouchGestures = 2,
|
15
|
-
RightClickDrags = 4,
|
16
|
-
SinglePointerGestures = 8,
|
17
|
-
Keyboard = 16,
|
18
|
-
RotationLocked = 32
|
19
|
-
}
|
20
|
-
export default class PanZoom extends BaseTool {
|
21
|
-
private editor;
|
22
|
-
private mode;
|
23
|
-
private transform;
|
24
|
-
private lastDist;
|
25
|
-
private lastScreenCenter;
|
26
|
-
private lastTimestamp;
|
27
|
-
private lastPointerDownTimestamp;
|
28
|
-
private initialTouchAngle;
|
29
|
-
private initialViewportRotation;
|
30
|
-
private inertialScroller;
|
31
|
-
private velocity;
|
32
|
-
constructor(editor: Editor, mode: PanZoomMode, description: string);
|
33
|
-
computePinchData(p1: Pointer, p2: Pointer): PinchData;
|
34
|
-
private allPointersAreOfType;
|
35
|
-
onPointerDown({ allPointers: pointers, current: currentPointer }: PointerEvt): boolean;
|
36
|
-
private updateVelocity;
|
37
|
-
private getCenterDelta;
|
38
|
-
private toSnappedRotationDelta;
|
39
|
-
private handleTwoFingerMove;
|
40
|
-
private handleOneFingerMove;
|
41
|
-
onPointerMove({ allPointers }: PointerEvt): void;
|
42
|
-
onPointerUp(event: PointerEvt): void;
|
43
|
-
onGestureCancel(): void;
|
44
|
-
private updateTransform;
|
45
|
-
onWheel({ delta, screenPos }: WheelEvt): boolean;
|
46
|
-
onKeyPress({ key, ctrlKey, altKey }: KeyPressEvent): boolean;
|
47
|
-
private isRotationLocked;
|
48
|
-
setModeEnabled(mode: PanZoomMode, enabled: boolean): void;
|
49
|
-
setMode(mode: PanZoomMode): void;
|
50
|
-
getMode(): PanZoomMode;
|
51
|
-
}
|
52
|
-
export {};
|