kritzel-stencil 0.0.130 → 0.0.132
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/dist/cjs/{index-CUSIflVf.js → index-nzUNdMPh.js} +47 -17
- package/dist/cjs/index-nzUNdMPh.js.map +1 -0
- package/dist/cjs/{index-CfXjPLHb.js → index-ouFX0OVi.js} +891 -802
- package/dist/cjs/index-ouFX0OVi.js.map +1 -0
- package/dist/cjs/index.cjs.js +2 -1
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/kritzel-brush-style.cjs.entry.js +32 -0
- package/dist/cjs/kritzel-brush-style.entry.cjs.js.map +1 -0
- package/dist/cjs/{kritzel-brush-style_23.cjs.entry.js → kritzel-color_22.cjs.entry.js} +1539 -1325
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/stencil.cjs.js +3 -3
- package/dist/cjs/stencil.cjs.js.map +1 -1
- package/dist/collection/classes/commands/add-object.command.js +7 -7
- package/dist/collection/classes/commands/add-object.command.js.map +1 -1
- package/dist/collection/classes/commands/add-selection-group.command.js +10 -9
- package/dist/collection/classes/commands/add-selection-group.command.js.map +1 -1
- package/dist/collection/classes/commands/base.command.js +6 -4
- package/dist/collection/classes/commands/base.command.js.map +1 -1
- package/dist/collection/classes/commands/batch.command.js +3 -2
- package/dist/collection/classes/commands/batch.command.js.map +1 -1
- package/dist/collection/classes/commands/move-selection-group.command.js +13 -7
- package/dist/collection/classes/commands/move-selection-group.command.js.map +1 -1
- package/dist/collection/classes/commands/remove-object.command.js +9 -9
- package/dist/collection/classes/commands/remove-object.command.js.map +1 -1
- package/dist/collection/classes/commands/remove-selection-group.command.js +8 -7
- package/dist/collection/classes/commands/remove-selection-group.command.js.map +1 -1
- package/dist/collection/classes/commands/resize-selection-group.command.js +10 -7
- package/dist/collection/classes/commands/resize-selection-group.command.js.map +1 -1
- package/dist/collection/classes/commands/rotate-selection-group.command.js +15 -12
- package/dist/collection/classes/commands/rotate-selection-group.command.js.map +1 -1
- package/dist/collection/classes/commands/update-object.command.js +7 -5
- package/dist/collection/classes/commands/update-object.command.js.map +1 -1
- package/dist/collection/classes/commands/update-viewport.command.js +13 -11
- package/dist/collection/classes/commands/update-viewport.command.js.map +1 -1
- package/dist/collection/classes/{store.class.js → core/core.class.js} +123 -147
- package/dist/collection/classes/core/core.class.js.map +1 -0
- package/dist/collection/classes/{database.class.js → core/database.class.js} +34 -25
- package/dist/collection/classes/core/database.class.js.map +1 -0
- package/dist/collection/classes/core/history.class.js +88 -0
- package/dist/collection/classes/core/history.class.js.map +1 -0
- package/dist/collection/classes/{reviver.class.js → core/reviver.class.js} +27 -22
- package/dist/collection/classes/core/reviver.class.js.map +1 -0
- package/dist/collection/classes/core/store.class.js +51 -0
- package/dist/collection/classes/core/store.class.js.map +1 -0
- package/dist/collection/classes/core/viewport.class.js +165 -0
- package/dist/collection/classes/core/viewport.class.js.map +1 -0
- package/dist/collection/classes/core/workspace.class.js +42 -0
- package/dist/collection/classes/core/workspace.class.js.map +1 -0
- package/dist/collection/classes/handlers/base.handler.js +4 -3
- package/dist/collection/classes/handlers/base.handler.js.map +1 -1
- package/dist/collection/classes/handlers/context-menu.handler.js +26 -21
- package/dist/collection/classes/handlers/context-menu.handler.js.map +1 -1
- package/dist/collection/classes/handlers/hover.handler.js +5 -5
- package/dist/collection/classes/handlers/hover.handler.js.map +1 -1
- package/dist/collection/classes/handlers/key.handler.js +38 -44
- package/dist/collection/classes/handlers/key.handler.js.map +1 -1
- package/dist/collection/classes/handlers/move.handler.js +40 -35
- package/dist/collection/classes/handlers/move.handler.js.map +1 -1
- package/dist/collection/classes/handlers/resize.handler.js +57 -60
- package/dist/collection/classes/handlers/resize.handler.js.map +1 -1
- package/dist/collection/classes/handlers/rotation.handler.js +55 -57
- package/dist/collection/classes/handlers/rotation.handler.js.map +1 -1
- package/dist/collection/classes/handlers/selection.handler.js +78 -75
- package/dist/collection/classes/handlers/selection.handler.js.map +1 -1
- package/dist/collection/classes/objects/base-object.class.js +49 -31
- package/dist/collection/classes/objects/base-object.class.js.map +1 -1
- package/dist/collection/classes/objects/custom-element.class.js +6 -5
- package/dist/collection/classes/objects/custom-element.class.js.map +1 -1
- package/dist/collection/classes/objects/image.class.js +17 -17
- package/dist/collection/classes/objects/image.class.js.map +1 -1
- package/dist/collection/classes/objects/path.class.js +36 -34
- package/dist/collection/classes/objects/path.class.js.map +1 -1
- package/dist/collection/classes/objects/selection-box.class.js +6 -9
- package/dist/collection/classes/objects/selection-box.class.js.map +1 -1
- package/dist/collection/classes/objects/selection-group.class.js +23 -22
- package/dist/collection/classes/objects/selection-group.class.js.map +1 -1
- package/dist/collection/classes/objects/text.class.js +23 -23
- package/dist/collection/classes/objects/text.class.js.map +1 -1
- package/dist/collection/classes/registries/icon-registry.class.js +1 -1
- package/dist/collection/classes/registries/icon-registry.class.js.map +1 -1
- package/dist/collection/classes/registries/tool.registry.js +3 -3
- package/dist/collection/classes/registries/tool.registry.js.map +1 -1
- package/dist/collection/classes/structures/circular-buffer.structure.js +5 -3
- package/dist/collection/classes/structures/circular-buffer.structure.js.map +1 -1
- package/dist/collection/classes/structures/object-map.structure.js +1 -0
- package/dist/collection/classes/structures/object-map.structure.js.map +1 -1
- package/dist/collection/classes/tools/base-tool.class.js +13 -6
- package/dist/collection/classes/tools/base-tool.class.js.map +1 -1
- package/dist/collection/classes/tools/brush-tool.class.js +64 -60
- package/dist/collection/classes/tools/brush-tool.class.js.map +1 -1
- package/dist/collection/classes/tools/eraser-tool.class.js +27 -28
- package/dist/collection/classes/tools/eraser-tool.class.js.map +1 -1
- package/dist/collection/classes/tools/image-tool.class.js +14 -15
- package/dist/collection/classes/tools/image-tool.class.js.map +1 -1
- package/dist/collection/classes/tools/selection-tool.class.js +48 -43
- package/dist/collection/classes/tools/selection-tool.class.js.map +1 -1
- package/dist/collection/classes/tools/text-tool.class.js +57 -58
- package/dist/collection/classes/tools/text-tool.class.js.map +1 -1
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/core/kritzel-cursor-trail/kritzel-cursor-trail.js +30 -30
- package/dist/collection/components/core/kritzel-cursor-trail/kritzel-cursor-trail.js.map +1 -1
- package/dist/collection/components/core/kritzel-editor/kritzel-editor.css +7 -9
- package/dist/collection/components/core/kritzel-editor/kritzel-editor.js +267 -93
- package/dist/collection/components/core/kritzel-editor/kritzel-editor.js.map +1 -1
- package/dist/collection/components/core/kritzel-engine/kritzel-engine.js +319 -327
- package/dist/collection/components/core/kritzel-engine/kritzel-engine.js.map +1 -1
- package/dist/collection/components/shared/kritzel-brush-style/kritzel-brush-style.js +7 -8
- package/dist/collection/components/shared/kritzel-brush-style/kritzel-brush-style.js.map +1 -1
- package/dist/collection/components/shared/kritzel-color/kritzel-color.js +4 -5
- package/dist/collection/components/shared/kritzel-color/kritzel-color.js.map +1 -1
- package/dist/collection/components/shared/kritzel-color-palette/kritzel-color-palette.css +5 -0
- package/dist/collection/components/shared/kritzel-color-palette/kritzel-color-palette.js +8 -9
- package/dist/collection/components/shared/kritzel-color-palette/kritzel-color-palette.js.map +1 -1
- package/dist/collection/components/shared/kritzel-dropdown/kritzel-dropdown.js +53 -49
- package/dist/collection/components/shared/kritzel-dropdown/kritzel-dropdown.js.map +1 -1
- package/dist/collection/components/shared/kritzel-font/kritzel-font.js +4 -6
- package/dist/collection/components/shared/kritzel-font/kritzel-font.js.map +1 -1
- package/dist/collection/components/shared/kritzel-font-family/kritzel-font-family.js +18 -18
- package/dist/collection/components/shared/kritzel-font-family/kritzel-font-family.js.map +1 -1
- package/dist/collection/components/shared/kritzel-font-size/kritzel-font-size.js +5 -6
- package/dist/collection/components/shared/kritzel-font-size/kritzel-font-size.js.map +1 -1
- package/dist/collection/components/shared/kritzel-icon/kritzel-icon.css +1 -0
- package/dist/collection/components/shared/kritzel-icon/kritzel-icon.js +3 -3
- package/dist/collection/components/shared/kritzel-icon/kritzel-icon.js.map +1 -1
- package/dist/collection/components/shared/kritzel-menu/kritzel-menu.css +6 -2
- package/dist/collection/components/shared/kritzel-menu/kritzel-menu.js +36 -30
- package/dist/collection/components/shared/kritzel-menu/kritzel-menu.js.map +1 -1
- package/dist/collection/components/shared/kritzel-menu-item/kritzel-menu-item.css +25 -7
- package/dist/collection/components/shared/kritzel-menu-item/kritzel-menu-item.js +61 -40
- package/dist/collection/components/shared/kritzel-menu-item/kritzel-menu-item.js.map +1 -1
- package/dist/collection/components/shared/kritzel-portal/kritzel-portal.js +22 -61
- package/dist/collection/components/shared/kritzel-portal/kritzel-portal.js.map +1 -1
- package/dist/collection/components/shared/kritzel-split-button/kritzel-split-button.css +16 -20
- package/dist/collection/components/shared/kritzel-split-button/kritzel-split-button.js +104 -53
- package/dist/collection/components/shared/kritzel-split-button/kritzel-split-button.js.map +1 -1
- package/dist/collection/components/shared/kritzel-stroke-size/kritzel-stroke-size.css +4 -0
- package/dist/collection/components/shared/kritzel-stroke-size/kritzel-stroke-size.js +4 -5
- package/dist/collection/components/shared/kritzel-stroke-size/kritzel-stroke-size.js.map +1 -1
- package/dist/collection/components/shared/kritzel-tooltip/kritzel-tooltip.js +85 -14
- package/dist/collection/components/shared/kritzel-tooltip/kritzel-tooltip.js.map +1 -1
- package/dist/collection/components/ui/kritzel-context-menu/kritzel-context-menu.js +50 -16
- package/dist/collection/components/ui/kritzel-context-menu/kritzel-context-menu.js.map +1 -1
- package/dist/collection/components/ui/kritzel-control-brush-config/kritzel-control-brush-config.css +4 -0
- package/dist/collection/components/ui/kritzel-control-brush-config/kritzel-control-brush-config.js +7 -7
- package/dist/collection/components/ui/kritzel-control-brush-config/kritzel-control-brush-config.js.map +1 -1
- package/dist/collection/components/ui/kritzel-control-text-config/kritzel-control-text-config.js +5 -5
- package/dist/collection/components/ui/kritzel-control-text-config/kritzel-control-text-config.js.map +1 -1
- package/dist/collection/components/ui/kritzel-controls/kritzel-controls.css +12 -1
- package/dist/collection/components/ui/kritzel-controls/kritzel-controls.js +41 -32
- package/dist/collection/components/ui/kritzel-controls/kritzel-controls.js.map +1 -1
- package/dist/collection/components/ui/kritzel-utility-panel/kritzel-utility-panel.css +5 -0
- package/dist/collection/components/ui/kritzel-utility-panel/kritzel-utility-panel.js +4 -1
- package/dist/collection/components/ui/kritzel-utility-panel/kritzel-utility-panel.js.map +1 -1
- package/dist/collection/components/ui/kritzel-workspace-manager/kritzel-workspace-manager.js +40 -28
- package/dist/collection/components/ui/kritzel-workspace-manager/kritzel-workspace-manager.js.map +1 -1
- package/dist/collection/configs/default-engine-state.js +0 -1
- package/dist/collection/configs/default-engine-state.js.map +1 -1
- package/dist/collection/helpers/devices.helper.js +20 -0
- package/dist/collection/helpers/devices.helper.js.map +1 -1
- package/dist/collection/helpers/event.helper.js +2 -6
- package/dist/collection/helpers/event.helper.js.map +1 -1
- package/dist/collection/helpers/html.helper.js +30 -2
- package/dist/collection/helpers/html.helper.js.map +1 -1
- package/dist/collection/helpers/object.helper.js +2 -14
- package/dist/collection/helpers/object.helper.js.map +1 -1
- package/dist/collection/index.js +1 -0
- package/dist/collection/index.js.map +1 -1
- package/dist/collection/interfaces/engine-state.interface.js.map +1 -1
- package/dist/collection/interfaces/serializable.interface.js.map +1 -1
- package/dist/collection/types/deep-readonly.type.js +2 -0
- package/dist/collection/types/deep-readonly.type.js.map +1 -0
- package/dist/components/index.js +4 -3
- package/dist/components/index.js.map +1 -1
- package/dist/components/kritzel-brush-style.js +59 -1
- package/dist/components/kritzel-brush-style.js.map +1 -1
- package/dist/components/kritzel-color-palette.js +1 -1
- package/dist/components/kritzel-color.js +1 -1
- package/dist/components/kritzel-context-menu.js +1 -1
- package/dist/components/kritzel-control-brush-config.js +1 -1
- package/dist/components/kritzel-control-text-config.js +1 -1
- package/dist/components/kritzel-controls.js +1 -1
- package/dist/components/kritzel-cursor-trail.js +1 -1
- package/dist/components/kritzel-dropdown.js +1 -1
- package/dist/components/kritzel-editor.js +172 -124
- package/dist/components/kritzel-editor.js.map +1 -1
- package/dist/components/kritzel-engine.js +1 -1
- package/dist/components/kritzel-font-family.js +1 -1
- package/dist/components/kritzel-font-size.js +1 -1
- package/dist/components/kritzel-font.js +1 -1
- package/dist/components/kritzel-icon.js +1 -1
- package/dist/components/kritzel-menu-item.js +1 -1
- package/dist/components/kritzel-menu.js +1 -1
- package/dist/components/kritzel-portal.js +1 -1
- package/dist/components/kritzel-split-button.js +1 -1
- package/dist/components/kritzel-stroke-size.js +1 -1
- package/dist/components/kritzel-tooltip.js +1 -1
- package/dist/components/kritzel-utility-panel.js +1 -1
- package/dist/components/kritzel-workspace-manager.js +1 -1
- package/dist/components/{p-BGccckxP.js → p-0iJh9Z6m.js} +9 -8
- package/dist/components/p-0iJh9Z6m.js.map +1 -0
- package/dist/components/{p-C9-70hiF.js → p-B3VQubt_.js} +268 -236
- package/dist/components/p-B3VQubt_.js.map +1 -0
- package/dist/components/{p-5CJxFNEE.js → p-B7kZ1_RH.js} +7 -6
- package/dist/components/p-B7kZ1_RH.js.map +1 -0
- package/dist/components/{p-Cb1IUD_g.js → p-B7w19kIk.js} +17 -27
- package/dist/components/p-B7w19kIk.js.map +1 -0
- package/dist/components/{p-BU2q3PRS.js → p-BGdsAz54.js} +31 -19
- package/dist/components/p-BGdsAz54.js.map +1 -0
- package/dist/components/{p-BZ-j_4CK.js → p-BM9IjvnD.js} +7 -7
- package/dist/components/p-BM9IjvnD.js.map +1 -0
- package/dist/components/{p-26poIWa_.js → p-BPsQrpzN.js} +47 -18
- package/dist/components/p-BPsQrpzN.js.map +1 -0
- package/dist/components/{p-BqrTPNyu.js → p-BYanlgdq.js} +41 -15
- package/dist/components/p-BYanlgdq.js.map +1 -0
- package/dist/components/{p-D_Uh-xv_.js → p-BiCgeOiJ.js} +60 -56
- package/dist/components/p-BiCgeOiJ.js.map +1 -0
- package/dist/components/{p-BcQWRzsB.js → p-C1-nvBx9.js} +42 -29
- package/dist/components/p-C1-nvBx9.js.map +1 -0
- package/dist/components/p-C6qB08BS.js +68 -0
- package/dist/components/p-C6qB08BS.js.map +1 -0
- package/dist/components/{p-jpGLgpoq.js → p-CTvJDYFQ.js} +26 -64
- package/dist/components/p-CTvJDYFQ.js.map +1 -0
- package/dist/components/{p-BAPUTr3K.js → p-CsyM5q2M.js} +13 -12
- package/dist/components/p-CsyM5q2M.js.map +1 -0
- package/dist/components/p-CvmWmUK9.js +149 -0
- package/dist/components/p-CvmWmUK9.js.map +1 -0
- package/dist/components/{p-fyfT6A5K.js → p-DCx3703u.js} +9 -6
- package/dist/components/p-DCx3703u.js.map +1 -0
- package/dist/components/{p-BvlGgLAQ.js → p-DFO-6kuA.js} +57 -51
- package/dist/components/p-DFO-6kuA.js.map +1 -0
- package/dist/components/p-D_907-Wd.js +267 -0
- package/dist/components/p-D_907-Wd.js.map +1 -0
- package/dist/components/{p-jGaWxggY.js → p-Davd1R_4.js} +1278 -1227
- package/dist/components/p-Davd1R_4.js.map +1 -0
- package/dist/components/{p-DtmZW6eP.js → p-Db3kxVe2.js} +27 -25
- package/dist/components/p-Db3kxVe2.js.map +1 -0
- package/dist/components/{p-_ntxNi8v.js → p-Ddlbt3Bj.js} +22 -20
- package/dist/components/p-Ddlbt3Bj.js.map +1 -0
- package/dist/components/{p-Crni2OI4.js → p-DjU7p3od.js} +15 -13
- package/dist/components/p-DjU7p3od.js.map +1 -0
- package/dist/components/p-EXPChOF6.js +30 -0
- package/dist/components/p-EXPChOF6.js.map +1 -0
- package/dist/components/p-YqK8ch2R.js +46 -0
- package/dist/components/p-YqK8ch2R.js.map +1 -0
- package/dist/components/p-l10It7Nm.js +30 -0
- package/dist/components/p-l10It7Nm.js.map +1 -0
- package/dist/components/{p-BLmFBe2a.js → p-sq9jgfX0.js} +8 -6
- package/dist/components/p-sq9jgfX0.js.map +1 -0
- package/dist/components/{p-BcQTDgzV.js → p-sreNwi0N.js} +9 -8
- package/dist/components/p-sreNwi0N.js.map +1 -0
- package/dist/esm/{index-DqqxAoZI.js → index-C_uHp-ur.js} +891 -803
- package/dist/esm/index-C_uHp-ur.js.map +1 -0
- package/dist/esm/{index-NiIEUDzj.js → index-oCOlsFCN.js} +47 -17
- package/dist/esm/index-oCOlsFCN.js.map +1 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/kritzel-brush-style.entry.js +30 -0
- package/dist/esm/kritzel-brush-style.entry.js.map +1 -0
- package/dist/esm/{kritzel-brush-style_23.entry.js → kritzel-color_22.entry.js} +1538 -1323
- package/dist/esm/loader.js +3 -3
- package/dist/esm/stencil.js +4 -4
- package/dist/esm/stencil.js.map +1 -1
- package/dist/stencil/index.esm.js +1 -1
- package/dist/stencil/kritzel-brush-style.entry.esm.js.map +1 -0
- package/dist/stencil/p-25d1e040.entry.js +2 -0
- package/dist/stencil/p-25d1e040.entry.js.map +1 -0
- package/dist/stencil/p-C_uHp-ur.js +2 -0
- package/dist/stencil/p-C_uHp-ur.js.map +1 -0
- package/dist/stencil/p-a6f8283e.entry.js +2 -0
- package/dist/stencil/p-a6f8283e.entry.js.map +1 -0
- package/dist/stencil/p-oCOlsFCN.js +3 -0
- package/dist/stencil/p-oCOlsFCN.js.map +1 -0
- package/dist/stencil/stencil.esm.js +1 -1
- package/dist/stencil/stencil.esm.js.map +1 -1
- package/dist/types/classes/commands/add-object.command.d.ts +2 -2
- package/dist/types/classes/commands/add-selection-group.command.d.ts +2 -1
- package/dist/types/classes/commands/base.command.d.ts +3 -3
- package/dist/types/classes/commands/batch.command.d.ts +2 -1
- package/dist/types/classes/commands/move-selection-group.command.d.ts +2 -1
- package/dist/types/classes/commands/remove-object.command.d.ts +2 -2
- package/dist/types/classes/commands/remove-selection-group.command.d.ts +2 -2
- package/dist/types/classes/commands/resize-selection-group.command.d.ts +2 -1
- package/dist/types/classes/commands/rotate-selection-group.command.d.ts +2 -1
- package/dist/types/classes/commands/update-object.command.d.ts +2 -2
- package/dist/types/classes/commands/update-viewport.command.d.ts +2 -1
- package/dist/types/classes/{store.class.d.ts → core/core.class.d.ts} +9 -19
- package/dist/types/classes/{database.class.d.ts → core/database.class.d.ts} +3 -2
- package/dist/types/classes/{history.class.d.ts → core/history.class.d.ts} +5 -5
- package/dist/types/classes/core/reviver.class.d.ts +6 -0
- package/dist/types/classes/core/store.class.d.ts +17 -0
- package/dist/types/classes/{viewport.class.d.ts → core/viewport.class.d.ts} +3 -3
- package/dist/types/classes/core/workspace.class.d.ts +24 -0
- package/dist/types/classes/handlers/base.handler.d.ts +3 -3
- package/dist/types/classes/handlers/context-menu.handler.d.ts +2 -2
- package/dist/types/classes/handlers/hover.handler.d.ts +2 -2
- package/dist/types/classes/handlers/key.handler.d.ts +2 -2
- package/dist/types/classes/handlers/move.handler.d.ts +2 -2
- package/dist/types/classes/handlers/resize.handler.d.ts +2 -2
- package/dist/types/classes/handlers/rotation.handler.d.ts +2 -2
- package/dist/types/classes/handlers/selection.handler.d.ts +2 -2
- package/dist/types/classes/objects/base-object.class.d.ts +5 -4
- package/dist/types/classes/objects/custom-element.class.d.ts +2 -2
- package/dist/types/classes/objects/image.class.d.ts +2 -2
- package/dist/types/classes/objects/path.class.d.ts +2 -4
- package/dist/types/classes/objects/selection-box.class.d.ts +2 -2
- package/dist/types/classes/objects/selection-group.class.d.ts +2 -2
- package/dist/types/classes/objects/text.class.d.ts +2 -2
- package/dist/types/classes/registries/tool.registry.d.ts +2 -2
- package/dist/types/classes/tools/base-tool.class.d.ts +8 -4
- package/dist/types/classes/tools/brush-tool.class.d.ts +2 -2
- package/dist/types/classes/tools/eraser-tool.class.d.ts +2 -2
- package/dist/types/classes/tools/image-tool.class.d.ts +2 -2
- package/dist/types/classes/tools/selection-tool.class.d.ts +2 -2
- package/dist/types/classes/tools/text-tool.class.d.ts +2 -2
- package/dist/types/components/core/kritzel-cursor-trail/kritzel-cursor-trail.d.ts +5 -5
- package/dist/types/components/core/kritzel-editor/kritzel-editor.d.ts +13 -3
- package/dist/types/components/core/kritzel-engine/kritzel-engine.d.ts +21 -22
- package/dist/types/components/shared/kritzel-dropdown/kritzel-dropdown.d.ts +2 -2
- package/dist/types/components/shared/kritzel-menu-item/kritzel-menu-item.d.ts +2 -0
- package/dist/types/components/shared/kritzel-portal/kritzel-portal.d.ts +0 -1
- package/dist/types/components/shared/kritzel-split-button/kritzel-split-button.d.ts +4 -2
- package/dist/types/components/shared/kritzel-tooltip/kritzel-tooltip.d.ts +8 -2
- package/dist/types/components/ui/kritzel-context-menu/kritzel-context-menu.d.ts +5 -3
- package/dist/types/components/ui/kritzel-control-brush-config/kritzel-control-brush-config.d.ts +1 -1
- package/dist/types/components/ui/kritzel-controls/kritzel-controls.d.ts +3 -1
- package/dist/types/components/ui/kritzel-workspace-manager/kritzel-workspace-manager.d.ts +3 -2
- package/dist/types/components.d.ts +41 -12
- package/dist/types/helpers/devices.helper.d.ts +4 -0
- package/dist/types/helpers/event.helper.d.ts +1 -1
- package/dist/types/helpers/html.helper.d.ts +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/interfaces/engine-state.interface.d.ts +1 -2
- package/dist/types/interfaces/serializable.interface.d.ts +2 -1
- package/dist/types/stencil-public-runtime.d.ts +6 -4
- package/dist/types/types/deep-readonly.type.d.ts +7 -0
- package/package.json +64 -63
- package/dist/cjs/index-CUSIflVf.js.map +0 -1
- package/dist/cjs/index-CfXjPLHb.js.map +0 -1
- package/dist/collection/classes/database.class.js.map +0 -1
- package/dist/collection/classes/history.class.js +0 -84
- package/dist/collection/classes/history.class.js.map +0 -1
- package/dist/collection/classes/reviver.class.js.map +0 -1
- package/dist/collection/classes/store.class.js.map +0 -1
- package/dist/collection/classes/viewport.class.js +0 -152
- package/dist/collection/classes/viewport.class.js.map +0 -1
- package/dist/collection/classes/workspace.class.js +0 -10
- package/dist/collection/classes/workspace.class.js.map +0 -1
- package/dist/components/p-26poIWa_.js.map +0 -1
- package/dist/components/p-5CJxFNEE.js.map +0 -1
- package/dist/components/p-BAPUTr3K.js.map +0 -1
- package/dist/components/p-BGccckxP.js.map +0 -1
- package/dist/components/p-BLmFBe2a.js.map +0 -1
- package/dist/components/p-BU2q3PRS.js.map +0 -1
- package/dist/components/p-BZ-j_4CK.js.map +0 -1
- package/dist/components/p-Bb6od8He.js +0 -42
- package/dist/components/p-Bb6od8He.js.map +0 -1
- package/dist/components/p-BcQTDgzV.js.map +0 -1
- package/dist/components/p-BcQWRzsB.js.map +0 -1
- package/dist/components/p-BeVv4o5c.js +0 -14
- package/dist/components/p-BeVv4o5c.js.map +0 -1
- package/dist/components/p-BqrTPNyu.js.map +0 -1
- package/dist/components/p-BvlGgLAQ.js.map +0 -1
- package/dist/components/p-C-DqsDXz.js +0 -238
- package/dist/components/p-C-DqsDXz.js.map +0 -1
- package/dist/components/p-C9-70hiF.js.map +0 -1
- package/dist/components/p-CJKA5zIE.js +0 -10
- package/dist/components/p-CJKA5zIE.js.map +0 -1
- package/dist/components/p-CaPdvVd4.js +0 -127
- package/dist/components/p-CaPdvVd4.js.map +0 -1
- package/dist/components/p-Cb1IUD_g.js.map +0 -1
- package/dist/components/p-Crni2OI4.js.map +0 -1
- package/dist/components/p-D_Uh-xv_.js.map +0 -1
- package/dist/components/p-DtmZW6eP.js.map +0 -1
- package/dist/components/p-V4ui5aWj.js +0 -63
- package/dist/components/p-V4ui5aWj.js.map +0 -1
- package/dist/components/p-_ntxNi8v.js.map +0 -1
- package/dist/components/p-fyfT6A5K.js.map +0 -1
- package/dist/components/p-jGaWxggY.js.map +0 -1
- package/dist/components/p-jpGLgpoq.js.map +0 -1
- package/dist/esm/index-DqqxAoZI.js.map +0 -1
- package/dist/esm/index-NiIEUDzj.js.map +0 -1
- package/dist/stencil/p-DqqxAoZI.js +0 -2
- package/dist/stencil/p-DqqxAoZI.js.map +0 -1
- package/dist/stencil/p-NiIEUDzj.js +0 -3
- package/dist/stencil/p-NiIEUDzj.js.map +0 -1
- package/dist/stencil/p-eebdbf65.entry.js +0 -2
- package/dist/stencil/p-eebdbf65.entry.js.map +0 -1
- package/dist/types/classes/reviver.class.d.ts +0 -6
- package/dist/types/classes/workspace.class.d.ts +0 -16
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { O as ObjectHelper } from './p-Bb6od8He.js';
|
|
2
1
|
import { K as KritzelMouseButton } from './p-D8W6LE-c.js';
|
|
2
|
+
import { O as ObjectHelper } from './p-EXPChOF6.js';
|
|
3
3
|
|
|
4
4
|
class KritzelBaseCommand {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
_core;
|
|
6
|
+
initiator;
|
|
7
|
+
skipHistory;
|
|
8
|
+
constructor(core, initiator, skipHistory = false) {
|
|
9
|
+
this._core = core;
|
|
10
|
+
this.initiator = initiator?.constructor?.name ?? 'Unknown';
|
|
9
11
|
this.skipHistory = skipHistory;
|
|
10
12
|
}
|
|
11
13
|
execute() {
|
|
@@ -17,8 +19,11 @@ class KritzelBaseCommand {
|
|
|
17
19
|
}
|
|
18
20
|
|
|
19
21
|
class UpdateObjectCommand extends KritzelBaseCommand {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
+
object;
|
|
23
|
+
updatedProperties;
|
|
24
|
+
previousProperties;
|
|
25
|
+
constructor(core, initiator, object, updatedProperties, skipHistory = false) {
|
|
26
|
+
super(core, initiator, skipHistory);
|
|
22
27
|
this.object = object;
|
|
23
28
|
this.updatedProperties = updatedProperties;
|
|
24
29
|
this.previousProperties = {};
|
|
@@ -34,7 +39,7 @@ class UpdateObjectCommand extends KritzelBaseCommand {
|
|
|
34
39
|
this.object[key] = this.updatedProperties[key];
|
|
35
40
|
}
|
|
36
41
|
}
|
|
37
|
-
this.
|
|
42
|
+
this._core.updateObjectInDatabase(this.object);
|
|
38
43
|
}
|
|
39
44
|
undo() {
|
|
40
45
|
for (const key in this.previousProperties) {
|
|
@@ -42,13 +47,14 @@ class UpdateObjectCommand extends KritzelBaseCommand {
|
|
|
42
47
|
this.object[key] = this.previousProperties[key];
|
|
43
48
|
}
|
|
44
49
|
}
|
|
45
|
-
this.
|
|
50
|
+
this._core.updateObjectInDatabase(this.object);
|
|
46
51
|
}
|
|
47
52
|
}
|
|
48
53
|
|
|
49
54
|
class KritzelToolRegistry {
|
|
50
|
-
static
|
|
51
|
-
|
|
55
|
+
static registry = {};
|
|
56
|
+
static registerTool(toolName, constructor, core) {
|
|
57
|
+
const toolInstance = new constructor(core);
|
|
52
58
|
toolInstance.name = toolName;
|
|
53
59
|
this.registry[toolName] = toolInstance;
|
|
54
60
|
return toolInstance;
|
|
@@ -62,13 +68,13 @@ class KritzelToolRegistry {
|
|
|
62
68
|
return toolInstance;
|
|
63
69
|
}
|
|
64
70
|
}
|
|
65
|
-
KritzelToolRegistry.registry = {};
|
|
66
71
|
|
|
67
72
|
class KritzelBaseTool {
|
|
68
|
-
constructor
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
73
|
+
__class__ = this.constructor.name;
|
|
74
|
+
name = 'base-tool';
|
|
75
|
+
_core;
|
|
76
|
+
constructor(core) {
|
|
77
|
+
this._core = core;
|
|
72
78
|
}
|
|
73
79
|
onActivate() {
|
|
74
80
|
// default implementation
|
|
@@ -88,24 +94,31 @@ class KritzelBaseTool {
|
|
|
88
94
|
handleWheel(_event) {
|
|
89
95
|
// default implementation
|
|
90
96
|
}
|
|
91
|
-
|
|
97
|
+
serialize() {
|
|
98
|
+
return {
|
|
99
|
+
__class__: this.__class__,
|
|
100
|
+
name: this.name,
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
deserialize(object) {
|
|
92
104
|
Object.assign(this, object);
|
|
93
105
|
return this;
|
|
94
106
|
}
|
|
95
107
|
}
|
|
96
108
|
|
|
97
109
|
class AddObjectCommand extends KritzelBaseCommand {
|
|
98
|
-
|
|
99
|
-
|
|
110
|
+
object;
|
|
111
|
+
constructor(core, initiator, object, skipHistory = false) {
|
|
112
|
+
super(core, initiator, skipHistory);
|
|
100
113
|
this.object = object;
|
|
101
114
|
}
|
|
102
115
|
execute() {
|
|
103
|
-
this.
|
|
104
|
-
this.
|
|
116
|
+
this._core.store.state.objectsMap.insert(this.object);
|
|
117
|
+
this._core.addObjectToDatabase(this.object);
|
|
105
118
|
}
|
|
106
119
|
undo() {
|
|
107
|
-
this.
|
|
108
|
-
this.
|
|
120
|
+
this._core.store.state.objectsMap.remove(object => object.id === this.object.id);
|
|
121
|
+
this._core.deleteObjectFromDatabase(this.object.id);
|
|
109
122
|
}
|
|
110
123
|
}
|
|
111
124
|
|
|
@@ -124,11 +137,7 @@ class KritzelEventHelper {
|
|
|
124
137
|
const contextMenu = path.find(element => element.classList && element.classList.contains('context-menu'));
|
|
125
138
|
return !!contextMenu;
|
|
126
139
|
}
|
|
127
|
-
static
|
|
128
|
-
if (event.pointerType !== 'touch') {
|
|
129
|
-
onCancel === null || onCancel === void 0 ? void 0 : onCancel();
|
|
130
|
-
return () => { };
|
|
131
|
-
}
|
|
140
|
+
static onLongPress(event, onSuccess, onCancel) {
|
|
132
141
|
const longPressTimeout = 400;
|
|
133
142
|
const moveThreshold = 10;
|
|
134
143
|
const startX = event.clientX;
|
|
@@ -141,7 +150,7 @@ class KritzelEventHelper {
|
|
|
141
150
|
const cancel = () => {
|
|
142
151
|
clearTimeout(timer);
|
|
143
152
|
removeListeners();
|
|
144
|
-
onCancel
|
|
153
|
+
onCancel?.();
|
|
145
154
|
};
|
|
146
155
|
const onPointerMove = (e) => {
|
|
147
156
|
if (Math.abs(e.clientX - startX) > moveThreshold || Math.abs(e.clientY - startY) > moveThreshold) {
|
|
@@ -216,28 +225,28 @@ class KritzelKeyboardHelper {
|
|
|
216
225
|
}
|
|
217
226
|
|
|
218
227
|
class KritzelTextTool extends KritzelBaseTool {
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
228
|
+
fontFamily = 'Arial';
|
|
229
|
+
fontSize = 16;
|
|
230
|
+
fontColor = '#000000';
|
|
231
|
+
palette = [
|
|
232
|
+
'#000000',
|
|
233
|
+
'#FFFFFF',
|
|
234
|
+
'#FF0000',
|
|
235
|
+
'#00FF00',
|
|
236
|
+
'#0000FF',
|
|
237
|
+
'#FFFF00',
|
|
238
|
+
'#FF00FF',
|
|
239
|
+
'#00FFFF',
|
|
240
|
+
'#808080',
|
|
241
|
+
'#C0C0C0',
|
|
242
|
+
'#800000',
|
|
243
|
+
'#008000',
|
|
244
|
+
'#000080',
|
|
245
|
+
'#808000',
|
|
246
|
+
'#800080',
|
|
247
|
+
];
|
|
248
|
+
constructor(core) {
|
|
249
|
+
super(core);
|
|
241
250
|
}
|
|
242
251
|
handlePointerDown(event) {
|
|
243
252
|
if (event.cancelable) {
|
|
@@ -246,80 +255,79 @@ class KritzelTextTool extends KritzelBaseTool {
|
|
|
246
255
|
if (event.pointerType === 'mouse') {
|
|
247
256
|
const path = event.composedPath().slice(1);
|
|
248
257
|
const objectElement = path.find(element => element.classList && element.classList.contains('object'));
|
|
249
|
-
const object = this.
|
|
250
|
-
if (this.
|
|
251
|
-
this.
|
|
258
|
+
const object = this._core.findObjectById(objectElement?.id);
|
|
259
|
+
if (this._core.store.state.activeText === null && object && object instanceof KritzelText) {
|
|
260
|
+
this._core.store.setState('activeText', object);
|
|
252
261
|
object.focus();
|
|
253
262
|
return;
|
|
254
263
|
}
|
|
255
|
-
if (this.
|
|
264
|
+
if (this._core.store.state.activeText !== null && object instanceof KritzelText) {
|
|
256
265
|
object.focus();
|
|
257
266
|
return;
|
|
258
267
|
}
|
|
259
|
-
if (this.
|
|
260
|
-
this.
|
|
261
|
-
this.
|
|
268
|
+
if (this._core.store.state.activeText !== null) {
|
|
269
|
+
this._core.resetActiveText();
|
|
270
|
+
this._core.store.setState('activeTool', KritzelToolRegistry.getTool('selection'));
|
|
262
271
|
return;
|
|
263
272
|
}
|
|
264
273
|
if (KritzelEventHelper.isLeftClick(event) === false) {
|
|
265
274
|
return;
|
|
266
275
|
}
|
|
267
|
-
const clientX = event.clientX - this.
|
|
268
|
-
const clientY = event.clientY - this.
|
|
269
|
-
const text = KritzelText.create(this.
|
|
276
|
+
const clientX = event.clientX - this._core.store.offsetX;
|
|
277
|
+
const clientY = event.clientY - this._core.store.offsetY;
|
|
278
|
+
const text = KritzelText.create(this._core, this.fontSize, this.fontFamily);
|
|
270
279
|
text.fontColor = this.fontColor;
|
|
271
|
-
text.translateX = (clientX - this.
|
|
272
|
-
text.translateY = (clientY - this.
|
|
273
|
-
text.zIndex = this.
|
|
274
|
-
this.
|
|
275
|
-
this.
|
|
280
|
+
text.translateX = (clientX - this._core.store.state.translateX) / this._core.store.state.scale;
|
|
281
|
+
text.translateY = (clientY - this._core.store.state.translateY) / this._core.store.state.scale;
|
|
282
|
+
text.zIndex = this._core.store.currentZIndex;
|
|
283
|
+
this._core.store.setState('activeText', text);
|
|
284
|
+
this._core.history.executeCommand(new AddObjectCommand(this._core, this, text));
|
|
276
285
|
}
|
|
277
286
|
if (event.pointerType === 'touch') {
|
|
278
|
-
const activePointers = Array.from(this.
|
|
287
|
+
const activePointers = Array.from(this._core.store.state.pointers.values());
|
|
279
288
|
const path = event.composedPath().slice(1);
|
|
280
289
|
const objectElement = path.find(element => element.classList && element.classList.contains('object'));
|
|
281
|
-
const object = this.
|
|
282
|
-
if (this.
|
|
283
|
-
this.
|
|
290
|
+
const object = this._core.findObjectById(objectElement?.id);
|
|
291
|
+
if (this._core.store.state.activeText === null && object && object instanceof KritzelText) {
|
|
292
|
+
this._core.store.setState('activeText', object);
|
|
284
293
|
object.focus();
|
|
285
294
|
return;
|
|
286
295
|
}
|
|
287
|
-
if (this.
|
|
296
|
+
if (this._core.store.state.activeText !== null && object instanceof KritzelText) {
|
|
288
297
|
object.focus();
|
|
289
298
|
return;
|
|
290
299
|
}
|
|
291
|
-
if (this.
|
|
292
|
-
this.
|
|
293
|
-
this.
|
|
300
|
+
if (this._core.store.state.activeText !== null) {
|
|
301
|
+
this._core.resetActiveText();
|
|
302
|
+
this._core.store.setState('activeTool', KritzelToolRegistry.getTool('selection'));
|
|
294
303
|
return;
|
|
295
304
|
}
|
|
296
305
|
if (activePointers.length > 1) {
|
|
297
306
|
return;
|
|
298
307
|
}
|
|
299
308
|
KritzelKeyboardHelper.disableInteractiveWidget();
|
|
300
|
-
const clientX = Math.round(activePointers[0].clientX - this.
|
|
301
|
-
const clientY = Math.round(activePointers[0].clientY - this.
|
|
302
|
-
const text = KritzelText.create(this.
|
|
309
|
+
const clientX = Math.round(activePointers[0].clientX - this._core.store.offsetX);
|
|
310
|
+
const clientY = Math.round(activePointers[0].clientY - this._core.store.offsetY);
|
|
311
|
+
const text = KritzelText.create(this._core, this.fontSize, this.fontFamily);
|
|
303
312
|
text.fontColor = this.fontColor;
|
|
304
|
-
text.translateX = (clientX - this.
|
|
305
|
-
text.translateY = (clientY - this.
|
|
306
|
-
text.zIndex = this.
|
|
307
|
-
this.
|
|
308
|
-
this.
|
|
313
|
+
text.translateX = (clientX - this._core.store.state.translateX) / this._core.store.state.scale;
|
|
314
|
+
text.translateY = (clientY - this._core.store.state.translateY) / this._core.store.state.scale;
|
|
315
|
+
text.zIndex = this._core.store.currentZIndex;
|
|
316
|
+
this._core.store.setState('activeText', text);
|
|
317
|
+
this._core.history.executeCommand(new AddObjectCommand(this._core, this, text));
|
|
309
318
|
}
|
|
310
319
|
}
|
|
311
320
|
handlePointerUp(event) {
|
|
312
|
-
var _a, _b, _c, _d;
|
|
313
321
|
if (event.cancelable) {
|
|
314
322
|
event.preventDefault();
|
|
315
323
|
}
|
|
316
324
|
if (event.pointerType === 'mouse') {
|
|
317
|
-
|
|
318
|
-
|
|
325
|
+
this._core.store.state.activeText?.updateTextareaDimensions();
|
|
326
|
+
this._core.store.state.activeText?.focus();
|
|
319
327
|
}
|
|
320
328
|
if (event.pointerType === 'touch') {
|
|
321
|
-
|
|
322
|
-
|
|
329
|
+
this._core.store.state.activeText?.updateTextareaDimensions();
|
|
330
|
+
this._core.store.state.activeText?.focus();
|
|
323
331
|
KritzelKeyboardHelper.enableInteractiveWidget();
|
|
324
332
|
}
|
|
325
333
|
}
|
|
@@ -379,6 +387,34 @@ class KritzelGeometryHelper {
|
|
|
379
387
|
}
|
|
380
388
|
|
|
381
389
|
class KritzelBaseObject {
|
|
390
|
+
__class__ = 'KritzelBaseObject';
|
|
391
|
+
_core;
|
|
392
|
+
_elementRef;
|
|
393
|
+
id;
|
|
394
|
+
workspaceId;
|
|
395
|
+
x;
|
|
396
|
+
y;
|
|
397
|
+
translateX;
|
|
398
|
+
translateY;
|
|
399
|
+
height;
|
|
400
|
+
width;
|
|
401
|
+
backgroundColor;
|
|
402
|
+
borderColor;
|
|
403
|
+
borderWidth = 0;
|
|
404
|
+
opacity = 1;
|
|
405
|
+
padding = 0;
|
|
406
|
+
scale;
|
|
407
|
+
resizing = false;
|
|
408
|
+
rotation = 0;
|
|
409
|
+
markedForRemoval = false;
|
|
410
|
+
zIndex = 0;
|
|
411
|
+
isVisible = true;
|
|
412
|
+
isSelected = false;
|
|
413
|
+
isHovered = false;
|
|
414
|
+
isMounted = false;
|
|
415
|
+
isEditable = false;
|
|
416
|
+
isInteractive = false;
|
|
417
|
+
isDebugInfoVisible = false;
|
|
382
418
|
get totalWidth() {
|
|
383
419
|
return this.width + this.padding * 2;
|
|
384
420
|
}
|
|
@@ -464,28 +500,13 @@ class KritzelBaseObject {
|
|
|
464
500
|
return this.translateY + this.totalHeight / 2;
|
|
465
501
|
}
|
|
466
502
|
constructor() {
|
|
467
|
-
this.__class__ = 'KritzelBaseObject';
|
|
468
|
-
this.borderWidth = 0;
|
|
469
|
-
this.opacity = 1;
|
|
470
|
-
this.padding = 0;
|
|
471
|
-
this.resizing = false;
|
|
472
|
-
this.rotation = 0;
|
|
473
|
-
this.markedForRemoval = false;
|
|
474
|
-
this.zIndex = 0;
|
|
475
|
-
this.isVisible = true;
|
|
476
|
-
this.isSelected = false;
|
|
477
|
-
this.isHovered = false;
|
|
478
|
-
this.isMounted = false;
|
|
479
|
-
this.isEditable = false;
|
|
480
|
-
this.isInteractive = false;
|
|
481
|
-
this.isDebugInfoVisible = false;
|
|
482
503
|
this.id = this.generateId();
|
|
483
504
|
}
|
|
484
|
-
static create(
|
|
505
|
+
static create(core) {
|
|
485
506
|
const object = new KritzelBaseObject();
|
|
486
|
-
object.
|
|
487
|
-
object.zIndex = store.currentZIndex;
|
|
488
|
-
object.workspaceId = store.state.activeWorkspace.id;
|
|
507
|
+
object._core = core;
|
|
508
|
+
object.zIndex = core.store.currentZIndex;
|
|
509
|
+
object.workspaceId = core.store.state.activeWorkspace.id;
|
|
489
510
|
return object;
|
|
490
511
|
}
|
|
491
512
|
mount(element) {
|
|
@@ -512,23 +533,23 @@ class KritzelBaseObject {
|
|
|
512
533
|
}
|
|
513
534
|
isInViewport() {
|
|
514
535
|
const viewportBounds = {
|
|
515
|
-
x: -this.
|
|
516
|
-
y: -this.
|
|
517
|
-
width: this.
|
|
518
|
-
height: this.
|
|
536
|
+
x: -this._core.store.state.translateX / this._core.store.state.scale,
|
|
537
|
+
y: -this._core.store.state.translateY / this._core.store.state.scale,
|
|
538
|
+
width: this._core.store.state.viewportWidth / this._core.store.state.scale,
|
|
539
|
+
height: this._core.store.state.viewportHeight / this._core.store.state.scale};
|
|
519
540
|
return (this.boundingBox.x < viewportBounds.x + viewportBounds.width &&
|
|
520
541
|
this.boundingBox.x + this.boundingBox.width > viewportBounds.x &&
|
|
521
542
|
this.boundingBox.y < viewportBounds.y + viewportBounds.height &&
|
|
522
543
|
this.boundingBox.y + this.boundingBox.height > viewportBounds.y);
|
|
523
544
|
}
|
|
524
545
|
centerInViewport() {
|
|
525
|
-
const scale = this.
|
|
526
|
-
this.translateX = (this.
|
|
527
|
-
this.translateY = (this.
|
|
546
|
+
const scale = this._core.store.state.scale;
|
|
547
|
+
this.translateX = (this._core.store.state.viewportWidth / 2 - this.totalWidth / 2 - this._core.store.state.translateX) / scale;
|
|
548
|
+
this.translateY = (this._core.store.state.viewportHeight / 2 - this.totalHeight / 2 - this._core.store.state.translateY) / scale;
|
|
528
549
|
}
|
|
529
550
|
move(startX, startY, endX, endY) {
|
|
530
|
-
const deltaX = (startX - endX) / this.
|
|
531
|
-
const deltaY = (startY - endY) / this.
|
|
551
|
+
const deltaX = (startX - endX) / this._core.store.state.scale;
|
|
552
|
+
const deltaY = (startY - endY) / this._core.store.state.scale;
|
|
532
553
|
this.translateX += deltaX;
|
|
533
554
|
this.translateY += deltaY;
|
|
534
555
|
}
|
|
@@ -554,7 +575,12 @@ class KritzelBaseObject {
|
|
|
554
575
|
onSelectedClick() {
|
|
555
576
|
// This method can be overridden by subclasses to handle click events when the object is selected.
|
|
556
577
|
}
|
|
557
|
-
|
|
578
|
+
serialize() {
|
|
579
|
+
return {
|
|
580
|
+
...ObjectHelper.clone(this)
|
|
581
|
+
};
|
|
582
|
+
}
|
|
583
|
+
deserialize(object) {
|
|
558
584
|
Object.assign(this, object);
|
|
559
585
|
return this;
|
|
560
586
|
}
|
|
@@ -574,26 +600,26 @@ class KritzelBaseObject {
|
|
|
574
600
|
updatePosition(x, y) {
|
|
575
601
|
this.translateX = x;
|
|
576
602
|
this.translateY = y;
|
|
577
|
-
this.
|
|
603
|
+
this._core.store.state.objectsMap.update(this);
|
|
578
604
|
}
|
|
579
605
|
}
|
|
580
606
|
|
|
581
607
|
class KritzelText extends KritzelBaseObject {
|
|
608
|
+
__class__ = 'KritzelText';
|
|
609
|
+
value = '';
|
|
610
|
+
fontFamily = 'Arial';
|
|
611
|
+
fontSize = 8;
|
|
612
|
+
fontColor = '#000000';
|
|
613
|
+
initialWidth = 3;
|
|
614
|
+
isNew = true;
|
|
615
|
+
isDebugInfoVisible = true;
|
|
616
|
+
isEditable = true;
|
|
617
|
+
rows = 1;
|
|
582
618
|
get isReadonly() {
|
|
583
|
-
return !(this.
|
|
619
|
+
return !(this._core.store.state.activeTool instanceof KritzelTextTool);
|
|
584
620
|
}
|
|
585
621
|
constructor(config) {
|
|
586
622
|
super();
|
|
587
|
-
this.__class__ = 'KritzelText';
|
|
588
|
-
this.value = '';
|
|
589
|
-
this.fontFamily = 'Arial';
|
|
590
|
-
this.fontSize = 8;
|
|
591
|
-
this.fontColor = '#000000';
|
|
592
|
-
this.initialWidth = 3;
|
|
593
|
-
this.isNew = true;
|
|
594
|
-
this.isDebugInfoVisible = true;
|
|
595
|
-
this.isEditable = true;
|
|
596
|
-
this.rows = 1;
|
|
597
623
|
if (config) {
|
|
598
624
|
this.value = config.value || ' ';
|
|
599
625
|
this.translateX = config.translateX || 0;
|
|
@@ -606,22 +632,22 @@ class KritzelText extends KritzelBaseObject {
|
|
|
606
632
|
this.scale = config.scale || 1;
|
|
607
633
|
}
|
|
608
634
|
}
|
|
609
|
-
static create(
|
|
635
|
+
static create(core, fontSize, fontFamily) {
|
|
610
636
|
const object = new KritzelText();
|
|
611
|
-
object.
|
|
637
|
+
object._core = core;
|
|
612
638
|
object.id = object.generateId();
|
|
613
|
-
object.workspaceId = store.state.activeWorkspace.id;
|
|
639
|
+
object.workspaceId = core.store.state.activeWorkspace.id;
|
|
614
640
|
object.fontSize = fontSize;
|
|
615
641
|
object.fontFamily = fontFamily;
|
|
616
642
|
object.translateX = 0;
|
|
617
643
|
object.translateY = 0;
|
|
618
|
-
object.width = object.initialWidth / (object.
|
|
619
|
-
object.height = (object.fontSize * 1.2) / (object.
|
|
644
|
+
object.width = object.initialWidth / (object._core.store.state.scale < 0 ? object._core.store.state.scale : 1);
|
|
645
|
+
object.height = (object.fontSize * 1.2) / (object._core.store.state.scale < 0 ? object._core.store.state.scale : 1);
|
|
620
646
|
object.padding = 5;
|
|
621
647
|
object.backgroundColor = 'transparent';
|
|
622
|
-
object.scale = object.
|
|
648
|
+
object.scale = object._core.store.state.scale;
|
|
623
649
|
object.value = ' ';
|
|
624
|
-
object.zIndex = store.currentZIndex;
|
|
650
|
+
object.zIndex = core.store.currentZIndex;
|
|
625
651
|
return object;
|
|
626
652
|
}
|
|
627
653
|
mount(element) {
|
|
@@ -675,7 +701,7 @@ class KritzelText extends KritzelBaseObject {
|
|
|
675
701
|
document.body.removeChild(span);
|
|
676
702
|
this.width = textWidth;
|
|
677
703
|
this.height = textHeight;
|
|
678
|
-
this.
|
|
704
|
+
this._core.history.executeCommand(new UpdateObjectCommand(this._core, this, this, { ...this }));
|
|
679
705
|
}
|
|
680
706
|
}
|
|
681
707
|
focus() {
|
|
@@ -708,10 +734,10 @@ class KritzelText extends KritzelBaseObject {
|
|
|
708
734
|
}
|
|
709
735
|
}
|
|
710
736
|
edit() {
|
|
711
|
-
this.
|
|
712
|
-
this.
|
|
713
|
-
this.
|
|
714
|
-
this.
|
|
737
|
+
this._core.store.setState('activeTool', KritzelToolRegistry.getTool('text'));
|
|
738
|
+
this._core.store.setState('selectionGroup', null);
|
|
739
|
+
this._core.store.setState('selectionBox', null);
|
|
740
|
+
this._core.store.setState('activeText', this);
|
|
715
741
|
setTimeout(() => {
|
|
716
742
|
this.focus();
|
|
717
743
|
}, 300);
|
|
@@ -740,47 +766,50 @@ class KritzelMathHelper {
|
|
|
740
766
|
}
|
|
741
767
|
|
|
742
768
|
class KritzelPath extends KritzelBaseObject {
|
|
769
|
+
__class__ = 'KritzelPath';
|
|
770
|
+
points;
|
|
771
|
+
d;
|
|
772
|
+
stroke = 'none';
|
|
773
|
+
strokeWidth;
|
|
774
|
+
lineSlack = 0.5;
|
|
775
|
+
fill;
|
|
776
|
+
x = 0;
|
|
777
|
+
y = 0;
|
|
778
|
+
height = 0;
|
|
779
|
+
width = 0;
|
|
780
|
+
scale = 1;
|
|
781
|
+
options;
|
|
782
|
+
isVisible = true;
|
|
783
|
+
isDebugInfoVisible = true;
|
|
784
|
+
_adjustedPoints = null;
|
|
743
785
|
get viewBox() {
|
|
744
786
|
return `${this.x} ${this.y} ${this.width} ${this.height}`;
|
|
745
787
|
}
|
|
746
788
|
constructor(config) {
|
|
747
|
-
var _a, _b, _c, _d, _e, _f;
|
|
748
789
|
super();
|
|
749
|
-
this.__class__ = 'KritzelPath';
|
|
750
|
-
this.stroke = 'none';
|
|
751
|
-
this.lineSlack = 0.5;
|
|
752
|
-
this.x = 0;
|
|
753
|
-
this.y = 0;
|
|
754
|
-
this.height = 0;
|
|
755
|
-
this.width = 0;
|
|
756
|
-
this.scale = 1;
|
|
757
|
-
this.isVisible = true;
|
|
758
|
-
this.isDebugInfoVisible = true;
|
|
759
|
-
this._adjustedPoints = null;
|
|
760
790
|
this.options = config;
|
|
761
|
-
this.points =
|
|
762
|
-
this.translateX =
|
|
763
|
-
this.translateY =
|
|
764
|
-
this.scale =
|
|
765
|
-
this.strokeWidth =
|
|
766
|
-
this.fill =
|
|
791
|
+
this.points = config?.points ?? [];
|
|
792
|
+
this.translateX = config?.translateX ?? 0;
|
|
793
|
+
this.translateY = config?.translateY ?? 0;
|
|
794
|
+
this.scale = config?.scale ?? 1;
|
|
795
|
+
this.strokeWidth = config?.strokeWidth ?? 8;
|
|
796
|
+
this.fill = config?.fill ?? '#000000';
|
|
767
797
|
this.d = this.generateSvgPath();
|
|
768
798
|
this.updateDimensions();
|
|
769
799
|
}
|
|
770
|
-
static create(
|
|
771
|
-
var _a, _b, _c, _d, _e, _f;
|
|
800
|
+
static create(core, options) {
|
|
772
801
|
const object = new KritzelPath();
|
|
773
|
-
object.
|
|
802
|
+
object._core = core;
|
|
774
803
|
object.id = object.generateId();
|
|
775
|
-
object.workspaceId = store.state.activeWorkspace.id;
|
|
804
|
+
object.workspaceId = core.store.state.activeWorkspace.id;
|
|
776
805
|
object.options = options;
|
|
777
|
-
object.points =
|
|
778
|
-
object.translateX =
|
|
779
|
-
object.translateY =
|
|
780
|
-
object.scale =
|
|
781
|
-
object.strokeWidth =
|
|
782
|
-
object.fill =
|
|
783
|
-
object.zIndex = store.currentZIndex;
|
|
806
|
+
object.points = options?.points ?? [];
|
|
807
|
+
object.translateX = options?.translateX ?? 0;
|
|
808
|
+
object.translateY = options?.translateY ?? 0;
|
|
809
|
+
object.scale = options?.scale ?? 1;
|
|
810
|
+
object.strokeWidth = options?.strokeWidth ?? 8;
|
|
811
|
+
object.fill = options?.fill ?? '#000000';
|
|
812
|
+
object.zIndex = core.store.currentZIndex;
|
|
784
813
|
object.d = object.generateSvgPath();
|
|
785
814
|
object.updateDimensions();
|
|
786
815
|
return object;
|
|
@@ -808,8 +837,8 @@ class KritzelPath extends KritzelBaseObject {
|
|
|
808
837
|
this._adjustedPoints = null;
|
|
809
838
|
}
|
|
810
839
|
move(startX, startY, endX, endY) {
|
|
811
|
-
const deltaX = (startX - endX) / this.
|
|
812
|
-
const deltaY = (startY - endY) / this.
|
|
840
|
+
const deltaX = (startX - endX) / this._core.store.state.scale;
|
|
841
|
+
const deltaY = (startY - endY) / this._core.store.state.scale;
|
|
813
842
|
this.translateX += deltaX;
|
|
814
843
|
this.translateY += deltaY;
|
|
815
844
|
this._adjustedPoints = null;
|
|
@@ -888,11 +917,10 @@ class KritzelPath extends KritzelBaseObject {
|
|
|
888
917
|
this.translateX = x;
|
|
889
918
|
this.translateY = y;
|
|
890
919
|
this._adjustedPoints = null;
|
|
891
|
-
this.
|
|
920
|
+
this._core.store.state.objectsMap.update(this);
|
|
892
921
|
}
|
|
893
922
|
computeAdjustedPoints() {
|
|
894
|
-
|
|
895
|
-
if (!((_a = this.points) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
923
|
+
if (!this.points?.length) {
|
|
896
924
|
return [];
|
|
897
925
|
}
|
|
898
926
|
const angle = this.rotation;
|
|
@@ -1005,15 +1033,15 @@ class KritzelPath extends KritzelBaseObject {
|
|
|
1005
1033
|
}
|
|
1006
1034
|
|
|
1007
1035
|
class KritzelBrushTool extends KritzelBaseTool {
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1036
|
+
type = 'pen';
|
|
1037
|
+
color = '#000000';
|
|
1038
|
+
size = 6;
|
|
1039
|
+
palettes = {
|
|
1040
|
+
pen: ['#000000', '#FFFFFF', '#FF0000', '#00FF00', '#0000FF', '#FFFF00', '#FF00FF', '#00FFFF', '#808080', '#C0C0C0', '#800000', '#008000', '#000080', '#808000', '#800080'],
|
|
1041
|
+
highlighter: ['#ffff00', '#ffb347', '#b4ffb4'],
|
|
1042
|
+
};
|
|
1043
|
+
constructor(core) {
|
|
1044
|
+
super(core);
|
|
1017
1045
|
}
|
|
1018
1046
|
handlePointerDown(event) {
|
|
1019
1047
|
if (event.cancelable) {
|
|
@@ -1021,34 +1049,34 @@ class KritzelBrushTool extends KritzelBaseTool {
|
|
|
1021
1049
|
}
|
|
1022
1050
|
if (event.pointerType === 'mouse') {
|
|
1023
1051
|
if (KritzelEventHelper.isLeftClick(event)) {
|
|
1024
|
-
this.
|
|
1025
|
-
const x = event.clientX - this.
|
|
1026
|
-
const y = event.clientY - this.
|
|
1027
|
-
this.
|
|
1052
|
+
this._core.store.setState('isDrawing', true);
|
|
1053
|
+
const x = event.clientX - this._core.store.offsetX;
|
|
1054
|
+
const y = event.clientY - this._core.store.offsetY;
|
|
1055
|
+
this._core.store.setState('currentPath', KritzelPath.create(this._core, {
|
|
1028
1056
|
points: [[x, y]],
|
|
1029
|
-
translateX: -this.
|
|
1030
|
-
translateY: -this.
|
|
1031
|
-
scale: this.
|
|
1057
|
+
translateX: -this._core.store.state.translateX,
|
|
1058
|
+
translateY: -this._core.store.state.translateY,
|
|
1059
|
+
scale: this._core.store.state.scale,
|
|
1032
1060
|
fill: this.color,
|
|
1033
1061
|
strokeWidth: this.size,
|
|
1034
|
-
});
|
|
1062
|
+
}));
|
|
1035
1063
|
}
|
|
1036
1064
|
}
|
|
1037
1065
|
if (event.pointerType === 'touch') {
|
|
1038
|
-
const activePointers = Array.from(this.
|
|
1066
|
+
const activePointers = Array.from(this._core.store.state.pointers.values());
|
|
1039
1067
|
if (activePointers.length === 1) {
|
|
1040
|
-
const x = Math.round(activePointers[0].clientX - this.
|
|
1041
|
-
const y = Math.round(activePointers[0].clientY - this.
|
|
1042
|
-
this.
|
|
1043
|
-
this.
|
|
1068
|
+
const x = Math.round(activePointers[0].clientX - this._core.store.offsetX);
|
|
1069
|
+
const y = Math.round(activePointers[0].clientY - this._core.store.offsetY);
|
|
1070
|
+
this._core.store.setState('isDrawing', true);
|
|
1071
|
+
this._core.store.setState('currentPath', KritzelPath.create(this._core, {
|
|
1044
1072
|
points: [[x, y]],
|
|
1045
|
-
translateX: -this.
|
|
1046
|
-
translateY: -this.
|
|
1047
|
-
scale: this.
|
|
1073
|
+
translateX: -this._core.store.state.translateX,
|
|
1074
|
+
translateY: -this._core.store.state.translateY,
|
|
1075
|
+
scale: this._core.store.state.scale,
|
|
1048
1076
|
fill: this.color,
|
|
1049
1077
|
strokeWidth: this.size,
|
|
1050
|
-
});
|
|
1051
|
-
this.
|
|
1078
|
+
}));
|
|
1079
|
+
this._core.rerender();
|
|
1052
1080
|
}
|
|
1053
1081
|
}
|
|
1054
1082
|
}
|
|
@@ -1057,34 +1085,34 @@ class KritzelBrushTool extends KritzelBaseTool {
|
|
|
1057
1085
|
event.preventDefault();
|
|
1058
1086
|
}
|
|
1059
1087
|
if (event.pointerType === 'mouse') {
|
|
1060
|
-
if (this.
|
|
1061
|
-
const x = event.clientX - this.
|
|
1062
|
-
const y = event.clientY - this.
|
|
1063
|
-
this.
|
|
1064
|
-
points: [...this.
|
|
1065
|
-
translateX: -this.
|
|
1066
|
-
translateY: -this.
|
|
1067
|
-
scale: this.
|
|
1088
|
+
if (this._core.store.state.isDrawing) {
|
|
1089
|
+
const x = event.clientX - this._core.store.offsetX;
|
|
1090
|
+
const y = event.clientY - this._core.store.offsetY;
|
|
1091
|
+
this._core.store.setState('currentPath', KritzelPath.create(this._core, {
|
|
1092
|
+
points: [...this._core.store.state.currentPath.points, [x, y]],
|
|
1093
|
+
translateX: -this._core.store.state.translateX,
|
|
1094
|
+
translateY: -this._core.store.state.translateY,
|
|
1095
|
+
scale: this._core.store.state.scale,
|
|
1068
1096
|
fill: this.color,
|
|
1069
1097
|
strokeWidth: this.size,
|
|
1070
|
-
});
|
|
1071
|
-
this.
|
|
1098
|
+
}));
|
|
1099
|
+
this._core.rerender();
|
|
1072
1100
|
}
|
|
1073
1101
|
}
|
|
1074
1102
|
if (event.pointerType === 'touch') {
|
|
1075
|
-
const activePointers = Array.from(this.
|
|
1103
|
+
const activePointers = Array.from(this._core.store.state.pointers.values());
|
|
1076
1104
|
if (activePointers.length === 1) {
|
|
1077
|
-
const x = Math.round(activePointers[0].clientX - this.
|
|
1078
|
-
const y = Math.round(activePointers[0].clientY - this.
|
|
1079
|
-
this.
|
|
1080
|
-
points: [...this.
|
|
1081
|
-
translateX: -this.
|
|
1082
|
-
translateY: -this.
|
|
1083
|
-
scale: this.
|
|
1105
|
+
const x = Math.round(activePointers[0].clientX - this._core.store.offsetX);
|
|
1106
|
+
const y = Math.round(activePointers[0].clientY - this._core.store.offsetY);
|
|
1107
|
+
this._core.store.setState('currentPath', KritzelPath.create(this._core, {
|
|
1108
|
+
points: [...this._core.store.state.currentPath.points, [x, y]],
|
|
1109
|
+
translateX: -this._core.store.state.translateX,
|
|
1110
|
+
translateY: -this._core.store.state.translateY,
|
|
1111
|
+
scale: this._core.store.state.scale,
|
|
1084
1112
|
fill: this.color,
|
|
1085
1113
|
strokeWidth: this.size,
|
|
1086
|
-
});
|
|
1087
|
-
this.
|
|
1114
|
+
}));
|
|
1115
|
+
this._core.rerender();
|
|
1088
1116
|
}
|
|
1089
1117
|
}
|
|
1090
1118
|
}
|
|
@@ -1093,30 +1121,34 @@ class KritzelBrushTool extends KritzelBaseTool {
|
|
|
1093
1121
|
event.preventDefault();
|
|
1094
1122
|
}
|
|
1095
1123
|
if (event.pointerType === 'mouse') {
|
|
1096
|
-
if (this.
|
|
1097
|
-
this.
|
|
1098
|
-
if (this.
|
|
1099
|
-
|
|
1100
|
-
|
|
1124
|
+
if (this._core.store.state.isDrawing) {
|
|
1125
|
+
this._core.store.setState('isDrawing', false);
|
|
1126
|
+
if (this._core.store.state.currentPath) {
|
|
1127
|
+
const currentPath = this._core.store.state.currentPath;
|
|
1128
|
+
currentPath.zIndex = this._core.store.currentZIndex;
|
|
1129
|
+
this._core.store.setState('currentPath', currentPath);
|
|
1130
|
+
this._core.history.executeCommand(new AddObjectCommand(this._core, this, this._core.store.state.currentPath));
|
|
1101
1131
|
}
|
|
1102
|
-
this.
|
|
1132
|
+
this._core.store.setState('currentPath', undefined);
|
|
1103
1133
|
}
|
|
1104
1134
|
}
|
|
1105
1135
|
if (event.pointerType === 'touch') {
|
|
1106
|
-
if (this.
|
|
1107
|
-
this.
|
|
1108
|
-
if (this.
|
|
1109
|
-
|
|
1110
|
-
|
|
1136
|
+
if (this._core.store.state.isDrawing) {
|
|
1137
|
+
this._core.store.setState('isDrawing', false);
|
|
1138
|
+
if (this._core.store.state.currentPath) {
|
|
1139
|
+
const currentPath = this._core.store.state.currentPath;
|
|
1140
|
+
currentPath.zIndex = this._core.store.currentZIndex;
|
|
1141
|
+
this._core.store.setState('currentPath', currentPath);
|
|
1142
|
+
this._core.history.executeCommand(new AddObjectCommand(this._core, this, currentPath));
|
|
1111
1143
|
}
|
|
1112
|
-
this.
|
|
1113
|
-
this.
|
|
1144
|
+
this._core.store.setState('currentPath', undefined);
|
|
1145
|
+
this._core.rerender();
|
|
1114
1146
|
}
|
|
1115
1147
|
}
|
|
1116
1148
|
}
|
|
1117
1149
|
}
|
|
1118
1150
|
|
|
1119
1151
|
export { AddObjectCommand as A, KritzelText as K, UpdateObjectCommand as U, KritzelPath as a, KritzelBrushTool as b, KritzelTextTool as c, KritzelKeyboardHelper as d, KritzelBaseObject as e, KritzelBaseCommand as f, KritzelBaseTool as g, KritzelEventHelper as h, KritzelToolRegistry as i };
|
|
1120
|
-
//# sourceMappingURL=p-
|
|
1152
|
+
//# sourceMappingURL=p-B3VQubt_.js.map
|
|
1121
1153
|
|
|
1122
|
-
//# sourceMappingURL=p-
|
|
1154
|
+
//# sourceMappingURL=p-B3VQubt_.js.map
|