@kritzel/engine 0.4.31
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/LICENSE.md +50 -0
- package/dist/cjs/app-globals-V2Kpy_OQ.js +5 -0
- package/dist/cjs/engine.constants-CakmdKMW.js +28206 -0
- package/dist/cjs/index-BbbWU2aN.js +1742 -0
- package/dist/cjs/index.cjs.js +4232 -0
- package/dist/cjs/kritzel-awareness-cursors_5.cjs.entry.js +28004 -0
- package/dist/cjs/loader.cjs.js +13 -0
- package/dist/cjs/stencil.cjs.js +25 -0
- package/dist/collection/classes/core/core.class.js +1389 -0
- package/dist/collection/classes/core/reviver.class.js +124 -0
- package/dist/collection/classes/core/store.class.js +337 -0
- package/dist/collection/classes/core/viewport.class.js +794 -0
- package/dist/collection/classes/core/workspace.class.js +112 -0
- package/dist/collection/classes/handlers/base.handler.js +20 -0
- package/dist/collection/classes/handlers/context-menu.handler.js +170 -0
- package/dist/collection/classes/handlers/hover.handler.js +35 -0
- package/dist/collection/classes/handlers/key.handler.js +162 -0
- package/dist/collection/classes/handlers/line-handle.handler.js +475 -0
- package/dist/collection/classes/handlers/move.handler.js +295 -0
- package/dist/collection/classes/handlers/resize.handler.js +327 -0
- package/dist/collection/classes/handlers/rotation.handler.js +174 -0
- package/dist/collection/classes/handlers/selection.handler.js +526 -0
- package/dist/collection/classes/managers/anchor.manager.js +1476 -0
- package/dist/collection/classes/managers/browser-permission.manager.js +64 -0
- package/dist/collection/classes/managers/clipboard.manager.js +346 -0
- package/dist/collection/classes/managers/clipboard.types.js +1 -0
- package/dist/collection/classes/managers/cursor.manager.js +139 -0
- package/dist/collection/classes/managers/license.manager.js +341 -0
- package/dist/collection/classes/managers/localization.manager.js +227 -0
- package/dist/collection/classes/managers/theme.manager.js +206 -0
- package/dist/collection/classes/objects/base-object.class.js +462 -0
- package/dist/collection/classes/objects/dynamic-object.class.js +437 -0
- package/dist/collection/classes/objects/group.class.js +590 -0
- package/dist/collection/classes/objects/image.class.js +500 -0
- package/dist/collection/classes/objects/line.class.js +789 -0
- package/dist/collection/classes/objects/path.class.js +578 -0
- package/dist/collection/classes/objects/selection-box.class.js +32 -0
- package/dist/collection/classes/objects/selection-group.class.js +752 -0
- package/dist/collection/classes/objects/shape.class.js +628 -0
- package/dist/collection/classes/objects/text.class.js +461 -0
- package/dist/collection/classes/providers/assets/asset-resolver.class.js +536 -0
- package/dist/collection/classes/providers/assets/http-asset-provider.class.js +111 -0
- package/dist/collection/classes/providers/assets/indexeddb-asset-provider.class.js +241 -0
- package/dist/collection/classes/providers/assets/presigned-asset-provider.class.js +86 -0
- package/dist/collection/classes/providers/paste-intent/event-paste-intent.provider.js +48 -0
- package/dist/collection/classes/providers/paste-intent/ios-paste-intent.provider.js +16 -0
- package/dist/collection/classes/providers/paste-intent/navigator-paste-intent.provider.js +86 -0
- package/dist/collection/classes/providers/sync/broadcast-sync-provider.class.js +100 -0
- package/dist/collection/classes/providers/sync/hocuspocus-sync-provider.class.js +333 -0
- package/dist/collection/classes/providers/sync/in-memory-sync-provider.class.js +69 -0
- package/dist/collection/classes/providers/sync/indexeddb-sync-provider.class.js +39 -0
- package/dist/collection/classes/providers/sync/websocket-sync-provider.class.js +110 -0
- package/dist/collection/classes/registries/dynamic-object-renderer.registry.js +52 -0
- package/dist/collection/classes/registries/font-registry.class.js +161 -0
- package/dist/collection/classes/registries/icon-registry.class.js +118 -0
- package/dist/collection/classes/registries/paste-intent-provider.registry.js +26 -0
- package/dist/collection/classes/registries/tool.registry.js +69 -0
- package/dist/collection/classes/structures/app-state-map.structure.js +461 -0
- package/dist/collection/classes/structures/object-map.structure.js +1103 -0
- package/dist/collection/classes/structures/quadtree.structure.js +251 -0
- package/dist/collection/classes/tools/base-tool.class.js +88 -0
- package/dist/collection/classes/tools/brush-tool.class.js +236 -0
- package/dist/collection/classes/tools/eraser-tool.class.js +133 -0
- package/dist/collection/classes/tools/image-tool.class.js +152 -0
- package/dist/collection/classes/tools/line-tool.class.js +249 -0
- package/dist/collection/classes/tools/selection-tool.class.js +611 -0
- package/dist/collection/classes/tools/shape-tool.class.js +251 -0
- package/dist/collection/classes/tools/text-tool.class.js +179 -0
- package/dist/collection/collection-manifest.json +17 -0
- package/dist/collection/components/kritzel-awareness-cursors/kritzel-awareness-cursors.css +115 -0
- package/dist/collection/components/kritzel-awareness-cursors/kritzel-awareness-cursors.js +380 -0
- package/dist/collection/components/kritzel-cursor-trail/kritzel-cursor-trail.css +10 -0
- package/dist/collection/components/kritzel-cursor-trail/kritzel-cursor-trail.js +153 -0
- package/dist/collection/components/kritzel-engine/kritzel-engine.css +81 -0
- package/dist/collection/components/kritzel-engine/kritzel-engine.js +6345 -0
- package/dist/collection/components/kritzel-icon/kritzel-icon.css +18 -0
- package/dist/collection/components/kritzel-icon/kritzel-icon.js +93 -0
- package/dist/collection/components/kritzel-watermark/kritzel-watermark.css +29 -0
- package/dist/collection/components/kritzel-watermark/kritzel-watermark.js +83 -0
- package/dist/collection/configs/default-asset-storage.config.js +9 -0
- package/dist/collection/configs/default-brush-tool.config.js +9 -0
- package/dist/collection/configs/default-engine-config.js +73 -0
- package/dist/collection/configs/default-line-tool.config.js +12 -0
- package/dist/collection/configs/default-shape-tool.config.js +15 -0
- package/dist/collection/configs/default-sync.config.js +6 -0
- package/dist/collection/configs/default-text-tool.config.js +12 -0
- package/dist/collection/constants/color-palette.constants.js +40 -0
- package/dist/collection/constants/core.constants.js +1 -0
- package/dist/collection/constants/engine.constants.js +4 -0
- package/dist/collection/constants/license.constants.js +25 -0
- package/dist/collection/constants/schema.constants.js +4 -0
- package/dist/collection/constants/storage.constants.js +1 -0
- package/dist/collection/constants/stroke-size.constants.js +2 -0
- package/dist/collection/constants/text-tool-fonts.constants.js +18 -0
- package/dist/collection/constants/version.js +6 -0
- package/dist/collection/enums/alignment.enum.js +9 -0
- package/dist/collection/enums/event-button.enum.js +6 -0
- package/dist/collection/enums/handle-type.enum.js +7 -0
- package/dist/collection/enums/shape-type.enum.js +6 -0
- package/dist/collection/events/active-workspace-change.event.js +1 -0
- package/dist/collection/events/editor-is-ready.event.js +1 -0
- package/dist/collection/events/login.event.js +1 -0
- package/dist/collection/helpers/alignment.helper.js +73 -0
- package/dist/collection/helpers/class.helper.js +5 -0
- package/dist/collection/helpers/color.helper.js +106 -0
- package/dist/collection/helpers/cursor.helper.js +57 -0
- package/dist/collection/helpers/devices.helper.js +28 -0
- package/dist/collection/helpers/event.helper.js +58 -0
- package/dist/collection/helpers/geometry.helper.js +149 -0
- package/dist/collection/helpers/html.helper.js +116 -0
- package/dist/collection/helpers/image-file.helper.js +6 -0
- package/dist/collection/helpers/keyboard.helper.js +55 -0
- package/dist/collection/helpers/localization.helper.js +25 -0
- package/dist/collection/helpers/math.helper.js +8 -0
- package/dist/collection/helpers/migration.helper.js +45 -0
- package/dist/collection/helpers/object.helper.js +29 -0
- package/dist/collection/helpers/svg-export.helper.js +655 -0
- package/dist/collection/helpers/theme.helper.js +77 -0
- package/dist/collection/helpers/tool-config.helper.js +63 -0
- package/dist/collection/helpers/wheel.helper.js +113 -0
- package/dist/collection/index.js +107 -0
- package/dist/collection/interfaces/anchor.interface.js +1 -0
- package/dist/collection/interfaces/arrow-head.interface.js +1 -0
- package/dist/collection/interfaces/asset-provider.interface.js +1 -0
- package/dist/collection/interfaces/asset-storage-config.interface.js +1 -0
- package/dist/collection/interfaces/asset.interface.js +1 -0
- package/dist/collection/interfaces/bounding-box.interface.js +1 -0
- package/dist/collection/interfaces/clonable.interface.js +1 -0
- package/dist/collection/interfaces/context-menu-item.interface.js +1 -0
- package/dist/collection/interfaces/context-menu-state.interface.js +1 -0
- package/dist/collection/interfaces/debug-info.interface.js +1 -0
- package/dist/collection/interfaces/dialog.interface.js +1 -0
- package/dist/collection/interfaces/document-metadata.interface.js +1 -0
- package/dist/collection/interfaces/dynamic-object-renderer.interface.js +1 -0
- package/dist/collection/interfaces/engine-state.interface.js +1 -0
- package/dist/collection/interfaces/font.interface.js +1 -0
- package/dist/collection/interfaces/localization.interface.js +1 -0
- package/dist/collection/interfaces/login-config.interface.js +1 -0
- package/dist/collection/interfaces/master-detail.interface.js +1 -0
- package/dist/collection/interfaces/menu-item.interface.js +1 -0
- package/dist/collection/interfaces/migration.interface.js +1 -0
- package/dist/collection/interfaces/notification.interface.js +1 -0
- package/dist/collection/interfaces/object-change-event.interface.js +1 -0
- package/dist/collection/interfaces/object-export.interface.js +1 -0
- package/dist/collection/interfaces/object.interface.js +1 -0
- package/dist/collection/interfaces/paste-intent-provider.interface.js +1 -0
- package/dist/collection/interfaces/point.interface.js +1 -0
- package/dist/collection/interfaces/polygon.interface.js +1 -0
- package/dist/collection/interfaces/remote-cursor.interface.js +1 -0
- package/dist/collection/interfaces/selection-state.interface.js +1 -0
- package/dist/collection/interfaces/serializable.interface.js +1 -0
- package/dist/collection/interfaces/settings.interface.js +1 -0
- package/dist/collection/interfaces/share.interface.js +1 -0
- package/dist/collection/interfaces/shortcut.interface.js +1 -0
- package/dist/collection/interfaces/sync-config.interface.js +21 -0
- package/dist/collection/interfaces/sync-provider.interface.js +1 -0
- package/dist/collection/interfaces/theme.interface.js +1 -0
- package/dist/collection/interfaces/tool-config.interface.js +1 -0
- package/dist/collection/interfaces/tool-type.interface.js +1 -0
- package/dist/collection/interfaces/tool.interface.js +1 -0
- package/dist/collection/interfaces/toolbar-item.interface.js +1 -0
- package/dist/collection/interfaces/undo-state.interface.js +1 -0
- package/dist/collection/interfaces/user.interface.js +1 -0
- package/dist/collection/interfaces/viewport-state.interface.js +1 -0
- package/dist/collection/locales/de-locale.js +119 -0
- package/dist/collection/locales/en-locale.js +120 -0
- package/dist/collection/locales/fr-locale.js +119 -0
- package/dist/collection/migrations/app-state.migrations.js +47 -0
- package/dist/collection/migrations/workspace.migrations.js +67 -0
- package/dist/collection/themes/dark-theme.js +340 -0
- package/dist/collection/themes/light-theme.js +346 -0
- package/dist/collection/types/deep-readonly.type.js +1 -0
- package/dist/collection/types/state.types.js +1 -0
- package/dist/components/index.d.ts +47 -0
- package/dist/components/index.js +4143 -0
- package/dist/components/kritzel-awareness-cursors.d.ts +11 -0
- package/dist/components/kritzel-awareness-cursors.js +6 -0
- package/dist/components/kritzel-cursor-trail.d.ts +11 -0
- package/dist/components/kritzel-cursor-trail.js +6 -0
- package/dist/components/kritzel-engine.d.ts +11 -0
- package/dist/components/kritzel-engine.js +52641 -0
- package/dist/components/kritzel-icon.d.ts +11 -0
- package/dist/components/kritzel-icon.js +6 -0
- package/dist/components/kritzel-watermark.d.ts +11 -0
- package/dist/components/kritzel-watermark.js +6 -0
- package/dist/components/p-B2Htv9ou.js +49 -0
- package/dist/components/p-BvRGQvVI.js +3456 -0
- package/dist/components/p-CfSx6HU_.js +1469 -0
- package/dist/components/p-YP8wAcF4.js +122 -0
- package/dist/components/p-fx6msYHJ.js +167 -0
- package/dist/esm/app-globals-DQuL1Twl.js +3 -0
- package/dist/esm/engine.constants-Bl5-pbq-.js +28143 -0
- package/dist/esm/index-BU9Mv7y0.js +1715 -0
- package/dist/esm/index.js +4134 -0
- package/dist/esm/kritzel-awareness-cursors_5.entry.js +27978 -0
- package/dist/esm/loader.js +11 -0
- package/dist/esm/stencil.js +21 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/stencil/index.esm.js +4134 -0
- package/dist/stencil/p-BU9Mv7y0.js +1702 -0
- package/dist/stencil/p-Bl5-pbq-.js +28143 -0
- package/dist/stencil/p-DQuL1Twl.js +3 -0
- package/dist/stencil/p-f0a8b7af.entry.js +27978 -0
- package/dist/stencil/stencil.esm.js +21 -0
- package/dist/types/classes/core/core.class.d.ts +532 -0
- package/dist/types/classes/core/reviver.class.d.ts +32 -0
- package/dist/types/classes/core/store.class.d.ts +198 -0
- package/dist/types/classes/core/viewport.class.d.ts +256 -0
- package/dist/types/classes/core/workspace.class.d.ts +95 -0
- package/dist/types/classes/handlers/base.handler.d.ts +18 -0
- package/dist/types/classes/handlers/context-menu.handler.d.ts +67 -0
- package/dist/types/classes/handlers/hover.handler.d.ts +23 -0
- package/dist/types/classes/handlers/key.handler.d.ts +44 -0
- package/dist/types/classes/handlers/line-handle.handler.d.ts +115 -0
- package/dist/types/classes/handlers/move.handler.d.ts +94 -0
- package/dist/types/classes/handlers/resize.handler.d.ts +95 -0
- package/dist/types/classes/handlers/rotation.handler.d.ts +50 -0
- package/dist/types/classes/handlers/selection.handler.d.ts +153 -0
- package/dist/types/classes/managers/anchor.manager.d.ts +513 -0
- package/dist/types/classes/managers/browser-permission.manager.d.ts +41 -0
- package/dist/types/classes/managers/clipboard.manager.d.ts +71 -0
- package/dist/types/classes/managers/clipboard.types.d.ts +23 -0
- package/dist/types/classes/managers/cursor.manager.d.ts +66 -0
- package/dist/types/classes/managers/license.manager.d.ts +147 -0
- package/dist/types/classes/managers/localization.manager.d.ts +145 -0
- package/dist/types/classes/managers/theme.manager.d.ts +112 -0
- package/dist/types/classes/objects/base-object.class.d.ts +266 -0
- package/dist/types/classes/objects/dynamic-object.class.d.ts +148 -0
- package/dist/types/classes/objects/group.class.d.ts +231 -0
- package/dist/types/classes/objects/image.class.d.ts +246 -0
- package/dist/types/classes/objects/line.class.d.ts +285 -0
- package/dist/types/classes/objects/path.class.d.ts +220 -0
- package/dist/types/classes/objects/selection-box.class.d.ts +19 -0
- package/dist/types/classes/objects/selection-group.class.d.ts +267 -0
- package/dist/types/classes/objects/shape.class.d.ts +322 -0
- package/dist/types/classes/objects/text.class.d.ts +197 -0
- package/dist/types/classes/providers/assets/asset-resolver.class.d.ts +141 -0
- package/dist/types/classes/providers/assets/http-asset-provider.class.d.ts +79 -0
- package/dist/types/classes/providers/assets/indexeddb-asset-provider.class.d.ts +69 -0
- package/dist/types/classes/providers/assets/presigned-asset-provider.class.d.ts +69 -0
- package/dist/types/classes/providers/paste-intent/event-paste-intent.provider.d.ts +8 -0
- package/dist/types/classes/providers/paste-intent/ios-paste-intent.provider.d.ts +6 -0
- package/dist/types/classes/providers/paste-intent/navigator-paste-intent.provider.d.ts +9 -0
- package/dist/types/classes/providers/sync/broadcast-sync-provider.class.d.ts +23 -0
- package/dist/types/classes/providers/sync/hocuspocus-sync-provider.class.d.ts +163 -0
- package/dist/types/classes/providers/sync/in-memory-sync-provider.class.d.ts +39 -0
- package/dist/types/classes/providers/sync/indexeddb-sync-provider.class.d.ts +25 -0
- package/dist/types/classes/providers/sync/websocket-sync-provider.class.d.ts +63 -0
- package/dist/types/classes/registries/dynamic-object-renderer.registry.d.ts +32 -0
- package/dist/types/classes/registries/font-registry.class.d.ts +19 -0
- package/dist/types/classes/registries/icon-registry.class.d.ts +39 -0
- package/dist/types/classes/registries/paste-intent-provider.registry.d.ts +10 -0
- package/dist/types/classes/registries/tool.registry.d.ts +53 -0
- package/dist/types/classes/structures/app-state-map.structure.d.ts +171 -0
- package/dist/types/classes/structures/object-map.structure.d.ts +403 -0
- package/dist/types/classes/structures/quadtree.structure.d.ts +128 -0
- package/dist/types/classes/tools/base-tool.class.d.ts +72 -0
- package/dist/types/classes/tools/brush-tool.class.d.ts +68 -0
- package/dist/types/classes/tools/eraser-tool.class.d.ts +38 -0
- package/dist/types/classes/tools/image-tool.class.d.ts +74 -0
- package/dist/types/classes/tools/line-tool.class.d.ts +63 -0
- package/dist/types/classes/tools/selection-tool.class.d.ts +188 -0
- package/dist/types/classes/tools/shape-tool.class.d.ts +90 -0
- package/dist/types/classes/tools/text-tool.class.d.ts +66 -0
- package/dist/types/components/kritzel-awareness-cursors/kritzel-awareness-cursors.d.ts +29 -0
- package/dist/types/components/kritzel-cursor-trail/kritzel-cursor-trail.d.ts +19 -0
- package/dist/types/components/kritzel-engine/kritzel-engine.d.ts +695 -0
- package/dist/types/components/kritzel-icon/kritzel-icon.d.ts +6 -0
- package/dist/types/components/kritzel-watermark/kritzel-watermark.d.ts +20 -0
- package/dist/types/components.d.ts +981 -0
- package/dist/types/configs/default-asset-storage.config.d.ts +8 -0
- package/dist/types/configs/default-brush-tool.config.d.ts +2 -0
- package/dist/types/configs/default-engine-config.d.ts +2 -0
- package/dist/types/configs/default-line-tool.config.d.ts +2 -0
- package/dist/types/configs/default-shape-tool.config.d.ts +2 -0
- package/dist/types/configs/default-sync.config.d.ts +5 -0
- package/dist/types/configs/default-text-tool.config.d.ts +2 -0
- package/dist/types/constants/color-palette.constants.d.ts +31 -0
- package/dist/types/constants/core.constants.d.ts +0 -0
- package/dist/types/constants/engine.constants.d.ts +4 -0
- package/dist/types/constants/license.constants.d.ts +25 -0
- package/dist/types/constants/schema.constants.d.ts +4 -0
- package/dist/types/constants/storage.constants.d.ts +1 -0
- package/dist/types/constants/stroke-size.constants.d.ts +2 -0
- package/dist/types/constants/text-tool-fonts.constants.d.ts +3 -0
- package/dist/types/constants/version.d.ts +6 -0
- package/dist/types/enums/alignment.enum.d.ts +8 -0
- package/dist/types/enums/event-button.enum.d.ts +5 -0
- package/dist/types/enums/handle-type.enum.d.ts +6 -0
- package/dist/types/enums/shape-type.enum.d.ts +5 -0
- package/dist/types/events/active-workspace-change.event.d.ts +7 -0
- package/dist/types/events/editor-is-ready.event.d.ts +18 -0
- package/dist/types/events/login.event.d.ts +3 -0
- package/dist/types/helpers/alignment.helper.d.ts +21 -0
- package/dist/types/helpers/class.helper.d.ts +3 -0
- package/dist/types/helpers/color.helper.d.ts +34 -0
- package/dist/types/helpers/cursor.helper.d.ts +22 -0
- package/dist/types/helpers/devices.helper.d.ts +8 -0
- package/dist/types/helpers/event.helper.d.ts +6 -0
- package/dist/types/helpers/geometry.helper.d.ts +38 -0
- package/dist/types/helpers/html.helper.d.ts +8 -0
- package/dist/types/helpers/image-file.helper.d.ts +3 -0
- package/dist/types/helpers/keyboard.helper.d.ts +6 -0
- package/dist/types/helpers/localization.helper.d.ts +18 -0
- package/dist/types/helpers/math.helper.d.ts +4 -0
- package/dist/types/helpers/migration.helper.d.ts +30 -0
- package/dist/types/helpers/object.helper.d.ts +9 -0
- package/dist/types/helpers/svg-export.helper.d.ts +231 -0
- package/dist/types/helpers/theme.helper.d.ts +42 -0
- package/dist/types/helpers/tool-config.helper.d.ts +4 -0
- package/dist/types/helpers/wheel.helper.d.ts +9 -0
- package/dist/types/index.d.ts +109 -0
- package/dist/types/interfaces/anchor.interface.d.ts +147 -0
- package/dist/types/interfaces/arrow-head.interface.d.ts +27 -0
- package/dist/types/interfaces/asset-provider.interface.d.ts +88 -0
- package/dist/types/interfaces/asset-storage-config.interface.d.ts +40 -0
- package/dist/types/interfaces/asset.interface.d.ts +43 -0
- package/dist/types/interfaces/bounding-box.interface.d.ts +8 -0
- package/dist/types/interfaces/clonable.interface.d.ts +3 -0
- package/dist/types/interfaces/context-menu-item.interface.d.ts +25 -0
- package/dist/types/interfaces/context-menu-state.interface.d.ts +16 -0
- package/dist/types/interfaces/debug-info.interface.d.ts +7 -0
- package/dist/types/interfaces/dialog.interface.d.ts +4 -0
- package/dist/types/interfaces/document-metadata.interface.d.ts +6 -0
- package/dist/types/interfaces/dynamic-object-renderer.interface.d.ts +40 -0
- package/dist/types/interfaces/engine-state.interface.d.ts +82 -0
- package/dist/types/interfaces/font.interface.d.ts +15 -0
- package/dist/types/interfaces/localization.interface.d.ts +143 -0
- package/dist/types/interfaces/login-config.interface.d.ts +24 -0
- package/dist/types/interfaces/master-detail.interface.d.ts +14 -0
- package/dist/types/interfaces/menu-item.interface.d.ts +27 -0
- package/dist/types/interfaces/migration.interface.d.ts +16 -0
- package/dist/types/interfaces/notification.interface.d.ts +10 -0
- package/dist/types/interfaces/object-change-event.interface.d.ts +31 -0
- package/dist/types/interfaces/object-export.interface.d.ts +20 -0
- package/dist/types/interfaces/object.interface.d.ts +53 -0
- package/dist/types/interfaces/paste-intent-provider.interface.d.ts +10 -0
- package/dist/types/interfaces/point.interface.d.ts +4 -0
- package/dist/types/interfaces/polygon.interface.d.ts +7 -0
- package/dist/types/interfaces/remote-cursor.interface.d.ts +18 -0
- package/dist/types/interfaces/selection-state.interface.d.ts +7 -0
- package/dist/types/interfaces/serializable.interface.d.ts +5 -0
- package/dist/types/interfaces/settings.interface.d.ts +25 -0
- package/dist/types/interfaces/share.interface.d.ts +9 -0
- package/dist/types/interfaces/shortcut.interface.d.ts +10 -0
- package/dist/types/interfaces/sync-config.interface.d.ts +41 -0
- package/dist/types/interfaces/sync-provider.interface.d.ts +66 -0
- package/dist/types/interfaces/theme.interface.d.ts +553 -0
- package/dist/types/interfaces/tool-config.interface.d.ts +24 -0
- package/dist/types/interfaces/tool-type.interface.d.ts +1 -0
- package/dist/types/interfaces/tool.interface.d.ts +8 -0
- package/dist/types/interfaces/toolbar-item.interface.d.ts +66 -0
- package/dist/types/interfaces/undo-state.interface.d.ts +6 -0
- package/dist/types/interfaces/user.interface.d.ts +22 -0
- package/dist/types/interfaces/viewport-state.interface.d.ts +7 -0
- package/dist/types/locales/de-locale.d.ts +5 -0
- package/dist/types/locales/en-locale.d.ts +6 -0
- package/dist/types/locales/fr-locale.d.ts +5 -0
- package/dist/types/migrations/app-state.migrations.d.ts +11 -0
- package/dist/types/migrations/workspace.migrations.d.ts +11 -0
- package/dist/types/stencil-public-runtime.d.ts +1873 -0
- package/dist/types/themes/dark-theme.d.ts +5 -0
- package/dist/types/themes/light-theme.d.ts +5 -0
- package/dist/types/types/deep-readonly.type.d.ts +7 -0
- package/dist/types/types/state.types.d.ts +3 -0
- package/loader/cdn.js +1 -0
- package/loader/index.cjs.js +1 -0
- package/loader/index.d.ts +24 -0
- package/loader/index.es2017.js +1 -0
- package/loader/index.js +2 -0
- package/package.json +101 -0
- package/readme.md +11 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { KritzelBaseHandler } from './base.handler';
|
|
2
|
+
import { KritzelCore } from '../core/core.class';
|
|
3
|
+
import { KritzelShortcut } from '../../interfaces/shortcut.interface';
|
|
4
|
+
/**
|
|
5
|
+
* Handles keyboard events and manages keyboard shortcuts for the Kritzel canvas.
|
|
6
|
+
* Provides functionality for tool switching, object manipulation,
|
|
7
|
+
* undo/redo, and navigation via keyboard input.
|
|
8
|
+
*/
|
|
9
|
+
export declare class KritzelKeyHandler extends KritzelBaseHandler {
|
|
10
|
+
/**
|
|
11
|
+
* Array of registered keyboard shortcuts with their associated actions.
|
|
12
|
+
* Each shortcut defines the key combination, display label, category, optional condition, and action to execute.
|
|
13
|
+
*/
|
|
14
|
+
private shortcuts;
|
|
15
|
+
/**
|
|
16
|
+
* Creates a new instance of the key handler.
|
|
17
|
+
* @param core - The KritzelCore instance that provides access to the canvas state and operations.
|
|
18
|
+
*/
|
|
19
|
+
constructor(core: KritzelCore);
|
|
20
|
+
/**
|
|
21
|
+
* Switches the active tool to the tool at the specified index in the tool registry.
|
|
22
|
+
* Deselects all objects and activates the new tool if found.
|
|
23
|
+
* @param index - The zero-based index of the tool to activate from the tool registry.
|
|
24
|
+
*/
|
|
25
|
+
private switchToolByIndex;
|
|
26
|
+
/**
|
|
27
|
+
* Handles keydown events and executes matching keyboard shortcuts.
|
|
28
|
+
* Updates the Ctrl key state in the store and finds matching shortcuts based on
|
|
29
|
+
* the pressed key combination and any defined conditions.
|
|
30
|
+
* @param event - The keyboard event triggered by the user pressing a key.
|
|
31
|
+
*/
|
|
32
|
+
handleKeyDown(event: KeyboardEvent): void;
|
|
33
|
+
/**
|
|
34
|
+
* Handles keyup events and updates the Ctrl key state.
|
|
35
|
+
* @param event - The keyboard event triggered by the user releasing a key.
|
|
36
|
+
*/
|
|
37
|
+
handleKeyUp(event: KeyboardEvent): void;
|
|
38
|
+
/**
|
|
39
|
+
* Returns a list of all registered shortcuts suitable for display in a UI help dialog.
|
|
40
|
+
* Excludes the action and condition properties to provide only the display-relevant information.
|
|
41
|
+
* @returns An array of shortcut objects containing key, modifiers, label, and category.
|
|
42
|
+
*/
|
|
43
|
+
getDisplayableShortcuts(): Omit<KritzelShortcut, 'action' | 'condition'>[];
|
|
44
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { KritzelCore } from '../core/core.class';
|
|
2
|
+
import { KritzelBaseHandler } from './base.handler';
|
|
3
|
+
/** The type of line handle being manipulated: start point, end point, or center control point. */
|
|
4
|
+
export type LineHandleType = 'start' | 'end' | 'center';
|
|
5
|
+
/**
|
|
6
|
+
* Handler for manipulating line object handles (endpoints and control points).
|
|
7
|
+
* Manages dragging of line start/end points and curve control points,
|
|
8
|
+
* including snap-to-object functionality for creating anchored connections.
|
|
9
|
+
*/
|
|
10
|
+
export declare class KritzelLineHandleHandler extends KritzelBaseHandler {
|
|
11
|
+
initialMouseX: number;
|
|
12
|
+
initialMouseY: number;
|
|
13
|
+
initialStartX: number;
|
|
14
|
+
initialStartY: number;
|
|
15
|
+
initialEndX: number;
|
|
16
|
+
initialEndY: number;
|
|
17
|
+
initialControlX: number | undefined;
|
|
18
|
+
initialControlY: number | undefined;
|
|
19
|
+
initialTranslateX: number;
|
|
20
|
+
initialTranslateY: number;
|
|
21
|
+
hasMoved: boolean;
|
|
22
|
+
/** Current snap target during drag, if any */
|
|
23
|
+
private currentSnapTarget;
|
|
24
|
+
/**
|
|
25
|
+
* Creates a new instance of the line handle handler.
|
|
26
|
+
* @param core - The KritzelCore instance providing access to the drawing engine and state management.
|
|
27
|
+
*/
|
|
28
|
+
constructor(core: KritzelCore);
|
|
29
|
+
/**
|
|
30
|
+
* Resets the handler's internal state to its initial values.
|
|
31
|
+
* Called after a drag operation completes to prepare for the next interaction.
|
|
32
|
+
* Clears all stored initial positions, movement flags, and snap candidates.
|
|
33
|
+
*/
|
|
34
|
+
private reset;
|
|
35
|
+
/**
|
|
36
|
+
* Handles pointer down events to initiate line handle dragging.
|
|
37
|
+
* For mouse input, responds only to left clicks.
|
|
38
|
+
* For touch/pen input, responds only when there's exactly one active pointer.
|
|
39
|
+
* @param event - The pointer event containing position and input type information.
|
|
40
|
+
*/
|
|
41
|
+
handlePointerDown(event: PointerEvent): void;
|
|
42
|
+
/**
|
|
43
|
+
* Initializes the drag operation for a line handle.
|
|
44
|
+
* Stores the initial mouse position and line state (endpoints, control point, translation)
|
|
45
|
+
* to enable delta calculations during movement. Also removes any existing anchor
|
|
46
|
+
* for the endpoint being dragged to allow repositioning.
|
|
47
|
+
* @param event - The pointer event that initiated the drag.
|
|
48
|
+
*/
|
|
49
|
+
private startHandleDrag;
|
|
50
|
+
/**
|
|
51
|
+
* Handles pointer move events during a line handle drag operation.
|
|
52
|
+
* Updates the appropriate line property based on the handle type being dragged:
|
|
53
|
+
* - 'start': Updates the line's start point, checking for snap targets.
|
|
54
|
+
* - 'end': Updates the line's end point, checking for snap targets.
|
|
55
|
+
* - 'center': Updates the quadratic curve control point, with snap-to-straight behavior.
|
|
56
|
+
*
|
|
57
|
+
* Applies coordinate transformations to convert screen delta to the line's local coordinate system,
|
|
58
|
+
* accounting for viewport scale, object scale, and rotation.
|
|
59
|
+
*
|
|
60
|
+
* @param event - The pointer event containing the current cursor position.
|
|
61
|
+
*/
|
|
62
|
+
handlePointerMove(event: PointerEvent): void;
|
|
63
|
+
/**
|
|
64
|
+
* Converts world coordinates to a line's local coordinate system.
|
|
65
|
+
* Accounts for the line's translation, scale, and rotation to transform
|
|
66
|
+
* absolute canvas positions into the line's internal coordinate space.
|
|
67
|
+
*
|
|
68
|
+
* @param line - The line object whose coordinate system to transform into.
|
|
69
|
+
* @param worldX - The X coordinate in world/canvas space.
|
|
70
|
+
* @param worldY - The Y coordinate in world/canvas space.
|
|
71
|
+
* @returns An object containing the transformed local X and Y coordinates.
|
|
72
|
+
*/
|
|
73
|
+
private worldToLineLocal;
|
|
74
|
+
/**
|
|
75
|
+
* Converts a line's local coordinate system to world coordinates.
|
|
76
|
+
* Reverses the transformations applied by worldToLineLocal to convert
|
|
77
|
+
* the line's internal coordinates back to absolute canvas positions.
|
|
78
|
+
*
|
|
79
|
+
* @param line - The line object whose coordinate system to transform from.
|
|
80
|
+
* @param localX - The X coordinate in the line's local space.
|
|
81
|
+
* @param localY - The Y coordinate in the line's local space.
|
|
82
|
+
* @returns An object containing the transformed world X and Y coordinates.
|
|
83
|
+
*/
|
|
84
|
+
private lineLocalToWorld;
|
|
85
|
+
/**
|
|
86
|
+
* Updates a line's endpoint positions and recalculates all dependent properties.
|
|
87
|
+
* Computes new bounding boxes for both the old and new line configurations,
|
|
88
|
+
* adjusts the line's position (x, y), dimensions (width, height), and translation
|
|
89
|
+
* to maintain visual consistency while moving endpoints.
|
|
90
|
+
*
|
|
91
|
+
* @param line - The line object to update.
|
|
92
|
+
* @param startX - The new X coordinate for the line's start point in local space.
|
|
93
|
+
* @param startY - The new Y coordinate for the line's start point in local space.
|
|
94
|
+
* @param endX - The new X coordinate for the line's end point in local space.
|
|
95
|
+
* @param endY - The new Y coordinate for the line's end point in local space.
|
|
96
|
+
*/
|
|
97
|
+
private updateLineEndpoint;
|
|
98
|
+
/**
|
|
99
|
+
* Handles pointer up events to complete a line handle drag operation.
|
|
100
|
+
* If the line was moved and snapped to a target object, creates an anchor connection.
|
|
101
|
+
* Refreshes the selection group dimensions and triggers change events.
|
|
102
|
+
* Finally resets the handler state and triggers a rerender.
|
|
103
|
+
*
|
|
104
|
+
* @param _event - The pointer event (unused, but required by the handler interface).
|
|
105
|
+
*/
|
|
106
|
+
handlePointerUp(_event: PointerEvent): void;
|
|
107
|
+
/**
|
|
108
|
+
* Retrieves the currently selected line object, if any.
|
|
109
|
+
* Returns the line only when exactly one object is selected and it is a KritzelLine instance.
|
|
110
|
+
*
|
|
111
|
+
* @returns The selected KritzelLine object, or null if no single line is selected.
|
|
112
|
+
*/
|
|
113
|
+
private getSelectedLine;
|
|
114
|
+
private createIndicatorCandidate;
|
|
115
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { KritzelBaseHandler } from './base.handler';
|
|
2
|
+
import { KritzelCore } from '../core/core.class';
|
|
3
|
+
/**
|
|
4
|
+
* Handler class responsible for managing move/drag operations on selected objects.
|
|
5
|
+
* Handles pointer events for mouse, touch, and pen inputs to enable dragging
|
|
6
|
+
* of selected objects on the canvas. Also manages anchor disconnection when
|
|
7
|
+
* lines are dragged beyond a threshold distance.
|
|
8
|
+
*/
|
|
9
|
+
export declare class KritzelMoveHandler extends KritzelBaseHandler {
|
|
10
|
+
/** X coordinate where the drag started (updates during drag for incremental movement) */
|
|
11
|
+
dragStartX: number;
|
|
12
|
+
/** Y coordinate where the drag started (updates during drag for incremental movement) */
|
|
13
|
+
dragStartY: number;
|
|
14
|
+
/** Initial X coordinate when starting interaction (remains constant during drag) */
|
|
15
|
+
startX: number;
|
|
16
|
+
/** Initial Y coordinate when starting interaction (remains constant during drag) */
|
|
17
|
+
startY: number;
|
|
18
|
+
/** Current X coordinate during move operation */
|
|
19
|
+
endX: number;
|
|
20
|
+
/** Current Y coordinate during move operation */
|
|
21
|
+
endY: number;
|
|
22
|
+
/** Initial position when drag started (for calculating total accumulated distance) */
|
|
23
|
+
private initialDragX;
|
|
24
|
+
private initialDragY;
|
|
25
|
+
/** Set of line IDs that have been disconnected from anchors during this drag */
|
|
26
|
+
private disconnectedLineIds;
|
|
27
|
+
/** Flag indicating whether objects have been moved during the current drag operation */
|
|
28
|
+
hasMoved: boolean;
|
|
29
|
+
/** The pointer ID being tracked for the current drag operation (null if not dragging) */
|
|
30
|
+
private trackedPointerId;
|
|
31
|
+
/**
|
|
32
|
+
* Creates a new instance of KritzelMoveHandler.
|
|
33
|
+
* @param core - The KritzelCore instance providing access to store, engine, and other core services
|
|
34
|
+
*/
|
|
35
|
+
constructor(core: KritzelCore);
|
|
36
|
+
/**
|
|
37
|
+
* Resets all internal state variables to their initial values.
|
|
38
|
+
* Called after a drag operation completes or is cancelled to prepare
|
|
39
|
+
* the handler for the next interaction.
|
|
40
|
+
* @returns void
|
|
41
|
+
*/
|
|
42
|
+
private reset;
|
|
43
|
+
/**
|
|
44
|
+
* Cancels any pending drag operation without completing it.
|
|
45
|
+
* Sets the dragging state to false and resets internal state.
|
|
46
|
+
* Useful for aborting a drag when another interaction takes precedence.
|
|
47
|
+
* @returns void
|
|
48
|
+
*/
|
|
49
|
+
cancelPendingDrag(): void;
|
|
50
|
+
/**
|
|
51
|
+
* Handles the pointer down event to initiate a drag operation.
|
|
52
|
+
* Validates that the event is appropriate for starting a drag (e.g., left mouse click,
|
|
53
|
+
* single touch, correct state) and initializes drag tracking variables.
|
|
54
|
+
* Supports mouse, touch, and pen input types.
|
|
55
|
+
* @param event - The PointerEvent from the browser containing pointer information
|
|
56
|
+
* including clientX, clientY, pointerId, pointerType, and modifier keys
|
|
57
|
+
* @returns void
|
|
58
|
+
*/
|
|
59
|
+
handlePointerDown(event: PointerEvent): void;
|
|
60
|
+
/**
|
|
61
|
+
* Handles pointer move events during a drag operation.
|
|
62
|
+
* Calculates movement delta, applies a movement threshold to filter micro-movements,
|
|
63
|
+
* checks for anchor disconnection on lines, and updates the position of selected objects.
|
|
64
|
+
* Supports mouse, touch, and pen input types.
|
|
65
|
+
* @param event - The PointerEvent from the browser containing current pointer position
|
|
66
|
+
* and pointer identification (pointerId, pointerType, clientX, clientY)
|
|
67
|
+
* @returns void
|
|
68
|
+
*/
|
|
69
|
+
handlePointerMove(event: PointerEvent): void;
|
|
70
|
+
/**
|
|
71
|
+
* Handles the pointer up event to complete a drag operation.
|
|
72
|
+
* Finalizes the move by updating the selection group, emitting change events
|
|
73
|
+
* if objects were moved, and resetting internal state for the next operation.
|
|
74
|
+
* Supports mouse, touch, and pen input types.
|
|
75
|
+
* @param event - The PointerEvent from the browser containing pointer identification
|
|
76
|
+
* (pointerId, pointerType) to verify this is the tracked pointer
|
|
77
|
+
* @returns void
|
|
78
|
+
*/
|
|
79
|
+
handlePointerUp(event: PointerEvent): void;
|
|
80
|
+
/**
|
|
81
|
+
* Checks if the total accumulated drag distance exceeds the anchor disconnect threshold.
|
|
82
|
+
* If so, disconnects all anchors from any KritzelLine objects in the selection group.
|
|
83
|
+
* This allows anchored lines to be freely moved after dragging beyond the threshold.
|
|
84
|
+
*
|
|
85
|
+
* Only disconnects anchors when the selection contains exclusively line objects.
|
|
86
|
+
* If the selection includes other object types (e.g., shapes that lines might be
|
|
87
|
+
* anchored to), no disconnection occurs to preserve intended relationships.
|
|
88
|
+
*
|
|
89
|
+
* @param currentX - The current X coordinate of the pointer in screen pixels
|
|
90
|
+
* @param currentY - The current Y coordinate of the pointer in screen pixels
|
|
91
|
+
* @returns void
|
|
92
|
+
*/
|
|
93
|
+
private checkAndDisconnectAnchors;
|
|
94
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { KritzelCore } from '../core/core.class';
|
|
2
|
+
import { KritzelBaseHandler } from './base.handler';
|
|
3
|
+
/**
|
|
4
|
+
* Handler class responsible for managing resize operations on selected objects.
|
|
5
|
+
* Supports mouse, touch, and pen input types, with rotation-aware resizing
|
|
6
|
+
* and optional aspect ratio locking via Shift key (mouse only).
|
|
7
|
+
*/
|
|
8
|
+
export declare class KritzelResizeHandler extends KritzelBaseHandler {
|
|
9
|
+
/** Initial mouse/pointer X coordinate when resize started */
|
|
10
|
+
initialMouseX: number;
|
|
11
|
+
/** Initial mouse/pointer Y coordinate when resize started */
|
|
12
|
+
initialMouseY: number;
|
|
13
|
+
/** Initial position and dimensions of the selection group before resize */
|
|
14
|
+
initialSize: {
|
|
15
|
+
x: number;
|
|
16
|
+
y: number;
|
|
17
|
+
width: number;
|
|
18
|
+
height: number;
|
|
19
|
+
};
|
|
20
|
+
/** New position and dimensions being calculated during resize */
|
|
21
|
+
newSize: {
|
|
22
|
+
x: number;
|
|
23
|
+
y: number;
|
|
24
|
+
width: number;
|
|
25
|
+
height: number;
|
|
26
|
+
};
|
|
27
|
+
/** Flag indicating whether the user has moved past the resize threshold */
|
|
28
|
+
hasResized: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Creates a new KritzelResizeHandler instance.
|
|
31
|
+
* @param core - The KritzelCore instance providing access to store, engine, and other core functionalities
|
|
32
|
+
*/
|
|
33
|
+
constructor(core: KritzelCore);
|
|
34
|
+
/**
|
|
35
|
+
* Resets all internal state variables to their default values.
|
|
36
|
+
* Called after a resize operation completes to prepare for the next resize.
|
|
37
|
+
* @private
|
|
38
|
+
*/
|
|
39
|
+
private reset;
|
|
40
|
+
/**
|
|
41
|
+
* Rebase pointer and size baselines to the latest live selection bounds.
|
|
42
|
+
* This prevents drift when anchored lines to external objects expand/shrink
|
|
43
|
+
* the selection box while a resize gesture is in progress.
|
|
44
|
+
*/
|
|
45
|
+
private rebaseResizeBaseline;
|
|
46
|
+
private shouldRebaseResizeBaseline;
|
|
47
|
+
/**
|
|
48
|
+
* Handles the pointer down event to initiate a resize operation.
|
|
49
|
+
* Captures the initial mouse position and selection group dimensions when
|
|
50
|
+
* the user clicks/touches a resize handle. Supports both mouse and touch/pen inputs.
|
|
51
|
+
*
|
|
52
|
+
* For mouse: Requires left click on an active resize handle.
|
|
53
|
+
* For touch/pen: Requires single finger touch on an active resize handle.
|
|
54
|
+
*
|
|
55
|
+
* @param event - The PointerEvent containing pointer type, position, and button information
|
|
56
|
+
*/
|
|
57
|
+
handlePointerDown(event: PointerEvent): void;
|
|
58
|
+
/**
|
|
59
|
+
* Handles the pointer move event during an active resize operation.
|
|
60
|
+
* Calculates the new dimensions based on pointer movement, taking into account:
|
|
61
|
+
* - The rotation of the selection group (transforms screen delta to local space)
|
|
62
|
+
* - The current canvas scale/zoom level
|
|
63
|
+
* - The type of resize handle being dragged (TopLeft, TopRight, BottomLeft, BottomRight)
|
|
64
|
+
* - Aspect ratio locking when Shift key is pressed (mouse only)
|
|
65
|
+
*
|
|
66
|
+
* Uses a movement threshold to prevent accidental micro-resizes.
|
|
67
|
+
* The resize is applied symmetrically around the center point.
|
|
68
|
+
*
|
|
69
|
+
* @param event - The PointerEvent containing current pointer position and modifier keys
|
|
70
|
+
*/
|
|
71
|
+
handlePointerMove(event: PointerEvent): void;
|
|
72
|
+
/**
|
|
73
|
+
* Constrains the new size to maintain the original aspect ratio.
|
|
74
|
+
* Uses the dominant scale factor (the axis with larger relative change)
|
|
75
|
+
* to determine the final size, ensuring natural resize behavior.
|
|
76
|
+
*
|
|
77
|
+
* If width changed more proportionally, height is adjusted to match the aspect ratio.
|
|
78
|
+
* If height changed more proportionally, width is adjusted to match the aspect ratio.
|
|
79
|
+
*
|
|
80
|
+
* @private
|
|
81
|
+
* @remarks Does nothing if initial width or height is zero to prevent division errors
|
|
82
|
+
*/
|
|
83
|
+
private constrainToAspectRatio;
|
|
84
|
+
/**
|
|
85
|
+
* Handles the pointer up event to finalize a resize operation.
|
|
86
|
+
* If resizing occurred (movement exceeded threshold), updates the selection group
|
|
87
|
+
* and emits change events. Resets all internal state regardless of whether
|
|
88
|
+
* actual resizing took place.
|
|
89
|
+
*
|
|
90
|
+
* For touch/pen inputs, also clears any pending long touch timeout.
|
|
91
|
+
*
|
|
92
|
+
* @param event - The PointerEvent containing pointer type information
|
|
93
|
+
*/
|
|
94
|
+
handlePointerUp(event: PointerEvent): void;
|
|
95
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { KritzelBaseHandler } from './base.handler';
|
|
2
|
+
import { KritzelCore } from '../core/core.class';
|
|
3
|
+
/**
|
|
4
|
+
* Handles rotation interactions for selected objects on the canvas.
|
|
5
|
+
* Supports both mouse and touch/pen input for rotating the selection group
|
|
6
|
+
* around its center point.
|
|
7
|
+
*/
|
|
8
|
+
export declare class KritzelRotationHandler extends KritzelBaseHandler {
|
|
9
|
+
/** The initial angle (in radians) between the cursor and the selection group center when rotation starts. */
|
|
10
|
+
initialRotation: number;
|
|
11
|
+
/** The current rotation angle (in radians) applied to the selection group. */
|
|
12
|
+
rotation: number;
|
|
13
|
+
/** The rotation value of the selection group before the current rotation operation began. */
|
|
14
|
+
initialSelectionGroupRotation: number;
|
|
15
|
+
/** The X coordinate of the rotation pivot (group center) captured when rotation starts, in world space. */
|
|
16
|
+
initialCenterX: number;
|
|
17
|
+
/** The Y coordinate of the rotation pivot (group center) captured when rotation starts, in world space. */
|
|
18
|
+
initialCenterY: number;
|
|
19
|
+
/**
|
|
20
|
+
* Creates an instance of KritzelRotationHandler.
|
|
21
|
+
* @param core - The KritzelCore instance that provides access to the store, engine, and other core functionalities.
|
|
22
|
+
*/
|
|
23
|
+
constructor(core: KritzelCore);
|
|
24
|
+
/**
|
|
25
|
+
* Resets the rotation state to initial values.
|
|
26
|
+
* Called after a rotation operation is completed.
|
|
27
|
+
*/
|
|
28
|
+
private reset;
|
|
29
|
+
/**
|
|
30
|
+
* Handles the pointer down event to initiate a rotation operation.
|
|
31
|
+
* Calculates the initial angle between the cursor position and the selection group center.
|
|
32
|
+
* Supports both mouse (left-click) and touch/pen input.
|
|
33
|
+
* @param event - The PointerEvent containing information about the pointer interaction.
|
|
34
|
+
*/
|
|
35
|
+
handlePointerDown(event: PointerEvent): void;
|
|
36
|
+
/**
|
|
37
|
+
* Handles the pointer move event during an active rotation operation.
|
|
38
|
+
* Calculates the current rotation angle based on the cursor position relative
|
|
39
|
+
* to the selection group center and applies the rotation to the selection group.
|
|
40
|
+
* @param event - The PointerEvent containing the current pointer position.
|
|
41
|
+
*/
|
|
42
|
+
handlePointerMove(event: PointerEvent): void;
|
|
43
|
+
/**
|
|
44
|
+
* Handles the pointer up event to finalize the rotation operation.
|
|
45
|
+
* Updates the selection group state, emits the objects change event,
|
|
46
|
+
* resets the rotation state, and marks objects as changed.
|
|
47
|
+
* @param event - The PointerEvent indicating the end of the pointer interaction.
|
|
48
|
+
*/
|
|
49
|
+
handlePointerUp(event: PointerEvent): void;
|
|
50
|
+
}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { KritzelBaseHandler } from './base.handler';
|
|
2
|
+
import { KritzelCore } from '../core/core.class';
|
|
3
|
+
/**
|
|
4
|
+
* Handles object selection interactions on the canvas.
|
|
5
|
+
* Supports both click-to-select and drag-to-select (marquee) selection modes
|
|
6
|
+
* for mouse, touch, and pen input types. Also handles additive selection
|
|
7
|
+
* via shift/ctrl modifiers.
|
|
8
|
+
*/
|
|
9
|
+
export declare class KritzelSelectionHandler extends KritzelBaseHandler {
|
|
10
|
+
startX: number;
|
|
11
|
+
startY: number;
|
|
12
|
+
touchStartX: number;
|
|
13
|
+
touchStartY: number;
|
|
14
|
+
touchStartTimeout: any;
|
|
15
|
+
/**
|
|
16
|
+
* Tracks previously selected objects for efficient deselection.
|
|
17
|
+
* Uses a Set for O(1) lookup when determining which objects need to be deselected.
|
|
18
|
+
*/
|
|
19
|
+
private _previouslySelectedObjects;
|
|
20
|
+
/**
|
|
21
|
+
* Indicates whether the current selection action is a single click (no drag).
|
|
22
|
+
* @returns `true` if a selection box exists with zero width and height
|
|
23
|
+
*/
|
|
24
|
+
get isSelectionClick(): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Indicates whether the current selection action is a drag selection (marquee).
|
|
27
|
+
* @returns `true` if a selection box exists with non-zero width or height
|
|
28
|
+
*/
|
|
29
|
+
get isSelectionDrag(): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Creates a new selection handler instance.
|
|
32
|
+
* @param core - The KritzelCore instance providing access to store, engine, and other core services
|
|
33
|
+
*/
|
|
34
|
+
constructor(core: KritzelCore);
|
|
35
|
+
/**
|
|
36
|
+
* Handles the pointer down event to initiate selection.
|
|
37
|
+
* For mouse input, starts selection on left-click when no selection group exists or in additive mode.
|
|
38
|
+
* For touch/pen input, initiates selection after a brief delay (80ms) to distinguish from other gestures.
|
|
39
|
+
* @param event - The pointer event containing input type, coordinates, and modifier keys
|
|
40
|
+
*/
|
|
41
|
+
handlePointerDown(event: PointerEvent): void;
|
|
42
|
+
/**
|
|
43
|
+
* Handles the pointer move event to update the selection box during drag selection.
|
|
44
|
+
* For mouse input, updates selection when actively selecting.
|
|
45
|
+
* For touch/pen input, updates selection and cancels long-touch timeout if movement exceeds threshold.
|
|
46
|
+
* @param event - The pointer event containing current pointer position and input type
|
|
47
|
+
*/
|
|
48
|
+
handlePointerMove(event: PointerEvent): void;
|
|
49
|
+
/**
|
|
50
|
+
* Handles the pointer up event to complete the selection action.
|
|
51
|
+
* Determines whether the action was a click or drag selection and processes accordingly.
|
|
52
|
+
* Triggers object edit mode when a single object is selected without movement.
|
|
53
|
+
* Emits objects change event after selection completes.
|
|
54
|
+
* @param event - The pointer event containing input type, coordinates, and modifier keys
|
|
55
|
+
*/
|
|
56
|
+
handlePointerUp(event: PointerEvent): void;
|
|
57
|
+
/**
|
|
58
|
+
* Removes the selection box from the canvas and resets selection state.
|
|
59
|
+
* Clears the selecting flag and removes the selection box object from the store.
|
|
60
|
+
*/
|
|
61
|
+
private removeSelectionBox;
|
|
62
|
+
/**
|
|
63
|
+
* Initiates a mouse-based selection by creating a selection box at the click position.
|
|
64
|
+
* Calculates canvas coordinates accounting for offset, translation, and scale.
|
|
65
|
+
* In non-additive mode, clears any existing selection group.
|
|
66
|
+
* @param event - The mouse event containing click coordinates
|
|
67
|
+
* @param isAdditive - When `true`, preserves existing selection group for adding objects
|
|
68
|
+
*/
|
|
69
|
+
private startMouseSelection;
|
|
70
|
+
/**
|
|
71
|
+
* Initiates a touch/pen-based selection by creating a selection box at the touch position.
|
|
72
|
+
* Uses the first active pointer from the pointers map to determine coordinates.
|
|
73
|
+
* In non-additive mode, clears any existing selection group.
|
|
74
|
+
* @param _event - The pointer event (unused, coordinates from active pointers)
|
|
75
|
+
* @param isAdditive - When `true`, preserves existing selection group for adding objects
|
|
76
|
+
*/
|
|
77
|
+
private startTouchSelection;
|
|
78
|
+
/**
|
|
79
|
+
* Updates the selection box dimensions during mouse drag.
|
|
80
|
+
* Calculates the new width, height, and position based on current mouse position
|
|
81
|
+
* relative to the start position. Supports selection in any direction.
|
|
82
|
+
* @param event - The mouse event containing current cursor position
|
|
83
|
+
*/
|
|
84
|
+
private updateMouseSelection;
|
|
85
|
+
/**
|
|
86
|
+
* Updates the selection box dimensions during touch/pen drag.
|
|
87
|
+
* Uses the first active pointer to calculate new dimensions.
|
|
88
|
+
* Supports selection in any direction by using absolute width/height
|
|
89
|
+
* and positioning at the minimum coordinates.
|
|
90
|
+
*/
|
|
91
|
+
private updateTouchSelection;
|
|
92
|
+
/**
|
|
93
|
+
* Updates the selection state of objects intersecting with the selection box.
|
|
94
|
+
* Uses quadtree spatial indexing for efficient O(log n + k) candidate lookup.
|
|
95
|
+
* Performs polygon-based hit testing for accurate rotated selection support.
|
|
96
|
+
* Efficiently deselects only previously selected objects that no longer intersect.
|
|
97
|
+
*/
|
|
98
|
+
private updateSelectedObjects;
|
|
99
|
+
/**
|
|
100
|
+
* Handles a single-click selection action.
|
|
101
|
+
* Finds the topmost object at the click position and adds it to the selection group.
|
|
102
|
+
* Supports additive selection mode via shift/ctrl modifier keys.
|
|
103
|
+
* @param event - The pointer event containing click coordinates and modifier keys
|
|
104
|
+
*/
|
|
105
|
+
private handleSelectionClick;
|
|
106
|
+
/**
|
|
107
|
+
* Finds the topmost (highest z-order) object at the pointer position.
|
|
108
|
+
* Iterates through overlapping objects from top to bottom and performs hit testing.
|
|
109
|
+
* Excludes selection-related objects (selection box and selection group).
|
|
110
|
+
* @param event - The pointer event used to query overlapping DOM elements
|
|
111
|
+
* @returns The topmost object that passes hit testing, or `null` if none found
|
|
112
|
+
*/
|
|
113
|
+
private getTopmostHitObject;
|
|
114
|
+
/**
|
|
115
|
+
* Clears the visual selection preview by deselecting all previously selected objects.
|
|
116
|
+
* Operates in O(k) time where k is the number of previously selected objects,
|
|
117
|
+
* rather than O(n) by iterating only tracked objects.
|
|
118
|
+
*/
|
|
119
|
+
private clearSelectionPreview;
|
|
120
|
+
/**
|
|
121
|
+
* Adds a single object to the selection group.
|
|
122
|
+
* Resolves child objects to their parent groups before adding.
|
|
123
|
+
* In additive mode (shift), toggles object presence in existing group.
|
|
124
|
+
* In non-additive mode, creates a new selection group with the object.
|
|
125
|
+
* @param object - The object to add to selection (may be a child of a group)
|
|
126
|
+
* @param shiftKey - When `true`, adds to/removes from existing selection group
|
|
127
|
+
*/
|
|
128
|
+
private addObjectToSelectionGroup;
|
|
129
|
+
/**
|
|
130
|
+
* Adds all currently selected objects to a selection group.
|
|
131
|
+
* Builds a parent group lookup map for efficient O(n) resolution of child objects.
|
|
132
|
+
* Deduplicates objects by ID to prevent duplicate entries from group resolution.
|
|
133
|
+
* In additive mode, adds to existing group; otherwise creates a new selection group.
|
|
134
|
+
* Captures unchanged snapshots and refreshes dimensions once at the end for O(n) performance.
|
|
135
|
+
* @param shiftKey - When `true`, adds objects to existing selection group
|
|
136
|
+
*/
|
|
137
|
+
private addSelectedObjectsToSelectionGroup;
|
|
138
|
+
/**
|
|
139
|
+
* Removes objects that are descendants of any KritzelGroup also present in the list.
|
|
140
|
+
* Prevents an ancestor group and one of its descendants from coexisting in a selection,
|
|
141
|
+
* which would otherwise cause the descendant to be transformed twice (once via the
|
|
142
|
+
* ancestor group, and once directly).
|
|
143
|
+
* @param objects - The candidate objects for the selection.
|
|
144
|
+
* @returns A new array with descendants of selected groups removed.
|
|
145
|
+
*/
|
|
146
|
+
private filterDescendantsOfSelectedGroups;
|
|
147
|
+
/**
|
|
148
|
+
* Mutates an existing selection group to remove any descendants of groups
|
|
149
|
+
* already present in it. See {@link filterDescendantsOfSelectedGroups}.
|
|
150
|
+
* @param selectionGroup - The selection group to clean up in place.
|
|
151
|
+
*/
|
|
152
|
+
private removeDescendantsOfSelectedGroups;
|
|
153
|
+
}
|