@tldraw/editor 4.3.0-canary.9c474ef3fad5 → 4.3.0-canary.a2419250444e

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.
Files changed (140) hide show
  1. package/dist-cjs/index.d.ts +387 -118
  2. package/dist-cjs/index.js +5 -1
  3. package/dist-cjs/index.js.map +2 -2
  4. package/dist-cjs/lib/components/ErrorBoundary.js.map +1 -1
  5. package/dist-cjs/lib/components/GeometryDebuggingView.js +1 -17
  6. package/dist-cjs/lib/components/GeometryDebuggingView.js.map +2 -2
  7. package/dist-cjs/lib/constants.js +1 -3
  8. package/dist-cjs/lib/constants.js.map +2 -2
  9. package/dist-cjs/lib/editor/Editor.js +247 -273
  10. package/dist-cjs/lib/editor/Editor.js.map +2 -2
  11. package/dist-cjs/lib/editor/derivations/notVisibleShapes.js +18 -17
  12. package/dist-cjs/lib/editor/derivations/notVisibleShapes.js.map +3 -3
  13. package/dist-cjs/lib/editor/derivations/parentsToChildren.js +12 -3
  14. package/dist-cjs/lib/editor/derivations/parentsToChildren.js.map +2 -2
  15. package/dist-cjs/lib/editor/managers/ClickManager/ClickManager.js +1 -1
  16. package/dist-cjs/lib/editor/managers/ClickManager/ClickManager.js.map +2 -2
  17. package/dist-cjs/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.js +5 -6
  18. package/dist-cjs/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.js.map +2 -2
  19. package/dist-cjs/lib/editor/managers/InputsManager/InputsManager.js +591 -0
  20. package/dist-cjs/lib/editor/managers/InputsManager/InputsManager.js.map +7 -0
  21. package/dist-cjs/lib/editor/managers/SnapManager/SnapManager.js +1 -1
  22. package/dist-cjs/lib/editor/managers/SnapManager/SnapManager.js.map +2 -2
  23. package/dist-cjs/lib/editor/managers/TickManager/TickManager.js +1 -22
  24. package/dist-cjs/lib/editor/managers/TickManager/TickManager.js.map +2 -2
  25. package/dist-cjs/lib/editor/shapes/ShapeUtil.js +31 -23
  26. package/dist-cjs/lib/editor/shapes/ShapeUtil.js.map +2 -2
  27. package/dist-cjs/lib/editor/tools/BaseBoxShapeTool/children/Pointing.js +3 -3
  28. package/dist-cjs/lib/editor/tools/BaseBoxShapeTool/children/Pointing.js.map +2 -2
  29. package/dist-cjs/lib/exports/parseCss.js +1 -1
  30. package/dist-cjs/lib/exports/parseCss.js.map +2 -2
  31. package/dist-cjs/lib/hooks/useEvent.js +1 -1
  32. package/dist-cjs/lib/hooks/useEvent.js.map +2 -2
  33. package/dist-cjs/lib/hooks/useFixSafariDoubleTapZoomPencilEvents.js.map +2 -2
  34. package/dist-cjs/lib/hooks/useGestureEvents.js +1 -1
  35. package/dist-cjs/lib/hooks/useGestureEvents.js.map +2 -2
  36. package/dist-cjs/lib/hooks/usePassThroughMouseOverEvents.js.map +2 -2
  37. package/dist-cjs/lib/hooks/usePassThroughWheelEvents.js.map +2 -2
  38. package/dist-cjs/lib/hooks/useScreenBounds.js.map +2 -2
  39. package/dist-cjs/lib/hooks/useStateAttribute.js +4 -1
  40. package/dist-cjs/lib/hooks/useStateAttribute.js.map +2 -2
  41. package/dist-cjs/lib/hooks/useTransform.js.map +1 -1
  42. package/dist-cjs/lib/options.js +4 -1
  43. package/dist-cjs/lib/options.js.map +2 -2
  44. package/dist-cjs/lib/primitives/Box.js +3 -0
  45. package/dist-cjs/lib/primitives/Box.js.map +2 -2
  46. package/dist-cjs/lib/primitives/geometry/Geometry2d.js +1 -0
  47. package/dist-cjs/lib/primitives/geometry/Geometry2d.js.map +2 -2
  48. package/dist-cjs/lib/utils/rotation.js +1 -1
  49. package/dist-cjs/lib/utils/rotation.js.map +2 -2
  50. package/dist-cjs/version.js +3 -3
  51. package/dist-cjs/version.js.map +1 -1
  52. package/dist-esm/index.d.mts +387 -118
  53. package/dist-esm/index.mjs +5 -1
  54. package/dist-esm/index.mjs.map +2 -2
  55. package/dist-esm/lib/components/ErrorBoundary.mjs.map +1 -1
  56. package/dist-esm/lib/components/GeometryDebuggingView.mjs +1 -17
  57. package/dist-esm/lib/components/GeometryDebuggingView.mjs.map +2 -2
  58. package/dist-esm/lib/constants.mjs +1 -3
  59. package/dist-esm/lib/constants.mjs.map +2 -2
  60. package/dist-esm/lib/editor/Editor.mjs +248 -276
  61. package/dist-esm/lib/editor/Editor.mjs.map +2 -2
  62. package/dist-esm/lib/editor/derivations/notVisibleShapes.mjs +18 -17
  63. package/dist-esm/lib/editor/derivations/notVisibleShapes.mjs.map +3 -3
  64. package/dist-esm/lib/editor/derivations/parentsToChildren.mjs +13 -4
  65. package/dist-esm/lib/editor/derivations/parentsToChildren.mjs.map +2 -2
  66. package/dist-esm/lib/editor/managers/ClickManager/ClickManager.mjs +1 -1
  67. package/dist-esm/lib/editor/managers/ClickManager/ClickManager.mjs.map +2 -2
  68. package/dist-esm/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.mjs +5 -6
  69. package/dist-esm/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.mjs.map +2 -2
  70. package/dist-esm/lib/editor/managers/InputsManager/InputsManager.mjs +573 -0
  71. package/dist-esm/lib/editor/managers/InputsManager/InputsManager.mjs.map +7 -0
  72. package/dist-esm/lib/editor/managers/SnapManager/SnapManager.mjs +1 -1
  73. package/dist-esm/lib/editor/managers/SnapManager/SnapManager.mjs.map +2 -2
  74. package/dist-esm/lib/editor/managers/TickManager/TickManager.mjs +1 -22
  75. package/dist-esm/lib/editor/managers/TickManager/TickManager.mjs.map +2 -2
  76. package/dist-esm/lib/editor/shapes/ShapeUtil.mjs +31 -23
  77. package/dist-esm/lib/editor/shapes/ShapeUtil.mjs.map +2 -2
  78. package/dist-esm/lib/editor/tools/BaseBoxShapeTool/children/Pointing.mjs +3 -3
  79. package/dist-esm/lib/editor/tools/BaseBoxShapeTool/children/Pointing.mjs.map +2 -2
  80. package/dist-esm/lib/exports/parseCss.mjs +1 -1
  81. package/dist-esm/lib/exports/parseCss.mjs.map +2 -2
  82. package/dist-esm/lib/hooks/useEvent.mjs +1 -1
  83. package/dist-esm/lib/hooks/useEvent.mjs.map +2 -2
  84. package/dist-esm/lib/hooks/useFixSafariDoubleTapZoomPencilEvents.mjs.map +2 -2
  85. package/dist-esm/lib/hooks/useGestureEvents.mjs +1 -1
  86. package/dist-esm/lib/hooks/useGestureEvents.mjs.map +2 -2
  87. package/dist-esm/lib/hooks/usePassThroughMouseOverEvents.mjs.map +2 -2
  88. package/dist-esm/lib/hooks/usePassThroughWheelEvents.mjs.map +2 -2
  89. package/dist-esm/lib/hooks/useScreenBounds.mjs.map +2 -2
  90. package/dist-esm/lib/hooks/useStateAttribute.mjs +4 -1
  91. package/dist-esm/lib/hooks/useStateAttribute.mjs.map +2 -2
  92. package/dist-esm/lib/hooks/useTransform.mjs.map +1 -1
  93. package/dist-esm/lib/options.mjs +4 -1
  94. package/dist-esm/lib/options.mjs.map +2 -2
  95. package/dist-esm/lib/primitives/Box.mjs +3 -0
  96. package/dist-esm/lib/primitives/Box.mjs.map +2 -2
  97. package/dist-esm/lib/primitives/geometry/Geometry2d.mjs +1 -0
  98. package/dist-esm/lib/primitives/geometry/Geometry2d.mjs.map +2 -2
  99. package/dist-esm/lib/utils/rotation.mjs +1 -1
  100. package/dist-esm/lib/utils/rotation.mjs.map +2 -2
  101. package/dist-esm/version.mjs +3 -3
  102. package/dist-esm/version.mjs.map +1 -1
  103. package/editor.css +6 -8
  104. package/package.json +18 -16
  105. package/src/index.ts +3 -0
  106. package/src/lib/components/ErrorBoundary.tsx +1 -1
  107. package/src/lib/components/GeometryDebuggingView.tsx +1 -19
  108. package/src/lib/config/TLUserPreferences.test.ts +40 -0
  109. package/src/lib/constants.ts +0 -2
  110. package/src/lib/editor/Editor.test.ts +140 -0
  111. package/src/lib/editor/Editor.ts +300 -316
  112. package/src/lib/editor/derivations/notVisibleShapes.ts +37 -23
  113. package/src/lib/editor/derivations/parentsToChildren.ts +18 -7
  114. package/src/lib/editor/managers/ClickManager/ClickManager.test.ts +17 -31
  115. package/src/lib/editor/managers/ClickManager/ClickManager.ts +1 -1
  116. package/src/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.test.ts +129 -79
  117. package/src/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.ts +10 -6
  118. package/src/lib/editor/managers/InputsManager/InputsManager.ts +566 -0
  119. package/src/lib/editor/managers/ScribbleManager/ScribbleManager.test.ts +0 -4
  120. package/src/lib/editor/managers/SnapManager/SnapManager.test.ts +12 -0
  121. package/src/lib/editor/managers/SnapManager/SnapManager.ts +1 -1
  122. package/src/lib/editor/managers/TickManager/TickManager.test.ts +40 -107
  123. package/src/lib/editor/managers/TickManager/TickManager.ts +2 -32
  124. package/src/lib/editor/shapes/ShapeUtil.ts +67 -24
  125. package/src/lib/editor/tools/BaseBoxShapeTool/children/Pointing.ts +3 -3
  126. package/src/lib/exports/parseCss.test.ts +1 -0
  127. package/src/lib/exports/parseCss.ts +1 -1
  128. package/src/lib/hooks/useEvent.tsx +1 -1
  129. package/src/lib/hooks/useFixSafariDoubleTapZoomPencilEvents.ts +1 -1
  130. package/src/lib/hooks/useGestureEvents.ts +2 -2
  131. package/src/lib/hooks/usePassThroughMouseOverEvents.ts +1 -1
  132. package/src/lib/hooks/usePassThroughWheelEvents.ts +1 -1
  133. package/src/lib/hooks/useScreenBounds.ts +1 -1
  134. package/src/lib/hooks/useStateAttribute.ts +4 -1
  135. package/src/lib/hooks/useTransform.ts +1 -1
  136. package/src/lib/options.ts +19 -0
  137. package/src/lib/primitives/Box.ts +9 -0
  138. package/src/lib/primitives/geometry/Geometry2d.ts +1 -0
  139. package/src/lib/utils/rotation.ts +1 -1
  140. package/src/version.ts +3 -3
@@ -104,7 +104,6 @@ var import_assets = require("../utils/assets");
104
104
  var import_debug_flags = require("../utils/debug-flags");
105
105
  var import_deepLinks = require("../utils/deepLinks");
106
106
  var import_getIncrementedName = require("../utils/getIncrementedName");
107
- var import_keyboard = require("../utils/keyboard");
108
107
  var import_reorderShapes = require("../utils/reorderShapes");
109
108
  var import_rotation = require("../utils/rotation");
110
109
  var import_bindingsIndex = require("./derivations/bindingsIndex");
@@ -116,14 +115,15 @@ var import_EdgeScrollManager = require("./managers/EdgeScrollManager/EdgeScrollM
116
115
  var import_FocusManager = require("./managers/FocusManager/FocusManager");
117
116
  var import_FontManager = require("./managers/FontManager/FontManager");
118
117
  var import_HistoryManager = require("./managers/HistoryManager/HistoryManager");
118
+ var import_InputsManager = require("./managers/InputsManager/InputsManager");
119
119
  var import_ScribbleManager = require("./managers/ScribbleManager/ScribbleManager");
120
120
  var import_SnapManager = require("./managers/SnapManager/SnapManager");
121
121
  var import_TextManager = require("./managers/TextManager/TextManager");
122
122
  var import_TickManager = require("./managers/TickManager/TickManager");
123
123
  var import_UserPreferencesManager = require("./managers/UserPreferencesManager/UserPreferencesManager");
124
124
  var import_RootState = require("./tools/RootState");
125
- var __setMetaKeyTimeout_dec, __setCtrlKeyTimeout_dec, __setAltKeyTimeout_dec, __setShiftKeyTimeout_dec, _getIsReadonly_dec, _getIsFocused_dec, _getSharedOpacity_dec, _getSharedStyles_dec, __getSelectionSharedStyles_dec, __getBindingsIndexCache_dec, _getCurrentPageRenderingShapesSorted_dec, _getCurrentPageShapesSorted_dec, _getCurrentPageShapes_dec, _getCurrentPageBounds_dec, _getCulledShapes_dec, _getNotVisibleShapes_dec, __getShapeMaskedPageBoundsCache_dec, __getShapeMaskCache_dec, __getShapeClipPathCache_dec, __getShapePageBoundsCache_dec, __getShapePageTransformCache_dec, __getShapeHandlesCache_dec, __getAllAssetsQuery_dec, _getCurrentPageShapeIdsSorted_dec, _getCurrentPageId_dec, _getPages_dec, __getAllPagesQuery_dec, _getRenderingShapes_dec, _getCollaboratorsOnCurrentPage_dec, _getCollaborators_dec, __getCollaboratorsQuery_dec, _getViewportPageBounds_dec, _getViewportScreenCenter_dec, _getViewportScreenBounds_dec, _getEfficientZoomLevel_dec, __getAboveDebouncedZoomThreshold_dec, _getDebouncedZoomLevel_dec, _getZoomLevel_dec, _getCameraForFollowing_dec, _getViewportPageBoundsForFollowing_dec, _getCamera_dec, __unsafe_getCameraId_dec, _getErasingShapes_dec, _getErasingShapeIds_dec, _getHintingShape_dec, _getHintingShapeIds_dec, _getHoveredShape_dec, _getHoveredShapeId_dec, _getRichTextEditor_dec, _getEditingShape_dec, _getEditingShapeId_dec, _getFocusedGroup_dec, _getFocusedGroupId_dec, _getSelectionRotatedScreenBounds_dec, _getSelectionRotatedPageBounds_dec, _getSelectionRotation_dec, _getSelectionPageBounds_dec, _getOnlySelectedShape_dec, _getOnlySelectedShapeId_dec, _getCurrentPageShapesInReadingOrder_dec, _getSelectedShapes_dec, _getSelectedShapeIds_dec, __getCurrentPageStateId_dec, _getCurrentPageState_dec, __getPageStatesQuery_dec, _getPageStates_dec, _getInstanceState_dec, _getDocumentSettings_dec, _getCurrentToolId_dec, _getCurrentTool_dec, _getPath_dec, _getCanRedo_dec, _getCanUndo_dec, _getIsShapeHiddenCache_dec, _a, _init;
126
- class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_dec = [import_state.computed], _getCanUndo_dec = [import_state.computed], _getCanRedo_dec = [import_state.computed], _getPath_dec = [import_state.computed], _getCurrentTool_dec = [import_state.computed], _getCurrentToolId_dec = [import_state.computed], _getDocumentSettings_dec = [import_state.computed], _getInstanceState_dec = [import_state.computed], _getPageStates_dec = [import_state.computed], __getPageStatesQuery_dec = [import_state.computed], _getCurrentPageState_dec = [import_state.computed], __getCurrentPageStateId_dec = [import_state.computed], _getSelectedShapeIds_dec = [import_state.computed], _getSelectedShapes_dec = [import_state.computed], _getCurrentPageShapesInReadingOrder_dec = [import_state.computed], _getOnlySelectedShapeId_dec = [import_state.computed], _getOnlySelectedShape_dec = [import_state.computed], _getSelectionPageBounds_dec = [import_state.computed], _getSelectionRotation_dec = [import_state.computed], _getSelectionRotatedPageBounds_dec = [import_state.computed], _getSelectionRotatedScreenBounds_dec = [import_state.computed], _getFocusedGroupId_dec = [import_state.computed], _getFocusedGroup_dec = [import_state.computed], _getEditingShapeId_dec = [import_state.computed], _getEditingShape_dec = [import_state.computed], _getRichTextEditor_dec = [import_state.computed], _getHoveredShapeId_dec = [import_state.computed], _getHoveredShape_dec = [import_state.computed], _getHintingShapeIds_dec = [import_state.computed], _getHintingShape_dec = [import_state.computed], _getErasingShapeIds_dec = [import_state.computed], _getErasingShapes_dec = [import_state.computed], __unsafe_getCameraId_dec = [import_state.computed], _getCamera_dec = [import_state.computed], _getViewportPageBoundsForFollowing_dec = [import_state.computed], _getCameraForFollowing_dec = [import_state.computed], _getZoomLevel_dec = [import_state.computed], _getDebouncedZoomLevel_dec = [import_state.computed], __getAboveDebouncedZoomThreshold_dec = [import_state.computed], _getEfficientZoomLevel_dec = [import_state.computed], _getViewportScreenBounds_dec = [import_state.computed], _getViewportScreenCenter_dec = [import_state.computed], _getViewportPageBounds_dec = [import_state.computed], __getCollaboratorsQuery_dec = [import_state.computed], _getCollaborators_dec = [import_state.computed], _getCollaboratorsOnCurrentPage_dec = [import_state.computed], _getRenderingShapes_dec = [import_state.computed], __getAllPagesQuery_dec = [import_state.computed], _getPages_dec = [import_state.computed], _getCurrentPageId_dec = [import_state.computed], _getCurrentPageShapeIdsSorted_dec = [import_state.computed], __getAllAssetsQuery_dec = [import_state.computed], __getShapeHandlesCache_dec = [import_state.computed], __getShapePageTransformCache_dec = [import_state.computed], __getShapePageBoundsCache_dec = [import_state.computed], __getShapeClipPathCache_dec = [import_state.computed], __getShapeMaskCache_dec = [import_state.computed], __getShapeMaskedPageBoundsCache_dec = [import_state.computed], _getNotVisibleShapes_dec = [import_state.computed], _getCulledShapes_dec = [import_state.computed], _getCurrentPageBounds_dec = [import_state.computed], _getCurrentPageShapes_dec = [import_state.computed], _getCurrentPageShapesSorted_dec = [import_state.computed], _getCurrentPageRenderingShapesSorted_dec = [import_state.computed], __getBindingsIndexCache_dec = [import_state.computed], __getSelectionSharedStyles_dec = [import_state.computed], _getSharedStyles_dec = [(0, import_state.computed)({ isEqual: (a, b) => a.equals(b) })], _getSharedOpacity_dec = [import_state.computed], _getIsFocused_dec = [import_state.computed], _getIsReadonly_dec = [import_state.computed], __setShiftKeyTimeout_dec = [import_utils.bind], __setAltKeyTimeout_dec = [import_utils.bind], __setCtrlKeyTimeout_dec = [import_utils.bind], __setMetaKeyTimeout_dec = [import_utils.bind], _a) {
125
+ var __setMetaKeyTimeout_dec, __setCtrlKeyTimeout_dec, __setAltKeyTimeout_dec, __setShiftKeyTimeout_dec, _getIsReadonly_dec, _getIsFocused_dec, _getSharedOpacity_dec, _getSharedStyles_dec, __getSelectionSharedStyles_dec, __getBindingsIndexCache_dec, _getCurrentPageRenderingShapesSorted_dec, _getCurrentPageShapesSorted_dec, _getCurrentPageShapes_dec, _getCurrentPageBounds_dec, _getCulledShapes_dec, _getNotVisibleShapes_dec, __getShapeMaskedPageBoundsCache_dec, __getShapeMaskCache_dec, __getShapeClipPathCache_dec, __getShapePageBoundsCache_dec, __getShapePageTransformCache_dec, __getShapeHandlesCache_dec, __getAllAssetsQuery_dec, _getCurrentPageShapeIdsSorted_dec, _getCurrentPageId_dec, _getPages_dec, __getAllPagesQuery_dec, _getRenderingShapes_dec, _getCollaboratorsOnCurrentPage_dec, _getCollaborators_dec, __getCollaboratorsQuery_dec, _getViewportPageBounds_dec, _getViewportScreenCenter_dec, _getViewportScreenBounds_dec, _getEfficientZoomLevel_dec, __getAboveDebouncedZoomThreshold_dec, _getDebouncedZoomLevel_dec, _getZoomLevel_dec, _getCameraForFollowing_dec, _getViewportPageBoundsForFollowing_dec, _getCamera_dec, __unsafe_getCameraId_dec, _getErasingShapes_dec, _getErasingShapeIds_dec, _getHintingShape_dec, _getHintingShapeIds_dec, _getHoveredShape_dec, _getHoveredShapeId_dec, _getRichTextEditor_dec, _getEditingShape_dec, _getEditingShapeId_dec, _getFocusedGroup_dec, _getFocusedGroupId_dec, _getSelectionRotatedScreenBounds_dec, _getSelectionRotatedPageBounds_dec, _getSelectionRotation_dec, _getSelectionPageBounds_dec, _getOnlySelectedShape_dec, _getOnlySelectedShapeId_dec, _getCurrentPageShapesInReadingOrder_dec, _getSelectedShapes_dec, _getSelectedShapeIds_dec, __getCurrentPageStateId_dec, _getCurrentPageState_dec, __getPageStatesQuery_dec, _getPageStates_dec, _getInstanceState_dec, _getDocumentSettings_dec, _getCurrentToolId_dec, _getCurrentTool_dec, _getPath_dec, _canRedo_dec, _canUndo_dec, _getIsShapeHiddenCache_dec, _a, _init;
126
+ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_dec = [import_state.computed], _canUndo_dec = [import_state.computed], _canRedo_dec = [import_state.computed], _getPath_dec = [import_state.computed], _getCurrentTool_dec = [import_state.computed], _getCurrentToolId_dec = [import_state.computed], _getDocumentSettings_dec = [import_state.computed], _getInstanceState_dec = [import_state.computed], _getPageStates_dec = [import_state.computed], __getPageStatesQuery_dec = [import_state.computed], _getCurrentPageState_dec = [import_state.computed], __getCurrentPageStateId_dec = [import_state.computed], _getSelectedShapeIds_dec = [import_state.computed], _getSelectedShapes_dec = [import_state.computed], _getCurrentPageShapesInReadingOrder_dec = [import_state.computed], _getOnlySelectedShapeId_dec = [import_state.computed], _getOnlySelectedShape_dec = [import_state.computed], _getSelectionPageBounds_dec = [import_state.computed], _getSelectionRotation_dec = [import_state.computed], _getSelectionRotatedPageBounds_dec = [import_state.computed], _getSelectionRotatedScreenBounds_dec = [import_state.computed], _getFocusedGroupId_dec = [import_state.computed], _getFocusedGroup_dec = [import_state.computed], _getEditingShapeId_dec = [import_state.computed], _getEditingShape_dec = [import_state.computed], _getRichTextEditor_dec = [import_state.computed], _getHoveredShapeId_dec = [import_state.computed], _getHoveredShape_dec = [import_state.computed], _getHintingShapeIds_dec = [import_state.computed], _getHintingShape_dec = [import_state.computed], _getErasingShapeIds_dec = [import_state.computed], _getErasingShapes_dec = [import_state.computed], __unsafe_getCameraId_dec = [import_state.computed], _getCamera_dec = [import_state.computed], _getViewportPageBoundsForFollowing_dec = [import_state.computed], _getCameraForFollowing_dec = [import_state.computed], _getZoomLevel_dec = [import_state.computed], _getDebouncedZoomLevel_dec = [import_state.computed], __getAboveDebouncedZoomThreshold_dec = [import_state.computed], _getEfficientZoomLevel_dec = [import_state.computed], _getViewportScreenBounds_dec = [import_state.computed], _getViewportScreenCenter_dec = [import_state.computed], _getViewportPageBounds_dec = [import_state.computed], __getCollaboratorsQuery_dec = [import_state.computed], _getCollaborators_dec = [import_state.computed], _getCollaboratorsOnCurrentPage_dec = [import_state.computed], _getRenderingShapes_dec = [import_state.computed], __getAllPagesQuery_dec = [import_state.computed], _getPages_dec = [import_state.computed], _getCurrentPageId_dec = [import_state.computed], _getCurrentPageShapeIdsSorted_dec = [import_state.computed], __getAllAssetsQuery_dec = [import_state.computed], __getShapeHandlesCache_dec = [import_state.computed], __getShapePageTransformCache_dec = [import_state.computed], __getShapePageBoundsCache_dec = [import_state.computed], __getShapeClipPathCache_dec = [import_state.computed], __getShapeMaskCache_dec = [import_state.computed], __getShapeMaskedPageBoundsCache_dec = [import_state.computed], _getNotVisibleShapes_dec = [import_state.computed], _getCulledShapes_dec = [import_state.computed], _getCurrentPageBounds_dec = [import_state.computed], _getCurrentPageShapes_dec = [import_state.computed], _getCurrentPageShapesSorted_dec = [import_state.computed], _getCurrentPageRenderingShapesSorted_dec = [import_state.computed], __getBindingsIndexCache_dec = [import_state.computed], __getSelectionSharedStyles_dec = [import_state.computed], _getSharedStyles_dec = [(0, import_state.computed)({ isEqual: (a, b) => a.equals(b) })], _getSharedOpacity_dec = [import_state.computed], _getIsFocused_dec = [import_state.computed], _getIsReadonly_dec = [import_state.computed], __setShiftKeyTimeout_dec = [import_utils.bind], __setAltKeyTimeout_dec = [import_utils.bind], __setCtrlKeyTimeout_dec = [import_utils.bind], __setMetaKeyTimeout_dec = [import_utils.bind], _a) {
127
127
  constructor({
128
128
  store,
129
129
  user,
@@ -159,7 +159,7 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
159
159
  */
160
160
  __publicField(this, "root");
161
161
  /**
162
- * A set of functions to call when the app is disposed.
162
+ * A set of functions to call when the editor is disposed.
163
163
  *
164
164
  * @public
165
165
  */
@@ -170,10 +170,19 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
170
170
  * @public
171
171
  */
172
172
  __publicField(this, "isDisposed", false);
173
- /** @internal */
173
+ /**
174
+ * A manager for the editor's tick events.
175
+ *
176
+ * @internal */
174
177
  __publicField(this, "_tickManager");
175
178
  /**
176
- * A manager for the app's snapping feature.
179
+ * A manager for the editor's input state.
180
+ *
181
+ * @public
182
+ */
183
+ __publicField(this, "inputs");
184
+ /**
185
+ * A manager for the editor's snapping feature.
177
186
  *
178
187
  * @public
179
188
  */
@@ -255,7 +264,7 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
255
264
  __publicField(this, "bindingUtils");
256
265
  /* --------------------- History -------------------- */
257
266
  /**
258
- * A manager for the app's history.
267
+ * A manager for the editor's history.
259
268
  *
260
269
  * @readonly
261
270
  */
@@ -321,54 +330,6 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
321
330
  tldraw: null,
322
331
  excalidraw: null
323
332
  });
324
- /* --------------------- Events --------------------- */
325
- /**
326
- * The app's current input state.
327
- *
328
- * @public
329
- */
330
- __publicField(this, "inputs", {
331
- /** The most recent pointer down's position in the current page space. */
332
- originPagePoint: new import_Vec.Vec(),
333
- /** The most recent pointer down's position in screen space. */
334
- originScreenPoint: new import_Vec.Vec(),
335
- /** The previous pointer position in the current page space. */
336
- previousPagePoint: new import_Vec.Vec(),
337
- /** The previous pointer position in screen space. */
338
- previousScreenPoint: new import_Vec.Vec(),
339
- /** The most recent pointer position in the current page space. */
340
- currentPagePoint: new import_Vec.Vec(),
341
- /** The most recent pointer position in screen space. */
342
- currentScreenPoint: new import_Vec.Vec(),
343
- /** A set containing the currently pressed keys. */
344
- keys: /* @__PURE__ */ new Set(),
345
- /** A set containing the currently pressed buttons. */
346
- buttons: /* @__PURE__ */ new Set(),
347
- /** Whether the input is from a pe. */
348
- isPen: false,
349
- /** Whether the shift key is currently pressed. */
350
- shiftKey: false,
351
- /** Whether the meta key is currently pressed. */
352
- metaKey: false,
353
- /** Whether the control or command key is currently pressed. */
354
- ctrlKey: false,
355
- /** Whether the alt or option key is currently pressed. */
356
- altKey: false,
357
- /** Whether the user is dragging. */
358
- isDragging: false,
359
- /** Whether the user is pointing. */
360
- isPointing: false,
361
- /** Whether the user is pinching. */
362
- isPinching: false,
363
- /** Whether the user is editing. */
364
- isEditing: false,
365
- /** Whether the user is panning. */
366
- isPanning: false,
367
- /** Whether the user is spacebar panning. */
368
- isSpacebarPanning: false,
369
- /** Velocity of mouse pointer, in pixels per millisecond */
370
- pointerVelocity: new import_Vec.Vec()
371
- });
372
333
  /**
373
334
  * A manager for recording multiple click events.
374
335
  *
@@ -392,8 +353,6 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
392
353
  /** @internal */
393
354
  __publicField(this, "_restoreToolId", "select");
394
355
  /** @internal */
395
- __publicField(this, "_pinchStart", 1);
396
- /** @internal */
397
356
  __publicField(this, "_didPinch", false);
398
357
  /** @internal */
399
358
  __publicField(this, "_selectedShapeIdsAtPointerDown", []);
@@ -429,6 +388,7 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
429
388
  this.disposables.add(() => this.textMeasure.dispose());
430
389
  this.fonts = new import_FontManager.FontManager(this, fontAssetUrls);
431
390
  this._tickManager = new import_TickManager.TickManager(this);
391
+ this.inputs = new import_InputsManager.InputsManager(this);
432
392
  class NewRoot extends import_RootState.RootState {
433
393
  static initial = initialState ?? "";
434
394
  }
@@ -895,9 +855,12 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
895
855
  this.history.undo();
896
856
  return this;
897
857
  }
898
- getCanUndo() {
858
+ canUndo() {
899
859
  return this.history.getNumUndos() > 0;
900
860
  }
861
+ getCanUndo() {
862
+ return this.canUndo();
863
+ }
901
864
  /**
902
865
  * Redo to the next mark.
903
866
  *
@@ -914,13 +877,16 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
914
877
  this.history.redo();
915
878
  return this;
916
879
  }
880
+ canRedo() {
881
+ return this.history.getNumRedos() > 0;
882
+ }
883
+ getCanRedo() {
884
+ return this.canRedo();
885
+ }
917
886
  clearHistory() {
918
887
  this.history.clear();
919
888
  return this;
920
889
  }
921
- getCanRedo() {
922
- return this.history.getNumRedos() > 0;
923
- }
924
890
  /**
925
891
  * Create a new "mark", or stopping point, in the undo redo history. Creating a mark will clear
926
892
  * any redos. You typically want to do this just before a user interaction begins or is handled.
@@ -1075,7 +1041,7 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
1075
1041
  }),
1076
1042
  selectionCount: this.getSelectedShapes().length,
1077
1043
  editingShape: editingShapeId ? this.getShape(editingShapeId) : void 0,
1078
- inputs: this.inputs,
1044
+ inputs: this.inputs.toJson(),
1079
1045
  pageState: this.getCurrentPageState(),
1080
1046
  instanceState: this.getInstanceState(),
1081
1047
  collaboratorCount: this.getCollaboratorsOnCurrentPage().length
@@ -1096,7 +1062,7 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
1096
1062
  * we're in a transaction that's about to be rolled back due to the same error we're currently
1097
1063
  * reporting.
1098
1064
  *
1099
- * Instead, to listen to changes to this value, you need to listen to app's `crash` event.
1065
+ * Instead, to listen to changes to this value, you need to listen to editor's `crash` event.
1100
1066
  *
1101
1067
  * @internal
1102
1068
  */
@@ -1747,6 +1713,28 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
1747
1713
  const editingShapeId = this.getEditingShapeId();
1748
1714
  return editingShapeId ? this.getShape(editingShapeId) : void 0;
1749
1715
  }
1716
+ /**
1717
+ * Whether the shape can be edited.
1718
+ *
1719
+ * @param shape - The shape (or shape id) to check if it can be edited.
1720
+ * @param info - The info about the edit start.
1721
+ *
1722
+ * @public
1723
+ * @returns true if the shape can be edited, false otherwise.
1724
+ */
1725
+ canEditShape(shape, info) {
1726
+ const id = typeof shape === "string" ? shape : shape?.id ?? null;
1727
+ if (!id) return false;
1728
+ if (id === this.getEditingShapeId()) return false;
1729
+ const _shape = this.getShape(id);
1730
+ if (!_shape) return false;
1731
+ const util = this.getShapeUtil(_shape);
1732
+ const _info = info ?? { type: "unknown" };
1733
+ if (!util.canEdit(_shape, _info)) return false;
1734
+ if (this.getIsReadonly() && !util.canEditInReadonly(_shape)) return false;
1735
+ if (this.isShapeOrAncestorLocked(_shape) && !util.canEditWhileLocked(_shape)) return false;
1736
+ return true;
1737
+ }
1750
1738
  /**
1751
1739
  * Set the current editing shape.
1752
1740
  *
@@ -1762,42 +1750,42 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
1762
1750
  */
1763
1751
  setEditingShape(shape) {
1764
1752
  const id = typeof shape === "string" ? shape : shape?.id ?? null;
1765
- this.setRichTextEditor(null);
1766
- const prevEditingShapeId = this.getEditingShapeId();
1767
- if (id !== prevEditingShapeId) {
1768
- if (id) {
1769
- const shape2 = this.getShape(id);
1770
- if (shape2 && this.getShapeUtil(shape2).canEdit(shape2)) {
1771
- this.run(
1772
- () => {
1773
- this._updateCurrentPageState({ editingShapeId: id });
1774
- if (prevEditingShapeId) {
1775
- const prevEditingShape = this.getShape(prevEditingShapeId);
1776
- if (prevEditingShape) {
1777
- this.getShapeUtil(prevEditingShape).onEditEnd?.(prevEditingShape);
1778
- }
1779
- }
1780
- this.getShapeUtil(shape2).onEditStart?.(shape2);
1781
- },
1782
- { history: "ignore" }
1783
- );
1784
- return this;
1785
- }
1786
- }
1753
+ if (!id) {
1787
1754
  this.run(
1788
1755
  () => {
1789
- this._updateCurrentPageState({ editingShapeId: null });
1790
- this._currentRichTextEditor.set(null);
1756
+ const prevEditingShapeId = this.getEditingShapeId();
1791
1757
  if (prevEditingShapeId) {
1792
1758
  const prevEditingShape = this.getShape(prevEditingShapeId);
1793
1759
  if (prevEditingShape) {
1794
1760
  this.getShapeUtil(prevEditingShape).onEditEnd?.(prevEditingShape);
1795
1761
  }
1796
1762
  }
1763
+ this._updateCurrentPageState({ editingShapeId: null });
1764
+ this._currentRichTextEditor.set(null);
1797
1765
  },
1798
1766
  { history: "ignore" }
1799
1767
  );
1768
+ return this;
1800
1769
  }
1770
+ if (!this.canEditShape(id)) return this;
1771
+ this.run(
1772
+ () => {
1773
+ const prevEditingShapeId = this.getEditingShapeId();
1774
+ if (prevEditingShapeId) {
1775
+ const prevEditingShape = this.getShape(prevEditingShapeId);
1776
+ if (prevEditingShape) {
1777
+ this.getShapeUtil(prevEditingShape).onEditEnd?.(prevEditingShape);
1778
+ }
1779
+ }
1780
+ this._updateCurrentPageState({ editingShapeId: null });
1781
+ this._currentRichTextEditor.set(null);
1782
+ this.select(id);
1783
+ this._updateCurrentPageState({ editingShapeId: id });
1784
+ const nextEditingShape = this.getShape(id);
1785
+ this.getShapeUtil(nextEditingShape).onEditStart?.(nextEditingShape);
1786
+ },
1787
+ { history: "ignore" }
1788
+ );
1801
1789
  return this;
1802
1790
  }
1803
1791
  getRichTextEditor() {
@@ -1930,6 +1918,25 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
1930
1918
  getCroppingShapeId() {
1931
1919
  return this.getCurrentPageState().croppingShapeId;
1932
1920
  }
1921
+ /**
1922
+ * Whether the shape can be cropped.
1923
+ *
1924
+ * @param shape - The shape (or shape id) to check if it can be cropped.
1925
+ *
1926
+ * @public
1927
+ * @returns true if the shape can be cropped, false otherwise.
1928
+ */
1929
+ canCropShape(shape) {
1930
+ if (!shape) return false;
1931
+ const id = typeof shape === "string" ? shape : shape?.id ?? null;
1932
+ if (!id) return false;
1933
+ const _shape = this.getShape(id);
1934
+ if (!_shape) return false;
1935
+ const util = this.getShapeUtil(_shape);
1936
+ if (!util.canCrop(_shape)) return false;
1937
+ if (this.isShapeOrAncestorLocked(_shape)) return false;
1938
+ return true;
1939
+ }
1933
1940
  /**
1934
1941
  * Set the current cropping shape.
1935
1942
  *
@@ -1951,12 +1958,8 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
1951
1958
  () => {
1952
1959
  if (!id) {
1953
1960
  this.updateCurrentPageState({ croppingShapeId: null });
1954
- } else {
1955
- const shape2 = this.getShape(id);
1956
- const util = this.getShapeUtil(shape2);
1957
- if (shape2 && util.canCrop(shape2)) {
1958
- this.updateCurrentPageState({ croppingShapeId: id });
1959
- }
1961
+ } else if (this.canCropShape(id)) {
1962
+ this.updateCurrentPageState({ croppingShapeId: id });
1960
1963
  }
1961
1964
  },
1962
1965
  { history: "ignore" }
@@ -2292,7 +2295,8 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
2292
2295
  },
2293
2296
  { history: "ignore" }
2294
2297
  );
2295
- const { currentScreenPoint, currentPagePoint } = this.inputs;
2298
+ const currentScreenPoint = this.inputs.getCurrentScreenPoint();
2299
+ const currentPagePoint = this.inputs.getCurrentPagePoint();
2296
2300
  if (currentScreenPoint.x / z - x !== currentPagePoint.x || currentScreenPoint.y / z - y !== currentPagePoint.y) {
2297
2301
  this.updatePointer({
2298
2302
  immediate: opts?.immediate,
@@ -2427,7 +2431,7 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
2427
2431
  * ```ts
2428
2432
  * editor.zoomIn()
2429
2433
  * editor.zoomIn(editor.getViewportScreenCenter(), { animation: { duration: 200 } })
2430
- * editor.zoomIn(editor.inputs.currentScreenPoint, { animation: { duration: 200 } })
2434
+ * editor.zoomIn(editor.inputs.getCurrentScreenPoint(), { animation: { duration: 200 } })
2431
2435
  * ```
2432
2436
  *
2433
2437
  * @param point - The screen point to zoom in on. Defaults to the screen center
@@ -2468,7 +2472,7 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
2468
2472
  * ```ts
2469
2473
  * editor.zoomOut()
2470
2474
  * editor.zoomOut(editor.getViewportScreenCenter(), { animation: { duration: 120 } })
2471
- * editor.zoomOut(editor.inputs.currentScreenPoint, { animation: { duration: 120 } })
2475
+ * editor.zoomOut(editor.inputs.getCurrentScreenPoint(), { animation: { duration: 120 } })
2472
2476
  * ```
2473
2477
  *
2474
2478
  * @param point - The point to zoom out on. Defaults to the viewport screen center.
@@ -2520,10 +2524,15 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
2520
2524
  if (isLocked && !opts?.force) return this;
2521
2525
  const selectionPageBounds = this.getSelectionPageBounds();
2522
2526
  if (selectionPageBounds) {
2523
- this.zoomToBounds(selectionPageBounds, {
2524
- targetZoom: Math.max(1, this.getZoomLevel()),
2525
- ...opts
2526
- });
2527
+ const currentZoom = this.getZoomLevel();
2528
+ if (Math.abs(currentZoom - 1) < 0.01) {
2529
+ this.zoomToBounds(selectionPageBounds, opts);
2530
+ } else {
2531
+ this.zoomToBounds(selectionPageBounds, {
2532
+ targetZoom: 1,
2533
+ ...opts
2534
+ });
2535
+ }
2527
2536
  }
2528
2537
  return this;
2529
2538
  }
@@ -2563,7 +2572,7 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
2563
2572
  const cameraOptions = this._cameraOptions.__unsafe__getWithoutCapture();
2564
2573
  if (cameraOptions.isLocked && !opts?.force) return this;
2565
2574
  const viewportScreenBounds = this.getViewportScreenBounds();
2566
- const inset = opts?.inset ?? Math.min(import_constants.ZOOM_TO_FIT_PADDING, viewportScreenBounds.width * 0.28);
2575
+ const inset = opts?.inset ?? Math.min(this.options.zoomToFitPadding, viewportScreenBounds.width * 0.28);
2567
2576
  const baseZoom = this.getBaseZoom();
2568
2577
  const zoomMin = cameraOptions.zoomSteps[0];
2569
2578
  const zoomMax = (0, import_utils.last)(cameraOptions.zoomSteps);
@@ -5680,8 +5689,8 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
5680
5689
  isAspectRatioLocked: options.isAspectRatioLocked
5681
5690
  });
5682
5691
  if (Math.sign(scale.x) * Math.sign(scale.y) < 0) {
5683
- let { rotation } = import_Mat.Mat.Decompose(options.initialPageTransform);
5684
- rotation -= 2 * rotation;
5692
+ const parentRotation = this.getShapeParentTransform(id).rotation();
5693
+ const rotation = -options.initialShape.rotation - 2 * parentRotation;
5685
5694
  this.updateShapes([{ id, type, rotation }]);
5686
5695
  }
5687
5696
  const preScaleShapePageCenter = import_Mat.Mat.applyToPoint(
@@ -5694,9 +5703,9 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
5694
5703
  scale,
5695
5704
  options.scaleAxisRotation
5696
5705
  );
5697
- const pageBounds = this.getShapePageBounds(id);
5698
5706
  const pageTransform = this.getShapePageTransform(id);
5699
- const currentPageCenter = pageBounds.center;
5707
+ const currentLocalBounds = this.getShapeGeometry(id).bounds;
5708
+ const currentPageCenter = import_Mat.Mat.applyToPoint(pageTransform, currentLocalBounds.center);
5700
5709
  const shapePageTransformOrigin = pageTransform.point();
5701
5710
  if (!currentPageCenter || !shapePageTransformOrigin) return this;
5702
5711
  const pageDelta = import_Vec.Vec.Sub(postScaleShapePageCenter, currentPageCenter);
@@ -5982,7 +5991,11 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
5982
5991
  )
5983
5992
  );
5984
5993
  const sortedShapeIds = shapesToGroup.sort(import_utils.sortByIndex).map((s) => s.id);
5985
- const pageBounds = import_Box.Box.Common((0, import_utils.compact)(shapesToGroup.map((id) => this.getShapePageBounds(id))));
5994
+ const childBounds = (0, import_utils.compact)(shapesToGroup.map((shape) => this.getShapePageBounds(shape)));
5995
+ const pageBounds = import_Box.Box.Common(childBounds);
5996
+ if (!pageBounds.isValid()) {
5997
+ throw Error(`Editor.groupShapes: group bounds are invalid (NaN).`);
5998
+ }
5986
5999
  const { x, y } = pageBounds.point;
5987
6000
  const parentId = this.findCommonAncestor(shapesToGroup) ?? this.getCurrentPageId();
5988
6001
  if (this.getCurrentToolId() !== "select") return this;
@@ -6935,60 +6948,7 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
6935
6948
  height
6936
6949
  };
6937
6950
  }
6938
- /**
6939
- * Update the input points from a pointer, pinch, or wheel event.
6940
- *
6941
- * @param info - The event info.
6942
- */
6943
- _updateInputsFromEvent(info) {
6944
- const {
6945
- pointerVelocity,
6946
- previousScreenPoint,
6947
- previousPagePoint,
6948
- currentScreenPoint,
6949
- currentPagePoint,
6950
- originScreenPoint,
6951
- originPagePoint
6952
- } = this.inputs;
6953
- const { screenBounds } = this.store.unsafeGetWithoutCapture(import_tlschema.TLINSTANCE_ID);
6954
- const { x: cx, y: cy, z: cz } = (0, import_state.unsafe__withoutCapture)(() => this.getCamera());
6955
- const sx = info.point.x - screenBounds.x;
6956
- const sy = info.point.y - screenBounds.y;
6957
- const sz = info.point.z ?? 0.5;
6958
- previousScreenPoint.setTo(currentScreenPoint);
6959
- previousPagePoint.setTo(currentPagePoint);
6960
- currentScreenPoint.set(sx, sy);
6961
- const nx = sx / cz - cx;
6962
- const ny = sy / cz - cy;
6963
- if (isFinite(nx) && isFinite(ny)) {
6964
- currentPagePoint.set(nx, ny, sz);
6965
- }
6966
- this.inputs.isPen = info.type === "pointer" && info.isPen;
6967
- if (info.name === "pointer_down" || this.inputs.isPinching) {
6968
- pointerVelocity.set(0, 0);
6969
- originScreenPoint.setTo(currentScreenPoint);
6970
- originPagePoint.setTo(currentPagePoint);
6971
- }
6972
- this.run(
6973
- () => {
6974
- this.store.put([
6975
- {
6976
- id: import_tlschema.TLPOINTER_ID,
6977
- typeName: "pointer",
6978
- x: currentPagePoint.x,
6979
- y: currentPagePoint.y,
6980
- lastActivityTimestamp: (
6981
- // If our pointer moved only because we're following some other user, then don't
6982
- // update our last activity timestamp; otherwise, update it to the current timestamp.
6983
- info.type === "pointer" && info.pointerId === import_constants.INTERNAL_POINTER_IDS.CAMERA_MOVE ? this.store.unsafeGetWithoutCapture(import_tlschema.TLPOINTER_ID)?.lastActivityTimestamp ?? this._tickManager.now : this._tickManager.now
6984
- ),
6985
- meta: {}
6986
- }
6987
- ]);
6988
- },
6989
- { history: "ignore" }
6990
- );
6991
- }
6951
+ /* --------------------- Events --------------------- */
6992
6952
  /**
6993
6953
  * Dispatch a cancel event.
6994
6954
  *
@@ -7053,18 +7013,19 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
7053
7013
  point: options?.point ?? // weird but true: what `inputs` calls screen-space is actually viewport space. so
7054
7014
  // we need to convert back into true screen space first. we should fix this...
7055
7015
  import_Vec.Vec.Add(
7056
- this.inputs.currentScreenPoint,
7016
+ this.inputs.getCurrentScreenPoint(),
7057
7017
  this.store.unsafeGetWithoutCapture(import_tlschema.TLINSTANCE_ID).screenBounds
7058
7018
  ),
7059
7019
  pointerId: options?.pointerId ?? 0,
7060
7020
  button: options?.button ?? 0,
7061
- isPen: options?.isPen ?? this.inputs.isPen,
7062
- shiftKey: options?.shiftKey ?? this.inputs.shiftKey,
7063
- altKey: options?.altKey ?? this.inputs.altKey,
7064
- ctrlKey: options?.ctrlKey ?? this.inputs.ctrlKey,
7065
- metaKey: options?.metaKey ?? this.inputs.metaKey,
7066
- accelKey: options?.accelKey ?? (0, import_keyboard.isAccelKey)(this.inputs)
7021
+ isPen: options?.isPen ?? this.inputs.getIsPen(),
7022
+ shiftKey: options?.shiftKey ?? this.inputs.getShiftKey(),
7023
+ altKey: options?.altKey ?? this.inputs.getAltKey(),
7024
+ ctrlKey: options?.ctrlKey ?? this.inputs.getCtrlKey(),
7025
+ metaKey: options?.metaKey ?? this.inputs.getMetaKey(),
7026
+ accelKey: false
7067
7027
  };
7028
+ event.accelKey = options?.accelKey ?? this.inputs.getAccelKey();
7068
7029
  if (options?.immediate) {
7069
7030
  this._flushEventForTick(event);
7070
7031
  } else {
@@ -7380,58 +7341,58 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
7380
7341
  this._clickManager.cancelDoubleClickTimeout();
7381
7342
  }
7382
7343
  _setShiftKeyTimeout() {
7383
- this.inputs.shiftKey = false;
7344
+ this.inputs.setShiftKey(false);
7384
7345
  this.dispatch({
7385
7346
  type: "keyboard",
7386
7347
  name: "key_up",
7387
7348
  key: "Shift",
7388
- shiftKey: this.inputs.shiftKey,
7389
- ctrlKey: this.inputs.ctrlKey,
7390
- altKey: this.inputs.altKey,
7391
- metaKey: this.inputs.metaKey,
7392
- accelKey: (0, import_keyboard.isAccelKey)(this.inputs),
7349
+ shiftKey: this.inputs.getShiftKey(),
7350
+ ctrlKey: this.inputs.getCtrlKey(),
7351
+ altKey: this.inputs.getAltKey(),
7352
+ metaKey: this.inputs.getMetaKey(),
7353
+ accelKey: this.inputs.getAccelKey(),
7393
7354
  code: "ShiftLeft"
7394
7355
  });
7395
7356
  }
7396
7357
  _setAltKeyTimeout() {
7397
- this.inputs.altKey = false;
7358
+ this.inputs.setAltKey(false);
7398
7359
  this.dispatch({
7399
7360
  type: "keyboard",
7400
7361
  name: "key_up",
7401
7362
  key: "Alt",
7402
- shiftKey: this.inputs.shiftKey,
7403
- ctrlKey: this.inputs.ctrlKey,
7404
- altKey: this.inputs.altKey,
7405
- metaKey: this.inputs.metaKey,
7406
- accelKey: (0, import_keyboard.isAccelKey)(this.inputs),
7363
+ shiftKey: this.inputs.getShiftKey(),
7364
+ ctrlKey: this.inputs.getCtrlKey(),
7365
+ altKey: this.inputs.getAltKey(),
7366
+ metaKey: this.inputs.getMetaKey(),
7367
+ accelKey: this.inputs.getAccelKey(),
7407
7368
  code: "AltLeft"
7408
7369
  });
7409
7370
  }
7410
7371
  _setCtrlKeyTimeout() {
7411
- this.inputs.ctrlKey = false;
7372
+ this.inputs.setCtrlKey(false);
7412
7373
  this.dispatch({
7413
7374
  type: "keyboard",
7414
7375
  name: "key_up",
7415
7376
  key: "Ctrl",
7416
- shiftKey: this.inputs.shiftKey,
7417
- ctrlKey: this.inputs.ctrlKey,
7418
- altKey: this.inputs.altKey,
7419
- metaKey: this.inputs.metaKey,
7420
- accelKey: (0, import_keyboard.isAccelKey)(this.inputs),
7377
+ shiftKey: this.inputs.getShiftKey(),
7378
+ ctrlKey: this.inputs.getCtrlKey(),
7379
+ altKey: this.inputs.getAltKey(),
7380
+ metaKey: this.inputs.getMetaKey(),
7381
+ accelKey: this.inputs.getAccelKey(),
7421
7382
  code: "ControlLeft"
7422
7383
  });
7423
7384
  }
7424
7385
  _setMetaKeyTimeout() {
7425
- this.inputs.metaKey = false;
7386
+ this.inputs.setMetaKey(false);
7426
7387
  this.dispatch({
7427
7388
  type: "keyboard",
7428
7389
  name: "key_up",
7429
7390
  key: "Meta",
7430
- shiftKey: this.inputs.shiftKey,
7431
- ctrlKey: this.inputs.ctrlKey,
7432
- altKey: this.inputs.altKey,
7433
- metaKey: this.inputs.metaKey,
7434
- accelKey: (0, import_keyboard.isAccelKey)(this.inputs),
7391
+ shiftKey: this.inputs.getShiftKey(),
7392
+ ctrlKey: this.inputs.getCtrlKey(),
7393
+ altKey: this.inputs.getAltKey(),
7394
+ metaKey: this.inputs.getMetaKey(),
7395
+ accelKey: this.inputs.getAccelKey(),
7435
7396
  code: "MetaLeft"
7436
7397
  });
7437
7398
  }
@@ -7502,10 +7463,10 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
7502
7463
  const { type } = info;
7503
7464
  if (info.type === "misc") {
7504
7465
  if (info.name === "cancel" || info.name === "complete") {
7505
- this.inputs.isDragging = false;
7506
- if (this.inputs.isPanning) {
7507
- this.inputs.isPanning = false;
7508
- this.inputs.isSpacebarPanning = false;
7466
+ this.inputs.setIsDragging(false);
7467
+ if (this.inputs.getIsPanning()) {
7468
+ this.inputs.setIsPanning(false);
7469
+ this.inputs.setIsSpacebarPanning(false);
7509
7470
  this.setCursor({ type: this._prevCursor, rotation: 0 });
7510
7471
  }
7511
7472
  }
@@ -7516,34 +7477,33 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
7516
7477
  if (info.shiftKey) {
7517
7478
  clearTimeout(this._shiftKeyTimeout);
7518
7479
  this._shiftKeyTimeout = -1;
7519
- inputs.shiftKey = true;
7520
- } else if (!info.shiftKey && inputs.shiftKey && this._shiftKeyTimeout === -1) {
7480
+ inputs.setShiftKey(true);
7481
+ } else if (!info.shiftKey && inputs.getShiftKey() && this._shiftKeyTimeout === -1) {
7521
7482
  this._shiftKeyTimeout = this.timers.setTimeout(this._setShiftKeyTimeout, 150);
7522
7483
  }
7523
7484
  if (info.altKey) {
7524
7485
  clearTimeout(this._altKeyTimeout);
7525
7486
  this._altKeyTimeout = -1;
7526
- inputs.altKey = true;
7527
- } else if (!info.altKey && inputs.altKey && this._altKeyTimeout === -1) {
7487
+ inputs.setAltKey(true);
7488
+ } else if (!info.altKey && inputs.getAltKey() && this._altKeyTimeout === -1) {
7528
7489
  this._altKeyTimeout = this.timers.setTimeout(this._setAltKeyTimeout, 150);
7529
7490
  }
7530
7491
  if (info.ctrlKey) {
7531
7492
  clearTimeout(this._ctrlKeyTimeout);
7532
7493
  this._ctrlKeyTimeout = -1;
7533
- inputs.ctrlKey = true;
7534
- } else if (!info.ctrlKey && inputs.ctrlKey && this._ctrlKeyTimeout === -1) {
7494
+ inputs.setCtrlKey(true);
7495
+ } else if (!info.ctrlKey && inputs.getCtrlKey() && this._ctrlKeyTimeout === -1) {
7535
7496
  this._ctrlKeyTimeout = this.timers.setTimeout(this._setCtrlKeyTimeout, 150);
7536
7497
  }
7537
7498
  if (info.metaKey) {
7538
7499
  clearTimeout(this._metaKeyTimeout);
7539
7500
  this._metaKeyTimeout = -1;
7540
- inputs.metaKey = true;
7541
- } else if (!info.metaKey && inputs.metaKey && this._metaKeyTimeout === -1) {
7501
+ inputs.setMetaKey(true);
7502
+ } else if (!info.metaKey && inputs.getMetaKey() && this._metaKeyTimeout === -1) {
7542
7503
  this._metaKeyTimeout = this.timers.setTimeout(this._setMetaKeyTimeout, 150);
7543
7504
  }
7544
- const { originPagePoint, currentPagePoint } = inputs;
7545
- if (!inputs.isPointing) {
7546
- inputs.isDragging = false;
7505
+ if (!inputs.getIsPointing()) {
7506
+ inputs.setIsDragging(false);
7547
7507
  }
7548
7508
  const instanceState = this.store.unsafeGetWithoutCapture(import_tlschema.TLINSTANCE_ID);
7549
7509
  const pageState = this.store.get(this._getCurrentPageStateId());
@@ -7552,23 +7512,23 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
7552
7512
  case "pinch": {
7553
7513
  if (cameraOptions.isLocked) return;
7554
7514
  clearTimeout(this._longPressTimeout);
7555
- this._updateInputsFromEvent(info);
7515
+ this.inputs.updateFromEvent(info);
7556
7516
  switch (info.name) {
7557
7517
  case "pinch_start": {
7558
- if (inputs.isPinching) return;
7559
- if (!inputs.isEditing) {
7560
- this._pinchStart = this.getCamera().z;
7518
+ if (inputs.getIsPinching()) return;
7519
+ if (!inputs.getIsEditing()) {
7561
7520
  if (!this._selectedShapeIdsAtPointerDown.length) {
7562
7521
  this._selectedShapeIdsAtPointerDown = [...pageState.selectedShapeIds];
7563
7522
  }
7564
7523
  this._didPinch = true;
7565
- inputs.isPinching = true;
7524
+ inputs.setIsPinching(true);
7566
7525
  this.interrupt();
7567
7526
  }
7527
+ this.emit("event", info);
7568
7528
  return;
7569
7529
  }
7570
7530
  case "pinch": {
7571
- if (!inputs.isPinching) return;
7531
+ if (!inputs.getIsPinching()) return;
7572
7532
  const {
7573
7533
  point: { z = 1 },
7574
7534
  delta: { x: dx, y: dy }
@@ -7592,11 +7552,12 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
7592
7552
  ),
7593
7553
  { immediate: true }
7594
7554
  );
7555
+ this.emit("event", info);
7595
7556
  return;
7596
7557
  }
7597
7558
  case "pinch_end": {
7598
- if (!inputs.isPinching) return this;
7599
- inputs.isPinching = false;
7559
+ if (!inputs.getIsPinching()) return this;
7560
+ inputs.setIsPinching(false);
7600
7561
  const { _selectedShapeIdsAtPointerDown: shapesToReselect } = this;
7601
7562
  this.setSelectedShapes(this._selectedShapeIdsAtPointerDown);
7602
7563
  this._selectedShapeIdsAtPointerDown = [];
@@ -7610,13 +7571,14 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
7610
7571
  });
7611
7572
  }
7612
7573
  }
7574
+ this.emit("event", info);
7613
7575
  return;
7614
7576
  }
7615
7577
  }
7616
7578
  }
7617
7579
  case "wheel": {
7618
7580
  if (cameraOptions.isLocked) return;
7619
- this._updateInputsFromEvent(info);
7581
+ this.inputs.updateFromEvent(info);
7620
7582
  const { panSpeed, zoomSpeed } = cameraOptions;
7621
7583
  let wheelBehavior = cameraOptions.wheelBehavior;
7622
7584
  const inputMode = this.user.getUserPreferences().inputMode;
@@ -7634,7 +7596,7 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
7634
7596
  if (info.ctrlKey) behavior = wheelBehavior === "pan" ? "zoom" : "pan";
7635
7597
  switch (behavior) {
7636
7598
  case "zoom": {
7637
- const { x, y } = this.inputs.currentScreenPoint;
7599
+ const { x, y } = this.inputs.getCurrentScreenPoint();
7638
7600
  let delta = dz;
7639
7601
  if (wheelBehavior === "zoom") {
7640
7602
  if (Math.abs(dy) > 10) {
@@ -7648,6 +7610,8 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
7648
7610
  immediate: true
7649
7611
  });
7650
7612
  this.maybeTrackPerformance("Zooming");
7613
+ this.root.handleEvent(info);
7614
+ this.emit("event", info);
7651
7615
  return;
7652
7616
  }
7653
7617
  case "pan": {
@@ -7655,6 +7619,8 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
7655
7619
  immediate: true
7656
7620
  });
7657
7621
  this.maybeTrackPerformance("Panning");
7622
+ this.root.handleEvent(info);
7623
+ this.emit("event", info);
7658
7624
  return;
7659
7625
  }
7660
7626
  }
@@ -7662,14 +7628,14 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
7662
7628
  break;
7663
7629
  }
7664
7630
  case "pointer": {
7665
- if (inputs.isPinching) return;
7666
- this._updateInputsFromEvent(info);
7631
+ if (inputs.getIsPinching()) return;
7632
+ this.inputs.updateFromEvent(info);
7667
7633
  const { isPen } = info;
7668
7634
  const { isPenMode } = instanceState;
7669
7635
  switch (info.name) {
7670
7636
  case "pointer_down": {
7671
7637
  if (isPenMode && !isPen) return;
7672
- if (!this.inputs.isPanning) {
7638
+ if (!this.inputs.getIsPanning()) {
7673
7639
  this._longPressTimeout = this.timers.setTimeout(() => {
7674
7640
  const vsb = this.getViewportScreenBounds();
7675
7641
  this.dispatch({
@@ -7678,7 +7644,7 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
7678
7644
  // viewport bounds, and will be again when this event is handled...
7679
7645
  // so we need to counter-adjust from the stored value so that the
7680
7646
  // new value is set correctly.
7681
- point: this.inputs.originScreenPoint.clone().addXY(vsb.x, vsb.y),
7647
+ point: this.inputs.getOriginScreenPoint().clone().addXY(vsb.x, vsb.y),
7682
7648
  name: "long_press"
7683
7649
  });
7684
7650
  }, this.options.longPressDurationMs);
@@ -7686,21 +7652,21 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
7686
7652
  this._selectedShapeIdsAtPointerDown = this.getSelectedShapeIds();
7687
7653
  if (info.button === import_constants.LEFT_MOUSE_BUTTON) this.capturedPointerId = info.pointerId;
7688
7654
  inputs.buttons.add(info.button);
7689
- inputs.isPointing = true;
7690
- inputs.isDragging = false;
7655
+ inputs.setIsPointing(true);
7656
+ inputs.setIsDragging(false);
7691
7657
  if (!isPenMode && isPen) this.updateInstanceState({ isPenMode: true });
7692
7658
  if (info.button === import_constants.STYLUS_ERASER_BUTTON) {
7693
7659
  this._restoreToolId = this.getCurrentToolId();
7694
7660
  this.complete();
7695
7661
  this.setCurrentTool("eraser");
7696
7662
  } else if (info.button === import_constants.MIDDLE_MOUSE_BUTTON) {
7697
- if (!this.inputs.isPanning) {
7663
+ if (!this.inputs.getIsPanning()) {
7698
7664
  this._prevCursor = this.getInstanceState().cursor.type;
7699
7665
  }
7700
- this.inputs.isPanning = true;
7666
+ this.inputs.setIsPanning(true);
7701
7667
  clearTimeout(this._longPressTimeout);
7702
7668
  }
7703
- if (this.inputs.isPanning) {
7669
+ if (this.inputs.getIsPanning()) {
7704
7670
  this.stopCameraAnimation();
7705
7671
  this.setCursor({ type: "grabbing", rotation: 0 });
7706
7672
  return this;
@@ -7710,8 +7676,9 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
7710
7676
  case "pointer_move": {
7711
7677
  if (!isPen && isPenMode) return;
7712
7678
  const { x: cx, y: cy, z: cz } = (0, import_state.unsafe__withoutCapture)(() => this.getCamera());
7713
- if (this.inputs.isPanning && this.inputs.isPointing) {
7714
- const { currentScreenPoint, previousScreenPoint } = this.inputs;
7679
+ if (this.inputs.getIsPanning() && this.inputs.getIsPointing()) {
7680
+ const currentScreenPoint = this.inputs.getCurrentScreenPoint();
7681
+ const previousScreenPoint = this.inputs.getPreviousScreenPoint();
7715
7682
  const offset = import_Vec.Vec.Sub(currentScreenPoint, previousScreenPoint);
7716
7683
  this.setCamera(new import_Vec.Vec(cx + offset.x / cz, cy + offset.y / cz, cz), {
7717
7684
  immediate: true
@@ -7719,15 +7686,15 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
7719
7686
  this.maybeTrackPerformance("Panning");
7720
7687
  return;
7721
7688
  }
7722
- if (inputs.isPointing && !inputs.isDragging && import_Vec.Vec.Dist2(originPagePoint, currentPagePoint) * this.getZoomLevel() > (instanceState.isCoarsePointer ? this.options.coarseDragDistanceSquared : this.options.dragDistanceSquared) / cz) {
7723
- inputs.isDragging = true;
7689
+ if (inputs.getIsPointing() && !inputs.getIsDragging() && import_Vec.Vec.Dist2(inputs.getOriginPagePoint(), inputs.getCurrentPagePoint()) * this.getZoomLevel() > (instanceState.isCoarsePointer ? this.options.coarseDragDistanceSquared : this.options.dragDistanceSquared) / cz) {
7690
+ inputs.setIsDragging(true);
7724
7691
  clearTimeout(this._longPressTimeout);
7725
7692
  }
7726
7693
  break;
7727
7694
  }
7728
7695
  case "pointer_up": {
7729
- inputs.isDragging = false;
7730
- inputs.isPointing = false;
7696
+ inputs.setIsDragging(false);
7697
+ inputs.setIsPointing(false);
7731
7698
  clearTimeout(this._longPressTimeout);
7732
7699
  inputs.buttons.delete(info.button);
7733
7700
  if (instanceState.isPenMode && !isPen) return;
@@ -7735,12 +7702,12 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
7735
7702
  this.capturedPointerId = null;
7736
7703
  info.button = 0;
7737
7704
  }
7738
- if (inputs.isPanning) {
7705
+ if (inputs.getIsPanning()) {
7739
7706
  if (!inputs.keys.has("Space")) {
7740
- inputs.isPanning = false;
7741
- inputs.isSpacebarPanning = false;
7707
+ inputs.setIsPanning(false);
7708
+ inputs.setIsSpacebarPanning(false);
7742
7709
  }
7743
- const slideDirection = this.inputs.pointerVelocity;
7710
+ const slideDirection = this.inputs.getPointerVelocity();
7744
7711
  const slideSpeed = Math.min(2, slideDirection.len());
7745
7712
  switch (info.button) {
7746
7713
  case import_constants.LEFT_MOUSE_BUTTON: {
@@ -7777,51 +7744,58 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
7777
7744
  switch (info.name) {
7778
7745
  case "key_down": {
7779
7746
  inputs.keys.add(info.code);
7780
- if (info.code === "Space" && !info.ctrlKey) {
7781
- if (!this.inputs.isPanning) {
7782
- this._prevCursor = instanceState.cursor.type;
7783
- }
7784
- this.inputs.isPanning = true;
7785
- this.inputs.isSpacebarPanning = true;
7786
- clearTimeout(this._longPressTimeout);
7787
- this.setCursor({ type: this.inputs.isPointing ? "grabbing" : "grab", rotation: 0 });
7788
- }
7789
- if (this.inputs.isSpacebarPanning) {
7790
- let offset;
7791
- switch (info.code) {
7792
- case "ArrowUp": {
7793
- offset = new import_Vec.Vec(0, -1);
7794
- break;
7795
- }
7796
- case "ArrowRight": {
7797
- offset = new import_Vec.Vec(1, 0);
7798
- break;
7747
+ if (this.options.spacebarPanning) {
7748
+ if (info.code === "Space" && !info.ctrlKey) {
7749
+ if (!this.inputs.getIsPanning()) {
7750
+ this._prevCursor = instanceState.cursor.type;
7799
7751
  }
7800
- case "ArrowDown": {
7801
- offset = new import_Vec.Vec(0, 1);
7802
- break;
7752
+ this.inputs.setIsPanning(true);
7753
+ this.inputs.setIsSpacebarPanning(true);
7754
+ clearTimeout(this._longPressTimeout);
7755
+ this.setCursor({
7756
+ type: this.inputs.getIsPointing() ? "grabbing" : "grab",
7757
+ rotation: 0
7758
+ });
7759
+ }
7760
+ if (this.inputs.getIsSpacebarPanning()) {
7761
+ let offset;
7762
+ switch (info.code) {
7763
+ case "ArrowUp": {
7764
+ offset = new import_Vec.Vec(0, -1);
7765
+ break;
7766
+ }
7767
+ case "ArrowRight": {
7768
+ offset = new import_Vec.Vec(1, 0);
7769
+ break;
7770
+ }
7771
+ case "ArrowDown": {
7772
+ offset = new import_Vec.Vec(0, 1);
7773
+ break;
7774
+ }
7775
+ case "ArrowLeft": {
7776
+ offset = new import_Vec.Vec(-1, 0);
7777
+ break;
7778
+ }
7803
7779
  }
7804
- case "ArrowLeft": {
7805
- offset = new import_Vec.Vec(-1, 0);
7806
- break;
7780
+ if (offset) {
7781
+ const bounds = this.getViewportPageBounds();
7782
+ const next = bounds.clone().translate(offset.mulV({ x: bounds.w, y: bounds.h }));
7783
+ this._animateToViewport(next, { animation: { duration: 320 } });
7807
7784
  }
7808
7785
  }
7809
- if (offset) {
7810
- const bounds = this.getViewportPageBounds();
7811
- const next = bounds.clone().translate(offset.mulV({ x: bounds.w, y: bounds.h }));
7812
- this._animateToViewport(next, { animation: { duration: 320 } });
7813
- }
7814
7786
  }
7815
7787
  break;
7816
7788
  }
7817
7789
  case "key_up": {
7818
7790
  inputs.keys.delete(info.code);
7819
- if (info.code === "Space") {
7820
- if (this.inputs.buttons.has(import_constants.MIDDLE_MOUSE_BUTTON)) {
7821
- } else {
7822
- this.inputs.isPanning = false;
7823
- this.inputs.isSpacebarPanning = false;
7824
- this.setCursor({ type: this._prevCursor, rotation: 0 });
7791
+ if (this.options.spacebarPanning) {
7792
+ if (info.code === "Space") {
7793
+ if (this.inputs.buttons.has(import_constants.MIDDLE_MOUSE_BUTTON)) {
7794
+ } else {
7795
+ this.inputs.setIsPanning(false);
7796
+ this.inputs.setIsSpacebarPanning(false);
7797
+ this.setCursor({ type: this._prevCursor, rotation: 0 });
7798
+ }
7825
7799
  }
7826
7800
  }
7827
7801
  break;
@@ -7874,8 +7848,8 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
7874
7848
  }
7875
7849
  _init = __decoratorStart(_a);
7876
7850
  __decorateElement(_init, 1, "getIsShapeHiddenCache", _getIsShapeHiddenCache_dec, Editor);
7877
- __decorateElement(_init, 1, "getCanUndo", _getCanUndo_dec, Editor);
7878
- __decorateElement(_init, 1, "getCanRedo", _getCanRedo_dec, Editor);
7851
+ __decorateElement(_init, 1, "canUndo", _canUndo_dec, Editor);
7852
+ __decorateElement(_init, 1, "canRedo", _canRedo_dec, Editor);
7879
7853
  __decorateElement(_init, 1, "getPath", _getPath_dec, Editor);
7880
7854
  __decorateElement(_init, 1, "getCurrentTool", _getCurrentTool_dec, Editor);
7881
7855
  __decorateElement(_init, 1, "getCurrentToolId", _getCurrentToolId_dec, Editor);