@tldraw/editor 4.3.0-next.f4772c19540d → 4.4.0-canary.29afdff6bb04

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 (206) hide show
  1. package/README.md +1 -1
  2. package/dist-cjs/index.d.ts +503 -155
  3. package/dist-cjs/index.js +8 -1
  4. package/dist-cjs/index.js.map +2 -2
  5. package/dist-cjs/lib/components/ErrorBoundary.js.map +1 -1
  6. package/dist-cjs/lib/components/GeometryDebuggingView.js +1 -17
  7. package/dist-cjs/lib/components/GeometryDebuggingView.js.map +2 -2
  8. package/dist-cjs/lib/components/default-components/DefaultCanvas.js +4 -5
  9. package/dist-cjs/lib/components/default-components/DefaultCanvas.js.map +2 -2
  10. package/dist-cjs/lib/constants.js +1 -3
  11. package/dist-cjs/lib/constants.js.map +2 -2
  12. package/dist-cjs/lib/editor/Editor.js +346 -291
  13. package/dist-cjs/lib/editor/Editor.js.map +2 -2
  14. package/dist-cjs/lib/editor/bindings/BindingUtil.js.map +2 -2
  15. package/dist-cjs/lib/editor/derivations/bindingsIndex.js.map +2 -2
  16. package/dist-cjs/lib/editor/derivations/notVisibleShapes.js +16 -23
  17. package/dist-cjs/lib/editor/derivations/notVisibleShapes.js.map +3 -3
  18. package/dist-cjs/lib/editor/derivations/parentsToChildren.js +12 -3
  19. package/dist-cjs/lib/editor/derivations/parentsToChildren.js.map +2 -2
  20. package/dist-cjs/lib/editor/managers/ClickManager/ClickManager.js +1 -1
  21. package/dist-cjs/lib/editor/managers/ClickManager/ClickManager.js.map +2 -2
  22. package/dist-cjs/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.js +5 -6
  23. package/dist-cjs/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.js.map +2 -2
  24. package/dist-cjs/lib/editor/managers/InputsManager/InputsManager.js +591 -0
  25. package/dist-cjs/lib/editor/managers/InputsManager/InputsManager.js.map +7 -0
  26. package/dist-cjs/lib/editor/managers/SnapManager/SnapManager.js +1 -1
  27. package/dist-cjs/lib/editor/managers/SnapManager/SnapManager.js.map +2 -2
  28. package/dist-cjs/lib/editor/managers/SpatialIndexManager/RBushIndex.js +144 -0
  29. package/dist-cjs/lib/editor/managers/SpatialIndexManager/RBushIndex.js.map +7 -0
  30. package/dist-cjs/lib/editor/managers/SpatialIndexManager/SpatialIndexManager.js +181 -0
  31. package/dist-cjs/lib/editor/managers/SpatialIndexManager/SpatialIndexManager.js.map +7 -0
  32. package/dist-cjs/lib/editor/managers/TickManager/TickManager.js +1 -22
  33. package/dist-cjs/lib/editor/managers/TickManager/TickManager.js.map +2 -2
  34. package/dist-cjs/lib/editor/shapes/BaseBoxShapeUtil.js.map +1 -1
  35. package/dist-cjs/lib/editor/shapes/ShapeUtil.js +31 -23
  36. package/dist-cjs/lib/editor/shapes/ShapeUtil.js.map +2 -2
  37. package/dist-cjs/lib/editor/shapes/group/DashedOutlineBox.js +1 -1
  38. package/dist-cjs/lib/editor/shapes/group/DashedOutlineBox.js.map +2 -2
  39. package/dist-cjs/lib/editor/shapes/group/GroupShapeUtil.js.map +2 -2
  40. package/dist-cjs/lib/editor/tools/BaseBoxShapeTool/BaseBoxShapeTool.js.map +2 -2
  41. package/dist-cjs/lib/editor/tools/BaseBoxShapeTool/children/Pointing.js +3 -3
  42. package/dist-cjs/lib/editor/tools/BaseBoxShapeTool/children/Pointing.js.map +2 -2
  43. package/dist-cjs/lib/editor/types/emit-types.js.map +1 -1
  44. package/dist-cjs/lib/exports/getSvgJsx.js.map +2 -2
  45. package/dist-cjs/lib/exports/parseCss.js +1 -1
  46. package/dist-cjs/lib/exports/parseCss.js.map +2 -2
  47. package/dist-cjs/lib/globals/environment.js +45 -9
  48. package/dist-cjs/lib/globals/environment.js.map +2 -2
  49. package/dist-cjs/lib/globals/menus.js +1 -1
  50. package/dist-cjs/lib/globals/menus.js.map +2 -2
  51. package/dist-cjs/lib/hooks/useCoarsePointer.js +14 -29
  52. package/dist-cjs/lib/hooks/useCoarsePointer.js.map +2 -2
  53. package/dist-cjs/lib/hooks/useEvent.js +1 -1
  54. package/dist-cjs/lib/hooks/useEvent.js.map +2 -2
  55. package/dist-cjs/lib/hooks/useFixSafariDoubleTapZoomPencilEvents.js.map +2 -2
  56. package/dist-cjs/lib/hooks/useGestureEvents.js +1 -1
  57. package/dist-cjs/lib/hooks/useGestureEvents.js.map +2 -2
  58. package/dist-cjs/lib/hooks/usePassThroughMouseOverEvents.js.map +2 -2
  59. package/dist-cjs/lib/hooks/usePassThroughWheelEvents.js.map +2 -2
  60. package/dist-cjs/lib/hooks/useScreenBounds.js.map +2 -2
  61. package/dist-cjs/lib/hooks/useStateAttribute.js +4 -1
  62. package/dist-cjs/lib/hooks/useStateAttribute.js.map +2 -2
  63. package/dist-cjs/lib/hooks/useTransform.js.map +1 -1
  64. package/dist-cjs/lib/hooks/useZoomCss.js +4 -8
  65. package/dist-cjs/lib/hooks/useZoomCss.js.map +2 -2
  66. package/dist-cjs/lib/options.js +6 -1
  67. package/dist-cjs/lib/options.js.map +2 -2
  68. package/dist-cjs/lib/primitives/Box.js +3 -0
  69. package/dist-cjs/lib/primitives/Box.js.map +2 -2
  70. package/dist-cjs/lib/primitives/geometry/Geometry2d.js +1 -0
  71. package/dist-cjs/lib/primitives/geometry/Geometry2d.js.map +2 -2
  72. package/dist-cjs/lib/utils/reparenting.js.map +2 -2
  73. package/dist-cjs/lib/utils/rotation.js +1 -1
  74. package/dist-cjs/lib/utils/rotation.js.map +2 -2
  75. package/dist-cjs/version.js +3 -3
  76. package/dist-cjs/version.js.map +1 -1
  77. package/dist-esm/index.d.mts +503 -155
  78. package/dist-esm/index.mjs +9 -2
  79. package/dist-esm/index.mjs.map +2 -2
  80. package/dist-esm/lib/components/ErrorBoundary.mjs.map +1 -1
  81. package/dist-esm/lib/components/GeometryDebuggingView.mjs +1 -17
  82. package/dist-esm/lib/components/GeometryDebuggingView.mjs.map +2 -2
  83. package/dist-esm/lib/components/default-components/DefaultCanvas.mjs +4 -5
  84. package/dist-esm/lib/components/default-components/DefaultCanvas.mjs.map +2 -2
  85. package/dist-esm/lib/constants.mjs +1 -3
  86. package/dist-esm/lib/constants.mjs.map +2 -2
  87. package/dist-esm/lib/editor/Editor.mjs +347 -294
  88. package/dist-esm/lib/editor/Editor.mjs.map +2 -2
  89. package/dist-esm/lib/editor/bindings/BindingUtil.mjs.map +2 -2
  90. package/dist-esm/lib/editor/derivations/bindingsIndex.mjs.map +2 -2
  91. package/dist-esm/lib/editor/derivations/notVisibleShapes.mjs +16 -23
  92. package/dist-esm/lib/editor/derivations/notVisibleShapes.mjs.map +3 -3
  93. package/dist-esm/lib/editor/derivations/parentsToChildren.mjs +13 -4
  94. package/dist-esm/lib/editor/derivations/parentsToChildren.mjs.map +2 -2
  95. package/dist-esm/lib/editor/managers/ClickManager/ClickManager.mjs +1 -1
  96. package/dist-esm/lib/editor/managers/ClickManager/ClickManager.mjs.map +2 -2
  97. package/dist-esm/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.mjs +5 -6
  98. package/dist-esm/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.mjs.map +2 -2
  99. package/dist-esm/lib/editor/managers/InputsManager/InputsManager.mjs +573 -0
  100. package/dist-esm/lib/editor/managers/InputsManager/InputsManager.mjs.map +7 -0
  101. package/dist-esm/lib/editor/managers/SnapManager/SnapManager.mjs +1 -1
  102. package/dist-esm/lib/editor/managers/SnapManager/SnapManager.mjs.map +2 -2
  103. package/dist-esm/lib/editor/managers/SpatialIndexManager/RBushIndex.mjs +114 -0
  104. package/dist-esm/lib/editor/managers/SpatialIndexManager/RBushIndex.mjs.map +7 -0
  105. package/dist-esm/lib/editor/managers/SpatialIndexManager/SpatialIndexManager.mjs +161 -0
  106. package/dist-esm/lib/editor/managers/SpatialIndexManager/SpatialIndexManager.mjs.map +7 -0
  107. package/dist-esm/lib/editor/managers/TickManager/TickManager.mjs +1 -22
  108. package/dist-esm/lib/editor/managers/TickManager/TickManager.mjs.map +2 -2
  109. package/dist-esm/lib/editor/shapes/BaseBoxShapeUtil.mjs.map +1 -1
  110. package/dist-esm/lib/editor/shapes/ShapeUtil.mjs +31 -23
  111. package/dist-esm/lib/editor/shapes/ShapeUtil.mjs.map +2 -2
  112. package/dist-esm/lib/editor/shapes/group/DashedOutlineBox.mjs +1 -1
  113. package/dist-esm/lib/editor/shapes/group/DashedOutlineBox.mjs.map +2 -2
  114. package/dist-esm/lib/editor/shapes/group/GroupShapeUtil.mjs.map +2 -2
  115. package/dist-esm/lib/editor/tools/BaseBoxShapeTool/BaseBoxShapeTool.mjs.map +2 -2
  116. package/dist-esm/lib/editor/tools/BaseBoxShapeTool/children/Pointing.mjs +3 -3
  117. package/dist-esm/lib/editor/tools/BaseBoxShapeTool/children/Pointing.mjs.map +2 -2
  118. package/dist-esm/lib/exports/getSvgJsx.mjs.map +2 -2
  119. package/dist-esm/lib/exports/parseCss.mjs +1 -1
  120. package/dist-esm/lib/exports/parseCss.mjs.map +2 -2
  121. package/dist-esm/lib/globals/environment.mjs +45 -9
  122. package/dist-esm/lib/globals/environment.mjs.map +2 -2
  123. package/dist-esm/lib/globals/menus.mjs +1 -1
  124. package/dist-esm/lib/globals/menus.mjs.map +2 -2
  125. package/dist-esm/lib/hooks/useCoarsePointer.mjs +15 -30
  126. package/dist-esm/lib/hooks/useCoarsePointer.mjs.map +2 -2
  127. package/dist-esm/lib/hooks/useEvent.mjs +1 -1
  128. package/dist-esm/lib/hooks/useEvent.mjs.map +2 -2
  129. package/dist-esm/lib/hooks/useFixSafariDoubleTapZoomPencilEvents.mjs.map +2 -2
  130. package/dist-esm/lib/hooks/useGestureEvents.mjs +1 -1
  131. package/dist-esm/lib/hooks/useGestureEvents.mjs.map +2 -2
  132. package/dist-esm/lib/hooks/usePassThroughMouseOverEvents.mjs.map +2 -2
  133. package/dist-esm/lib/hooks/usePassThroughWheelEvents.mjs.map +2 -2
  134. package/dist-esm/lib/hooks/useScreenBounds.mjs.map +2 -2
  135. package/dist-esm/lib/hooks/useStateAttribute.mjs +4 -1
  136. package/dist-esm/lib/hooks/useStateAttribute.mjs.map +2 -2
  137. package/dist-esm/lib/hooks/useTransform.mjs.map +1 -1
  138. package/dist-esm/lib/hooks/useZoomCss.mjs +4 -8
  139. package/dist-esm/lib/hooks/useZoomCss.mjs.map +2 -2
  140. package/dist-esm/lib/options.mjs +6 -1
  141. package/dist-esm/lib/options.mjs.map +2 -2
  142. package/dist-esm/lib/primitives/Box.mjs +3 -0
  143. package/dist-esm/lib/primitives/Box.mjs.map +2 -2
  144. package/dist-esm/lib/primitives/geometry/Geometry2d.mjs +1 -0
  145. package/dist-esm/lib/primitives/geometry/Geometry2d.mjs.map +2 -2
  146. package/dist-esm/lib/utils/reparenting.mjs.map +2 -2
  147. package/dist-esm/lib/utils/rotation.mjs +1 -1
  148. package/dist-esm/lib/utils/rotation.mjs.map +2 -2
  149. package/dist-esm/version.mjs +3 -3
  150. package/dist-esm/version.mjs.map +1 -1
  151. package/editor.css +14 -12
  152. package/package.json +21 -17
  153. package/src/index.ts +5 -1
  154. package/src/lib/components/ErrorBoundary.tsx +1 -1
  155. package/src/lib/components/GeometryDebuggingView.tsx +1 -19
  156. package/src/lib/components/default-components/DefaultCanvas.tsx +5 -8
  157. package/src/lib/config/TLUserPreferences.test.ts +40 -0
  158. package/src/lib/constants.ts +0 -2
  159. package/src/lib/editor/Editor.test.ts +150 -10
  160. package/src/lib/editor/Editor.ts +533 -384
  161. package/src/lib/editor/bindings/BindingUtil.ts +15 -9
  162. package/src/lib/editor/derivations/bindingsIndex.ts +2 -2
  163. package/src/lib/editor/derivations/notVisibleShapes.ts +21 -33
  164. package/src/lib/editor/derivations/parentsToChildren.ts +18 -7
  165. package/src/lib/editor/managers/ClickManager/ClickManager.test.ts +17 -31
  166. package/src/lib/editor/managers/ClickManager/ClickManager.ts +1 -1
  167. package/src/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.test.ts +129 -79
  168. package/src/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.ts +10 -6
  169. package/src/lib/editor/managers/FontManager/FontManager.test.ts +14 -4
  170. package/src/lib/editor/managers/InputsManager/InputsManager.ts +566 -0
  171. package/src/lib/editor/managers/ScribbleManager/ScribbleManager.test.ts +0 -4
  172. package/src/lib/editor/managers/SnapManager/SnapManager.test.ts +12 -0
  173. package/src/lib/editor/managers/SnapManager/SnapManager.ts +4 -4
  174. package/src/lib/editor/managers/SpatialIndexManager/RBushIndex.ts +144 -0
  175. package/src/lib/editor/managers/SpatialIndexManager/SpatialIndexManager.ts +215 -0
  176. package/src/lib/editor/managers/TickManager/TickManager.test.ts +40 -107
  177. package/src/lib/editor/managers/TickManager/TickManager.ts +2 -32
  178. package/src/lib/editor/shapes/BaseBoxShapeUtil.tsx +2 -2
  179. package/src/lib/editor/shapes/ShapeUtil.ts +72 -32
  180. package/src/lib/editor/shapes/group/DashedOutlineBox.tsx +1 -1
  181. package/src/lib/editor/shapes/group/GroupShapeUtil.tsx +1 -3
  182. package/src/lib/editor/tools/BaseBoxShapeTool/BaseBoxShapeTool.ts +2 -1
  183. package/src/lib/editor/tools/BaseBoxShapeTool/children/Pointing.ts +6 -6
  184. package/src/lib/editor/types/emit-types.ts +3 -1
  185. package/src/lib/exports/getSvgJsx.test.ts +10 -19
  186. package/src/lib/exports/getSvgJsx.tsx +2 -5
  187. package/src/lib/exports/parseCss.test.ts +1 -0
  188. package/src/lib/exports/parseCss.ts +1 -1
  189. package/src/lib/globals/environment.ts +65 -10
  190. package/src/lib/globals/menus.ts +1 -1
  191. package/src/lib/hooks/useCoarsePointer.ts +16 -59
  192. package/src/lib/hooks/useEvent.tsx +1 -1
  193. package/src/lib/hooks/useFixSafariDoubleTapZoomPencilEvents.ts +1 -1
  194. package/src/lib/hooks/useGestureEvents.ts +2 -2
  195. package/src/lib/hooks/usePassThroughMouseOverEvents.ts +1 -1
  196. package/src/lib/hooks/usePassThroughWheelEvents.ts +1 -1
  197. package/src/lib/hooks/useScreenBounds.ts +1 -1
  198. package/src/lib/hooks/useStateAttribute.ts +4 -1
  199. package/src/lib/hooks/useTransform.ts +1 -1
  200. package/src/lib/hooks/useZoomCss.ts +3 -8
  201. package/src/lib/options.ts +32 -0
  202. package/src/lib/primitives/Box.ts +9 -0
  203. package/src/lib/primitives/geometry/Geometry2d.ts +1 -0
  204. package/src/lib/utils/reparenting.ts +5 -5
  205. package/src/lib/utils/rotation.ts +1 -1
  206. package/src/version.ts +3 -3
@@ -0,0 +1,591 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __knownSymbol = (name, symbol) => (symbol = Symbol[name]) ? symbol : Symbol.for("Symbol." + name);
8
+ var __typeError = (msg) => {
9
+ throw TypeError(msg);
10
+ };
11
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
13
+ var __export = (target, all) => {
14
+ for (var name in all)
15
+ __defProp(target, name, { get: all[name], enumerable: true });
16
+ };
17
+ var __copyProps = (to, from, except, desc) => {
18
+ if (from && typeof from === "object" || typeof from === "function") {
19
+ for (let key of __getOwnPropNames(from))
20
+ if (!__hasOwnProp.call(to, key) && key !== except)
21
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
22
+ }
23
+ return to;
24
+ };
25
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
26
+ var __decoratorStart = (base) => [, , , __create(base?.[__knownSymbol("metadata")] ?? null)];
27
+ var __decoratorStrings = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
28
+ var __expectFn = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError("Function expected") : fn;
29
+ var __decoratorContext = (kind, name, done, metadata, fns) => ({ kind: __decoratorStrings[kind], name, metadata, addInitializer: (fn) => done._ ? __typeError("Already initialized") : fns.push(__expectFn(fn || null)) });
30
+ var __decoratorMetadata = (array, target) => __defNormalProp(target, __knownSymbol("metadata"), array[3]);
31
+ var __runInitializers = (array, flags, self, value) => {
32
+ for (var i = 0, fns = array[flags >> 1], n = fns && fns.length; i < n; i++) flags & 1 ? fns[i].call(self) : value = fns[i].call(self, value);
33
+ return value;
34
+ };
35
+ var __decorateElement = (array, flags, name, decorators, target, extra) => {
36
+ var fn, it, done, ctx, access, k = flags & 7, s = !!(flags & 8), p = !!(flags & 16);
37
+ var j = k > 3 ? array.length + 1 : k ? s ? 1 : 2 : 0, key = __decoratorStrings[k + 5];
38
+ var initializers = k > 3 && (array[j - 1] = []), extraInitializers = array[j] || (array[j] = []);
39
+ var desc = k && (!p && !s && (target = target.prototype), k < 5 && (k > 3 || !p) && __getOwnPropDesc(k < 4 ? target : { get [name]() {
40
+ return __privateGet(this, extra);
41
+ }, set [name](x) {
42
+ return __privateSet(this, extra, x);
43
+ } }, name));
44
+ k ? p && k < 4 && __name(extra, (k > 2 ? "set " : k > 1 ? "get " : "") + name) : __name(target, name);
45
+ for (var i = decorators.length - 1; i >= 0; i--) {
46
+ ctx = __decoratorContext(k, name, done = {}, array[3], extraInitializers);
47
+ if (k) {
48
+ ctx.static = s, ctx.private = p, access = ctx.access = { has: p ? (x) => __privateIn(target, x) : (x) => name in x };
49
+ if (k ^ 3) access.get = p ? (x) => (k ^ 1 ? __privateGet : __privateMethod)(x, target, k ^ 4 ? extra : desc.get) : (x) => x[name];
50
+ if (k > 2) access.set = p ? (x, y) => __privateSet(x, target, y, k ^ 4 ? extra : desc.set) : (x, y) => x[name] = y;
51
+ }
52
+ it = (0, decorators[i])(k ? k < 4 ? p ? extra : desc[key] : k > 4 ? void 0 : { get: desc.get, set: desc.set } : target, ctx), done._ = 1;
53
+ if (k ^ 4 || it === void 0) __expectFn(it) && (k > 4 ? initializers.unshift(it) : k ? p ? extra = it : desc[key] = it : target = it);
54
+ else if (typeof it !== "object" || it === null) __typeError("Object expected");
55
+ else __expectFn(fn = it.get) && (desc.get = fn), __expectFn(fn = it.set) && (desc.set = fn), __expectFn(fn = it.init) && initializers.unshift(fn);
56
+ }
57
+ return k || __decoratorMetadata(array, target), desc && __defProp(target, name, desc), p ? k ^ 4 ? extra : desc : target;
58
+ };
59
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
60
+ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
61
+ var __privateIn = (member, obj) => Object(obj) !== obj ? __typeError('Cannot use the "in" operator on this value') : member.has(obj);
62
+ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
63
+ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
64
+ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
65
+ var InputsManager_exports = {};
66
+ __export(InputsManager_exports, {
67
+ InputsManager: () => InputsManager
68
+ });
69
+ module.exports = __toCommonJS(InputsManager_exports);
70
+ var import_state = require("@tldraw/state");
71
+ var import_store = require("@tldraw/store");
72
+ var import_tlschema = require("@tldraw/tlschema");
73
+ var import_constants = require("../../../constants");
74
+ var import_Vec = require("../../../primitives/Vec");
75
+ var import_keyboard = require("../../../utils/keyboard");
76
+ var __getHasCollaborators_dec, _init;
77
+ __getHasCollaborators_dec = [import_state.computed];
78
+ class InputsManager {
79
+ constructor(editor) {
80
+ this.editor = editor;
81
+ __runInitializers(_init, 5, this);
82
+ __publicField(this, "_originPagePoint", (0, import_state.atom)("originPagePoint", new import_Vec.Vec()));
83
+ __publicField(this, "_originScreenPoint", (0, import_state.atom)("originScreenPoint", new import_Vec.Vec()));
84
+ __publicField(this, "_previousPagePoint", (0, import_state.atom)("previousPagePoint", new import_Vec.Vec()));
85
+ __publicField(this, "_previousScreenPoint", (0, import_state.atom)("previousScreenPoint", new import_Vec.Vec()));
86
+ __publicField(this, "_currentPagePoint", (0, import_state.atom)("currentPagePoint", new import_Vec.Vec()));
87
+ __publicField(this, "_currentScreenPoint", (0, import_state.atom)("currentScreenPoint", new import_Vec.Vec()));
88
+ __publicField(this, "_pointerVelocity", (0, import_state.atom)("pointerVelocity", new import_Vec.Vec()));
89
+ /**
90
+ * A set containing the currently pressed keys.
91
+ */
92
+ __publicField(this, "keys", new import_store.AtomSet("keys"));
93
+ /**
94
+ * A set containing the currently pressed buttons.
95
+ */
96
+ __publicField(this, "buttons", new import_store.AtomSet("buttons"));
97
+ __publicField(this, "_isPen", (0, import_state.atom)("isPen", false));
98
+ __publicField(this, "_shiftKey", (0, import_state.atom)("shiftKey", false));
99
+ __publicField(this, "_metaKey", (0, import_state.atom)("metaKey", false));
100
+ __publicField(this, "_ctrlKey", (0, import_state.atom)("ctrlKey", false));
101
+ __publicField(this, "_altKey", (0, import_state.atom)("altKey", false));
102
+ __publicField(this, "_isDragging", (0, import_state.atom)("isDragging", false));
103
+ __publicField(this, "_isPointing", (0, import_state.atom)("isPointing", false));
104
+ __publicField(this, "_isPinching", (0, import_state.atom)("isPinching", false));
105
+ __publicField(this, "_isEditing", (0, import_state.atom)("isEditing", false));
106
+ __publicField(this, "_isPanning", (0, import_state.atom)("isPanning", false));
107
+ __publicField(this, "_isSpacebarPanning", (0, import_state.atom)("isSpacebarPanning", false));
108
+ /**
109
+ * The previous point used for velocity calculation (updated each tick, not each pointer event).
110
+ * @internal
111
+ */
112
+ __publicField(this, "_velocityPrevPoint", new import_Vec.Vec());
113
+ }
114
+ /**
115
+ * The most recent pointer down's position in the current page space.
116
+ */
117
+ getOriginPagePoint() {
118
+ return this._originPagePoint.get();
119
+ }
120
+ /**
121
+ * @deprecated Use `getOriginPagePoint()` instead.
122
+ */
123
+ // eslint-disable-next-line no-restricted-syntax
124
+ get originPagePoint() {
125
+ return this.getOriginPagePoint();
126
+ }
127
+ /**
128
+ * The most recent pointer down's position in screen space.
129
+ */
130
+ getOriginScreenPoint() {
131
+ return this._originScreenPoint.get();
132
+ }
133
+ /**
134
+ * @deprecated Use `getOriginScreenPoint()` instead.
135
+ */
136
+ // eslint-disable-next-line no-restricted-syntax
137
+ get originScreenPoint() {
138
+ return this.getOriginScreenPoint();
139
+ }
140
+ /**
141
+ * The previous pointer position in the current page space.
142
+ */
143
+ getPreviousPagePoint() {
144
+ return this._previousPagePoint.get();
145
+ }
146
+ /**
147
+ * @deprecated Use `getPreviousPagePoint()` instead.
148
+ */
149
+ // eslint-disable-next-line no-restricted-syntax
150
+ get previousPagePoint() {
151
+ return this.getPreviousPagePoint();
152
+ }
153
+ /**
154
+ * The previous pointer position in screen space.
155
+ */
156
+ getPreviousScreenPoint() {
157
+ return this._previousScreenPoint.get();
158
+ }
159
+ /**
160
+ * @deprecated Use `getPreviousScreenPoint()` instead.
161
+ */
162
+ // eslint-disable-next-line no-restricted-syntax
163
+ get previousScreenPoint() {
164
+ return this.getPreviousScreenPoint();
165
+ }
166
+ /**
167
+ * The most recent pointer position in the current page space.
168
+ */
169
+ getCurrentPagePoint() {
170
+ return this._currentPagePoint.get();
171
+ }
172
+ /**
173
+ * @deprecated Use `getCurrentPagePoint()` instead.
174
+ */
175
+ // eslint-disable-next-line no-restricted-syntax
176
+ get currentPagePoint() {
177
+ return this.getCurrentPagePoint();
178
+ }
179
+ /**
180
+ * The most recent pointer position in screen space.
181
+ */
182
+ getCurrentScreenPoint() {
183
+ return this._currentScreenPoint.get();
184
+ }
185
+ /**
186
+ * @deprecated Use `getCurrentScreenPoint()` instead.
187
+ */
188
+ // eslint-disable-next-line no-restricted-syntax
189
+ get currentScreenPoint() {
190
+ return this.getCurrentScreenPoint();
191
+ }
192
+ /**
193
+ * Velocity of mouse pointer, in pixels per millisecond.
194
+ */
195
+ getPointerVelocity() {
196
+ return this._pointerVelocity.get();
197
+ }
198
+ /**
199
+ * @deprecated Use `getPointerVelocity()` instead.
200
+ */
201
+ // eslint-disable-next-line no-restricted-syntax
202
+ get pointerVelocity() {
203
+ return this.getPointerVelocity();
204
+ }
205
+ /**
206
+ * Normally you shouldn't need to set the pointer velocity directly, this is set by the tick manager.
207
+ * However, this is currently used in tests to fake pointer velocity.
208
+ * @param pointerVelocity - The pointer velocity.
209
+ * @internal
210
+ */
211
+ setPointerVelocity(pointerVelocity) {
212
+ this._pointerVelocity.set(pointerVelocity);
213
+ }
214
+ /**
215
+ * Whether the input is from a pen.
216
+ */
217
+ getIsPen() {
218
+ return this._isPen.get();
219
+ }
220
+ /**
221
+ * @deprecated Use `getIsPen()` instead.
222
+ */
223
+ // eslint-disable-next-line no-restricted-syntax
224
+ get isPen() {
225
+ return this.getIsPen();
226
+ }
227
+ // eslint-disable-next-line no-restricted-syntax
228
+ set isPen(isPen) {
229
+ this.setIsPen(isPen);
230
+ }
231
+ /**
232
+ * @param isPen - Whether the input is from a pen.
233
+ */
234
+ setIsPen(isPen) {
235
+ this._isPen.set(isPen);
236
+ }
237
+ /**
238
+ * Whether the shift key is currently pressed.
239
+ */
240
+ getShiftKey() {
241
+ return this._shiftKey.get();
242
+ }
243
+ /**
244
+ * @deprecated Use `getShiftKey()` instead.
245
+ */
246
+ // eslint-disable-next-line no-restricted-syntax
247
+ get shiftKey() {
248
+ return this.getShiftKey();
249
+ }
250
+ // eslint-disable-next-line no-restricted-syntax
251
+ set shiftKey(shiftKey) {
252
+ this.setShiftKey(shiftKey);
253
+ }
254
+ /**
255
+ * @param shiftKey - Whether the shift key is pressed.
256
+ * @internal
257
+ */
258
+ setShiftKey(shiftKey) {
259
+ this._shiftKey.set(shiftKey);
260
+ }
261
+ /**
262
+ * Whether the meta key is currently pressed.
263
+ */
264
+ getMetaKey() {
265
+ return this._metaKey.get();
266
+ }
267
+ /**
268
+ * @deprecated Use `getMetaKey()` instead.
269
+ */
270
+ // eslint-disable-next-line no-restricted-syntax
271
+ get metaKey() {
272
+ return this.getMetaKey();
273
+ }
274
+ // eslint-disable-next-line no-restricted-syntax
275
+ set metaKey(metaKey) {
276
+ this.setMetaKey(metaKey);
277
+ }
278
+ /**
279
+ * @param metaKey - Whether the meta key is pressed.
280
+ * @internal
281
+ */
282
+ setMetaKey(metaKey) {
283
+ this._metaKey.set(metaKey);
284
+ }
285
+ /**
286
+ * Whether the ctrl or command key is currently pressed.
287
+ */
288
+ getCtrlKey() {
289
+ return this._ctrlKey.get();
290
+ }
291
+ /**
292
+ * @deprecated Use `getCtrlKey()` instead.
293
+ */
294
+ // eslint-disable-next-line no-restricted-syntax
295
+ get ctrlKey() {
296
+ return this.getCtrlKey();
297
+ }
298
+ // eslint-disable-next-line no-restricted-syntax
299
+ set ctrlKey(ctrlKey) {
300
+ this.setCtrlKey(ctrlKey);
301
+ }
302
+ /**
303
+ * @param ctrlKey - Whether the ctrl key is pressed.
304
+ * @internal
305
+ */
306
+ setCtrlKey(ctrlKey) {
307
+ this._ctrlKey.set(ctrlKey);
308
+ }
309
+ /**
310
+ * Whether the alt or option key is currently pressed.
311
+ */
312
+ getAltKey() {
313
+ return this._altKey.get();
314
+ }
315
+ /**
316
+ * @deprecated Use `getAltKey()` instead.
317
+ */
318
+ // eslint-disable-next-line no-restricted-syntax
319
+ get altKey() {
320
+ return this.getAltKey();
321
+ }
322
+ // eslint-disable-next-line no-restricted-syntax
323
+ set altKey(altKey) {
324
+ this.setAltKey(altKey);
325
+ }
326
+ /**
327
+ * @param altKey - Whether the alt key is pressed.
328
+ * @internal
329
+ */
330
+ setAltKey(altKey) {
331
+ this._altKey.set(altKey);
332
+ }
333
+ /**
334
+ * Is the accelerator key (cmd on mac, ctrl elsewhere) currently pressed.
335
+ */
336
+ getAccelKey() {
337
+ return (0, import_keyboard.isAccelKey)({ metaKey: this.getMetaKey(), ctrlKey: this.getCtrlKey() });
338
+ }
339
+ /**
340
+ * @deprecated Use `getAccelKey()` instead.
341
+ */
342
+ // eslint-disable-next-line no-restricted-syntax
343
+ get accelKey() {
344
+ return this.getAccelKey();
345
+ }
346
+ /**
347
+ * Whether the user is dragging.
348
+ */
349
+ getIsDragging() {
350
+ return this._isDragging.get();
351
+ }
352
+ /**
353
+ * Soon to be deprecated, use `getIsDragging()` instead.
354
+ */
355
+ // eslint-disable-next-line no-restricted-syntax
356
+ get isDragging() {
357
+ return this.getIsDragging();
358
+ }
359
+ // eslint-disable-next-line no-restricted-syntax
360
+ set isDragging(isDragging) {
361
+ this.setIsDragging(isDragging);
362
+ }
363
+ /**
364
+ * @param isDragging - Whether the user is dragging.
365
+ */
366
+ setIsDragging(isDragging) {
367
+ this._isDragging.set(isDragging);
368
+ }
369
+ /**
370
+ * Whether the user is pointing.
371
+ */
372
+ getIsPointing() {
373
+ return this._isPointing.get();
374
+ }
375
+ /**
376
+ * @deprecated Use `getIsPointing()` instead.
377
+ */
378
+ // eslint-disable-next-line no-restricted-syntax
379
+ get isPointing() {
380
+ return this.getIsPointing();
381
+ }
382
+ // eslint-disable-next-line no-restricted-syntax
383
+ set isPointing(isPointing) {
384
+ this.setIsPointing(isPointing);
385
+ }
386
+ /**
387
+ * @param isPointing - Whether the user is pointing.
388
+ * @internal
389
+ */
390
+ setIsPointing(isPointing) {
391
+ this._isPointing.set(isPointing);
392
+ }
393
+ /**
394
+ * Whether the user is pinching.
395
+ */
396
+ getIsPinching() {
397
+ return this._isPinching.get();
398
+ }
399
+ /**
400
+ * @deprecated Use `getIsPinching()` instead.
401
+ */
402
+ // eslint-disable-next-line no-restricted-syntax
403
+ get isPinching() {
404
+ return this.getIsPinching();
405
+ }
406
+ // eslint-disable-next-line no-restricted-syntax
407
+ set isPinching(isPinching) {
408
+ this.setIsPinching(isPinching);
409
+ }
410
+ /**
411
+ * @param isPinching - Whether the user is pinching.
412
+ * @internal
413
+ */
414
+ setIsPinching(isPinching) {
415
+ this._isPinching.set(isPinching);
416
+ }
417
+ /**
418
+ * Whether the user is editing.
419
+ */
420
+ getIsEditing() {
421
+ return this._isEditing.get();
422
+ }
423
+ /**
424
+ * @deprecated Use `getIsEditing()` instead.
425
+ */
426
+ // eslint-disable-next-line no-restricted-syntax
427
+ get isEditing() {
428
+ return this.getIsEditing();
429
+ }
430
+ // eslint-disable-next-line no-restricted-syntax
431
+ set isEditing(isEditing) {
432
+ this.setIsEditing(isEditing);
433
+ }
434
+ /**
435
+ * @param isEditing - Whether the user is editing.
436
+ */
437
+ setIsEditing(isEditing) {
438
+ this._isEditing.set(isEditing);
439
+ }
440
+ /**
441
+ * Whether the user is panning.
442
+ */
443
+ getIsPanning() {
444
+ return this._isPanning.get();
445
+ }
446
+ /**
447
+ * @deprecated Use `getIsPanning()` instead.
448
+ */
449
+ // eslint-disable-next-line no-restricted-syntax
450
+ get isPanning() {
451
+ return this.getIsPanning();
452
+ }
453
+ // eslint-disable-next-line no-restricted-syntax
454
+ set isPanning(isPanning) {
455
+ this.setIsPanning(isPanning);
456
+ }
457
+ /**
458
+ * @param isPanning - Whether the user is panning.
459
+ * @internal
460
+ */
461
+ setIsPanning(isPanning) {
462
+ this._isPanning.set(isPanning);
463
+ }
464
+ /**
465
+ * Whether the user is spacebar panning.
466
+ */
467
+ getIsSpacebarPanning() {
468
+ return this._isSpacebarPanning.get();
469
+ }
470
+ /**
471
+ * @deprecated Use `getIsSpacebarPanning()` instead.
472
+ */
473
+ // eslint-disable-next-line no-restricted-syntax
474
+ get isSpacebarPanning() {
475
+ return this.getIsSpacebarPanning();
476
+ }
477
+ // eslint-disable-next-line no-restricted-syntax
478
+ set isSpacebarPanning(isSpacebarPanning) {
479
+ this.setIsSpacebarPanning(isSpacebarPanning);
480
+ }
481
+ /**
482
+ * @param isSpacebarPanning - Whether the user is spacebar panning.
483
+ * @internal
484
+ */
485
+ setIsSpacebarPanning(isSpacebarPanning) {
486
+ this._isSpacebarPanning.set(isSpacebarPanning);
487
+ }
488
+ _getHasCollaborators() {
489
+ return this.editor.getCollaborators().length > 0;
490
+ }
491
+ /**
492
+ * Update the pointer velocity based on elapsed time. Called by the tick manager.
493
+ * @param elapsed - The time elapsed since the last tick in milliseconds.
494
+ * @internal
495
+ */
496
+ updatePointerVelocity(elapsed) {
497
+ const currentScreenPoint = this.getCurrentScreenPoint();
498
+ const pointerVelocity = this.getPointerVelocity();
499
+ if (elapsed === 0) return;
500
+ const delta = import_Vec.Vec.Sub(currentScreenPoint, this._velocityPrevPoint);
501
+ this._velocityPrevPoint = currentScreenPoint.clone();
502
+ const length = delta.len();
503
+ const direction = length ? delta.div(length) : new import_Vec.Vec(0, 0);
504
+ const next = pointerVelocity.clone().lrp(direction.mul(length / elapsed), 0.5);
505
+ if (Math.abs(next.x) < 0.01) next.x = 0;
506
+ if (Math.abs(next.y) < 0.01) next.y = 0;
507
+ if (!pointerVelocity.equals(next)) {
508
+ this._pointerVelocity.set(next);
509
+ }
510
+ }
511
+ /**
512
+ * Update the input points from a pointer, pinch, or wheel event.
513
+ *
514
+ * @param info - The event info.
515
+ * @internal
516
+ */
517
+ updateFromEvent(info) {
518
+ const currentScreenPoint = this._currentScreenPoint.__unsafe__getWithoutCapture();
519
+ const currentPagePoint = this._currentPagePoint.__unsafe__getWithoutCapture();
520
+ const isPinching = this._isPinching.__unsafe__getWithoutCapture();
521
+ const { screenBounds } = this.editor.store.unsafeGetWithoutCapture(import_tlschema.TLINSTANCE_ID);
522
+ const { x: cx, y: cy, z: cz } = (0, import_state.unsafe__withoutCapture)(() => this.editor.getCamera());
523
+ const sx = info.point.x - screenBounds.x;
524
+ const sy = info.point.y - screenBounds.y;
525
+ const sz = info.point.z ?? 0.5;
526
+ this._previousScreenPoint.set(currentScreenPoint);
527
+ this._previousPagePoint.set(currentPagePoint);
528
+ this._currentScreenPoint.set(new import_Vec.Vec(sx, sy));
529
+ const nx = sx / cz - cx;
530
+ const ny = sy / cz - cy;
531
+ if (isFinite(nx) && isFinite(ny)) {
532
+ this._currentPagePoint.set(new import_Vec.Vec(nx, ny, sz));
533
+ }
534
+ this._isPen.set(info.type === "pointer" && info.isPen);
535
+ if (info.name === "pointer_down" || isPinching) {
536
+ this._pointerVelocity.set(new import_Vec.Vec());
537
+ this._originScreenPoint.set(this._currentScreenPoint.__unsafe__getWithoutCapture());
538
+ this._originPagePoint.set(this._currentPagePoint.__unsafe__getWithoutCapture());
539
+ }
540
+ if (this._getHasCollaborators()) {
541
+ this.editor.run(
542
+ () => {
543
+ const pagePoint = this._currentPagePoint.__unsafe__getWithoutCapture();
544
+ this.editor.store.put([
545
+ {
546
+ id: import_tlschema.TLPOINTER_ID,
547
+ typeName: "pointer",
548
+ x: pagePoint.x,
549
+ y: pagePoint.y,
550
+ lastActivityTimestamp: (
551
+ // If our pointer moved only because we're following some other user, then don't
552
+ // update our last activity timestamp; otherwise, update it to the current timestamp.
553
+ info.type === "pointer" && info.pointerId === import_constants.INTERNAL_POINTER_IDS.CAMERA_MOVE ? this.editor.store.unsafeGetWithoutCapture(import_tlschema.TLPOINTER_ID)?.lastActivityTimestamp ?? Date.now() : Date.now()
554
+ ),
555
+ meta: {}
556
+ }
557
+ ]);
558
+ },
559
+ { history: "ignore" }
560
+ );
561
+ }
562
+ }
563
+ toJson() {
564
+ return {
565
+ originPagePoint: this._originPagePoint.get().toJson(),
566
+ originScreenPoint: this._originScreenPoint.get().toJson(),
567
+ previousPagePoint: this._previousPagePoint.get().toJson(),
568
+ previousScreenPoint: this._previousScreenPoint.get().toJson(),
569
+ currentPagePoint: this._currentPagePoint.get().toJson(),
570
+ currentScreenPoint: this._currentScreenPoint.get().toJson(),
571
+ pointerVelocity: this._pointerVelocity.get().toJson(),
572
+ shiftKey: this._shiftKey.get(),
573
+ metaKey: this._metaKey.get(),
574
+ ctrlKey: this._ctrlKey.get(),
575
+ altKey: this._altKey.get(),
576
+ isPen: this._isPen.get(),
577
+ isDragging: this._isDragging.get(),
578
+ isPointing: this._isPointing.get(),
579
+ isPinching: this._isPinching.get(),
580
+ isEditing: this._isEditing.get(),
581
+ isPanning: this._isPanning.get(),
582
+ isSpacebarPanning: this._isSpacebarPanning.get(),
583
+ keys: Array.from(this.keys.keys()),
584
+ buttons: Array.from(this.buttons.keys())
585
+ };
586
+ }
587
+ }
588
+ _init = __decoratorStart(null);
589
+ __decorateElement(_init, 1, "_getHasCollaborators", __getHasCollaborators_dec, InputsManager);
590
+ __decoratorMetadata(_init, InputsManager);
591
+ //# sourceMappingURL=InputsManager.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/lib/editor/managers/InputsManager/InputsManager.ts"],
4
+ "sourcesContent": ["import { atom, computed, unsafe__withoutCapture } from '@tldraw/state'\nimport { AtomSet } from '@tldraw/store'\nimport { TLINSTANCE_ID, TLPOINTER_ID } from '@tldraw/tlschema'\nimport { INTERNAL_POINTER_IDS } from '../../../constants'\nimport { Vec } from '../../../primitives/Vec'\nimport { isAccelKey } from '../../../utils/keyboard'\nimport { Editor } from '../../Editor'\nimport { TLPinchEventInfo, TLPointerEventInfo, TLWheelEventInfo } from '../../types/event-types'\n\n/** @public */\nexport class InputsManager {\n\tconstructor(private readonly editor: Editor) {}\n\n\tprivate _originPagePoint = atom<Vec>('originPagePoint', new Vec())\n\t/**\n\t * The most recent pointer down's position in the current page space.\n\t */\n\tgetOriginPagePoint() {\n\t\treturn this._originPagePoint.get()\n\t}\n\t/**\n\t * @deprecated Use `getOriginPagePoint()` instead.\n\t */\n\t// eslint-disable-next-line no-restricted-syntax\n\tget originPagePoint() {\n\t\treturn this.getOriginPagePoint()\n\t}\n\n\tprivate _originScreenPoint = atom<Vec>('originScreenPoint', new Vec())\n\t/**\n\t * The most recent pointer down's position in screen space.\n\t */\n\tgetOriginScreenPoint() {\n\t\treturn this._originScreenPoint.get()\n\t}\n\t/**\n\t * @deprecated Use `getOriginScreenPoint()` instead.\n\t */\n\t// eslint-disable-next-line no-restricted-syntax\n\tget originScreenPoint() {\n\t\treturn this.getOriginScreenPoint()\n\t}\n\n\tprivate _previousPagePoint = atom<Vec>('previousPagePoint', new Vec())\n\t/**\n\t * The previous pointer position in the current page space.\n\t */\n\tgetPreviousPagePoint() {\n\t\treturn this._previousPagePoint.get()\n\t}\n\t/**\n\t * @deprecated Use `getPreviousPagePoint()` instead.\n\t */\n\t// eslint-disable-next-line no-restricted-syntax\n\tget previousPagePoint() {\n\t\treturn this.getPreviousPagePoint()\n\t}\n\n\tprivate _previousScreenPoint = atom<Vec>('previousScreenPoint', new Vec())\n\t/**\n\t * The previous pointer position in screen space.\n\t */\n\tgetPreviousScreenPoint() {\n\t\treturn this._previousScreenPoint.get()\n\t}\n\t/**\n\t * @deprecated Use `getPreviousScreenPoint()` instead.\n\t */\n\t// eslint-disable-next-line no-restricted-syntax\n\tget previousScreenPoint() {\n\t\treturn this.getPreviousScreenPoint()\n\t}\n\n\tprivate _currentPagePoint = atom<Vec>('currentPagePoint', new Vec())\n\t/**\n\t * The most recent pointer position in the current page space.\n\t */\n\tgetCurrentPagePoint() {\n\t\treturn this._currentPagePoint.get()\n\t}\n\t/**\n\t * @deprecated Use `getCurrentPagePoint()` instead.\n\t */\n\t// eslint-disable-next-line no-restricted-syntax\n\tget currentPagePoint() {\n\t\treturn this.getCurrentPagePoint()\n\t}\n\n\tprivate _currentScreenPoint = atom<Vec>('currentScreenPoint', new Vec())\n\t/**\n\t * The most recent pointer position in screen space.\n\t */\n\tgetCurrentScreenPoint() {\n\t\treturn this._currentScreenPoint.get()\n\t}\n\t/**\n\t * @deprecated Use `getCurrentScreenPoint()` instead.\n\t */\n\t// eslint-disable-next-line no-restricted-syntax\n\tget currentScreenPoint() {\n\t\treturn this.getCurrentScreenPoint()\n\t}\n\n\tprivate _pointerVelocity = atom<Vec>('pointerVelocity', new Vec())\n\t/**\n\t * Velocity of mouse pointer, in pixels per millisecond.\n\t */\n\tgetPointerVelocity() {\n\t\treturn this._pointerVelocity.get()\n\t}\n\t/**\n\t * @deprecated Use `getPointerVelocity()` instead.\n\t */\n\t// eslint-disable-next-line no-restricted-syntax\n\tget pointerVelocity() {\n\t\treturn this.getPointerVelocity()\n\t}\n\n\t/**\n\t * Normally you shouldn't need to set the pointer velocity directly, this is set by the tick manager.\n\t * However, this is currently used in tests to fake pointer velocity.\n\t * @param pointerVelocity - The pointer velocity.\n\t * @internal\n\t */\n\tsetPointerVelocity(pointerVelocity: Vec) {\n\t\tthis._pointerVelocity.set(pointerVelocity)\n\t}\n\n\t/**\n\t * A set containing the currently pressed keys.\n\t */\n\treadonly keys = new AtomSet<string>('keys')\n\n\t/**\n\t * A set containing the currently pressed buttons.\n\t */\n\treadonly buttons = new AtomSet<number>('buttons')\n\n\tprivate _isPen = atom<boolean>('isPen', false)\n\n\t/**\n\t * Whether the input is from a pen.\n\t */\n\tgetIsPen() {\n\t\treturn this._isPen.get()\n\t}\n\t/**\n\t * @deprecated Use `getIsPen()` instead.\n\t */\n\t// eslint-disable-next-line no-restricted-syntax\n\tget isPen() {\n\t\treturn this.getIsPen()\n\t}\n\t// eslint-disable-next-line no-restricted-syntax\n\tset isPen(isPen: boolean) {\n\t\tthis.setIsPen(isPen)\n\t}\n\t/**\n\t * @param isPen - Whether the input is from a pen.\n\t */\n\tsetIsPen(isPen: boolean) {\n\t\tthis._isPen.set(isPen)\n\t}\n\n\tprivate _shiftKey = atom<boolean>('shiftKey', false)\n\t/**\n\t * Whether the shift key is currently pressed.\n\t */\n\tgetShiftKey() {\n\t\treturn this._shiftKey.get()\n\t}\n\t/**\n\t * @deprecated Use `getShiftKey()` instead.\n\t */\n\t// eslint-disable-next-line no-restricted-syntax\n\tget shiftKey() {\n\t\treturn this.getShiftKey()\n\t}\n\t// eslint-disable-next-line no-restricted-syntax\n\tset shiftKey(shiftKey: boolean) {\n\t\tthis.setShiftKey(shiftKey)\n\t}\n\t/**\n\t * @param shiftKey - Whether the shift key is pressed.\n\t * @internal\n\t */\n\tsetShiftKey(shiftKey: boolean) {\n\t\tthis._shiftKey.set(shiftKey)\n\t}\n\n\tprivate _metaKey = atom<boolean>('metaKey', false)\n\t/**\n\t * Whether the meta key is currently pressed.\n\t */\n\tgetMetaKey() {\n\t\treturn this._metaKey.get()\n\t}\n\t/**\n\t * @deprecated Use `getMetaKey()` instead.\n\t */\n\t// eslint-disable-next-line no-restricted-syntax\n\tget metaKey() {\n\t\treturn this.getMetaKey()\n\t}\n\t// eslint-disable-next-line no-restricted-syntax\n\tset metaKey(metaKey: boolean) {\n\t\tthis.setMetaKey(metaKey)\n\t}\n\t/**\n\t * @param metaKey - Whether the meta key is pressed.\n\t * @internal\n\t */\n\tsetMetaKey(metaKey: boolean) {\n\t\tthis._metaKey.set(metaKey)\n\t}\n\n\tprivate _ctrlKey = atom<boolean>('ctrlKey', false)\n\t/**\n\t * Whether the ctrl or command key is currently pressed.\n\t */\n\tgetCtrlKey() {\n\t\treturn this._ctrlKey.get()\n\t}\n\t/**\n\t * @deprecated Use `getCtrlKey()` instead.\n\t */\n\t// eslint-disable-next-line no-restricted-syntax\n\tget ctrlKey() {\n\t\treturn this.getCtrlKey()\n\t}\n\t// eslint-disable-next-line no-restricted-syntax\n\tset ctrlKey(ctrlKey: boolean) {\n\t\tthis.setCtrlKey(ctrlKey)\n\t}\n\t/**\n\t * @param ctrlKey - Whether the ctrl key is pressed.\n\t * @internal\n\t */\n\tsetCtrlKey(ctrlKey: boolean) {\n\t\tthis._ctrlKey.set(ctrlKey)\n\t}\n\n\tprivate _altKey = atom<boolean>('altKey', false)\n\t/**\n\t * Whether the alt or option key is currently pressed.\n\t */\n\tgetAltKey() {\n\t\treturn this._altKey.get()\n\t}\n\t/**\n\t * @deprecated Use `getAltKey()` instead.\n\t */\n\t// eslint-disable-next-line no-restricted-syntax\n\tget altKey() {\n\t\treturn this.getAltKey()\n\t}\n\t// eslint-disable-next-line no-restricted-syntax\n\tset altKey(altKey: boolean) {\n\t\tthis.setAltKey(altKey)\n\t}\n\t/**\n\t * @param altKey - Whether the alt key is pressed.\n\t * @internal\n\t */\n\tsetAltKey(altKey: boolean) {\n\t\tthis._altKey.set(altKey)\n\t}\n\n\t/**\n\t * Is the accelerator key (cmd on mac, ctrl elsewhere) currently pressed.\n\t */\n\tgetAccelKey() {\n\t\treturn isAccelKey({ metaKey: this.getMetaKey(), ctrlKey: this.getCtrlKey() })\n\t}\n\t/**\n\t * @deprecated Use `getAccelKey()` instead.\n\t */\n\t// eslint-disable-next-line no-restricted-syntax\n\tget accelKey() {\n\t\treturn this.getAccelKey()\n\t}\n\n\tprivate _isDragging = atom<boolean>('isDragging', false)\n\t/**\n\t * Whether the user is dragging.\n\t */\n\tgetIsDragging() {\n\t\treturn this._isDragging.get()\n\t}\n\t/**\n\t * Soon to be deprecated, use `getIsDragging()` instead.\n\t */\n\t// eslint-disable-next-line no-restricted-syntax\n\tget isDragging() {\n\t\treturn this.getIsDragging()\n\t}\n\t// eslint-disable-next-line no-restricted-syntax\n\tset isDragging(isDragging: boolean) {\n\t\tthis.setIsDragging(isDragging)\n\t}\n\t/**\n\t * @param isDragging - Whether the user is dragging.\n\t */\n\tsetIsDragging(isDragging: boolean) {\n\t\tthis._isDragging.set(isDragging)\n\t}\n\n\tprivate _isPointing = atom<boolean>('isPointing', false)\n\t/**\n\t * Whether the user is pointing.\n\t */\n\tgetIsPointing() {\n\t\treturn this._isPointing.get()\n\t}\n\t/**\n\t * @deprecated Use `getIsPointing()` instead.\n\t */\n\t// eslint-disable-next-line no-restricted-syntax\n\tget isPointing() {\n\t\treturn this.getIsPointing()\n\t}\n\t// eslint-disable-next-line no-restricted-syntax\n\tset isPointing(isPointing: boolean) {\n\t\tthis.setIsPointing(isPointing)\n\t}\n\t/**\n\t * @param isPointing - Whether the user is pointing.\n\t * @internal\n\t */\n\tsetIsPointing(isPointing: boolean) {\n\t\tthis._isPointing.set(isPointing)\n\t}\n\n\tprivate _isPinching = atom<boolean>('isPinching', false)\n\t/**\n\t * Whether the user is pinching.\n\t */\n\tgetIsPinching() {\n\t\treturn this._isPinching.get()\n\t}\n\t/**\n\t * @deprecated Use `getIsPinching()` instead.\n\t */\n\t// eslint-disable-next-line no-restricted-syntax\n\tget isPinching() {\n\t\treturn this.getIsPinching()\n\t}\n\t// eslint-disable-next-line no-restricted-syntax\n\tset isPinching(isPinching: boolean) {\n\t\tthis.setIsPinching(isPinching)\n\t}\n\t/**\n\t * @param isPinching - Whether the user is pinching.\n\t * @internal\n\t */\n\tsetIsPinching(isPinching: boolean) {\n\t\tthis._isPinching.set(isPinching)\n\t}\n\n\tprivate _isEditing = atom<boolean>('isEditing', false)\n\t/**\n\t * Whether the user is editing.\n\t */\n\tgetIsEditing() {\n\t\treturn this._isEditing.get()\n\t}\n\t/**\n\t * @deprecated Use `getIsEditing()` instead.\n\t */\n\t// eslint-disable-next-line no-restricted-syntax\n\tget isEditing() {\n\t\treturn this.getIsEditing()\n\t}\n\t// eslint-disable-next-line no-restricted-syntax\n\tset isEditing(isEditing: boolean) {\n\t\tthis.setIsEditing(isEditing)\n\t}\n\t/**\n\t * @param isEditing - Whether the user is editing.\n\t */\n\tsetIsEditing(isEditing: boolean) {\n\t\tthis._isEditing.set(isEditing)\n\t}\n\n\tprivate _isPanning = atom<boolean>('isPanning', false)\n\t/**\n\t * Whether the user is panning.\n\t */\n\tgetIsPanning() {\n\t\treturn this._isPanning.get()\n\t}\n\t/**\n\t * @deprecated Use `getIsPanning()` instead.\n\t */\n\t// eslint-disable-next-line no-restricted-syntax\n\tget isPanning() {\n\t\treturn this.getIsPanning()\n\t}\n\t// eslint-disable-next-line no-restricted-syntax\n\tset isPanning(isPanning: boolean) {\n\t\tthis.setIsPanning(isPanning)\n\t}\n\t/**\n\t * @param isPanning - Whether the user is panning.\n\t * @internal\n\t */\n\tsetIsPanning(isPanning: boolean) {\n\t\tthis._isPanning.set(isPanning)\n\t}\n\n\tprivate _isSpacebarPanning = atom<boolean>('isSpacebarPanning', false)\n\t/**\n\t * Whether the user is spacebar panning.\n\t */\n\tgetIsSpacebarPanning() {\n\t\treturn this._isSpacebarPanning.get()\n\t}\n\t/**\n\t * @deprecated Use `getIsSpacebarPanning()` instead.\n\t */\n\t// eslint-disable-next-line no-restricted-syntax\n\tget isSpacebarPanning() {\n\t\treturn this.getIsSpacebarPanning()\n\t}\n\t// eslint-disable-next-line no-restricted-syntax\n\tset isSpacebarPanning(isSpacebarPanning: boolean) {\n\t\tthis.setIsSpacebarPanning(isSpacebarPanning)\n\t}\n\t/**\n\t * @param isSpacebarPanning - Whether the user is spacebar panning.\n\t * @internal\n\t */\n\tsetIsSpacebarPanning(isSpacebarPanning: boolean) {\n\t\tthis._isSpacebarPanning.set(isSpacebarPanning)\n\t}\n\n\t@computed private _getHasCollaborators() {\n\t\treturn this.editor.getCollaborators().length > 0 // could we do this more efficiently?\n\t}\n\n\t/**\n\t * The previous point used for velocity calculation (updated each tick, not each pointer event).\n\t * @internal\n\t */\n\tprivate _velocityPrevPoint = new Vec()\n\n\t/**\n\t * Update the pointer velocity based on elapsed time. Called by the tick manager.\n\t * @param elapsed - The time elapsed since the last tick in milliseconds.\n\t * @internal\n\t */\n\tupdatePointerVelocity(elapsed: number) {\n\t\tconst currentScreenPoint = this.getCurrentScreenPoint()\n\t\tconst pointerVelocity = this.getPointerVelocity()\n\n\t\tif (elapsed === 0) return\n\n\t\tconst delta = Vec.Sub(currentScreenPoint, this._velocityPrevPoint)\n\t\tthis._velocityPrevPoint = currentScreenPoint.clone()\n\n\t\tconst length = delta.len()\n\t\tconst direction = length ? delta.div(length) : new Vec(0, 0)\n\n\t\t// consider adjusting this with an easing rather than a linear interpolation\n\t\tconst next = pointerVelocity.clone().lrp(direction.mul(length / elapsed), 0.5)\n\n\t\t// if the velocity is very small, just set it to 0\n\t\tif (Math.abs(next.x) < 0.01) next.x = 0\n\t\tif (Math.abs(next.y) < 0.01) next.y = 0\n\n\t\tif (!pointerVelocity.equals(next)) {\n\t\t\tthis._pointerVelocity.set(next)\n\t\t}\n\t}\n\n\t/**\n\t * Update the input points from a pointer, pinch, or wheel event.\n\t *\n\t * @param info - The event info.\n\t * @internal\n\t */\n\tupdateFromEvent(info: TLPointerEventInfo | TLPinchEventInfo | TLWheelEventInfo): void {\n\t\tconst currentScreenPoint = this._currentScreenPoint.__unsafe__getWithoutCapture()\n\t\tconst currentPagePoint = this._currentPagePoint.__unsafe__getWithoutCapture()\n\t\tconst isPinching = this._isPinching.__unsafe__getWithoutCapture()\n\t\tconst { screenBounds } = this.editor.store.unsafeGetWithoutCapture(TLINSTANCE_ID)!\n\t\tconst { x: cx, y: cy, z: cz } = unsafe__withoutCapture(() => this.editor.getCamera())\n\n\t\tconst sx = info.point.x - screenBounds.x\n\t\tconst sy = info.point.y - screenBounds.y\n\t\tconst sz = info.point.z ?? 0.5\n\n\t\tthis._previousScreenPoint.set(currentScreenPoint)\n\t\tthis._previousPagePoint.set(currentPagePoint)\n\n\t\t// The \"screen bounds\" is relative to the user's actual screen.\n\t\t// The \"screen point\" is relative to the \"screen bounds\";\n\t\t// it will be 0,0 when its actual screen position is equal\n\t\t// to screenBounds.point. This is confusing!\n\t\tthis._currentScreenPoint.set(new Vec(sx, sy))\n\t\tconst nx = sx / cz - cx\n\t\tconst ny = sy / cz - cy\n\t\tif (isFinite(nx) && isFinite(ny)) {\n\t\t\tthis._currentPagePoint.set(new Vec(nx, ny, sz))\n\t\t}\n\n\t\tthis._isPen.set(info.type === 'pointer' && info.isPen)\n\n\t\t// Reset velocity on pointer down, or when a pinch starts or ends\n\t\tif (info.name === 'pointer_down' || isPinching) {\n\t\t\tthis._pointerVelocity.set(new Vec())\n\t\t\tthis._originScreenPoint.set(this._currentScreenPoint.__unsafe__getWithoutCapture())\n\t\t\tthis._originPagePoint.set(this._currentPagePoint.__unsafe__getWithoutCapture())\n\t\t}\n\n\t\tif (this._getHasCollaborators()) {\n\t\t\tthis.editor.run(\n\t\t\t\t() => {\n\t\t\t\t\tconst pagePoint = this._currentPagePoint.__unsafe__getWithoutCapture()\n\t\t\t\t\tthis.editor.store.put([\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tid: TLPOINTER_ID,\n\t\t\t\t\t\t\ttypeName: 'pointer',\n\t\t\t\t\t\t\tx: pagePoint.x,\n\t\t\t\t\t\t\ty: pagePoint.y,\n\t\t\t\t\t\t\tlastActivityTimestamp:\n\t\t\t\t\t\t\t\t// If our pointer moved only because we're following some other user, then don't\n\t\t\t\t\t\t\t\t// update our last activity timestamp; otherwise, update it to the current timestamp.\n\t\t\t\t\t\t\t\tinfo.type === 'pointer' && info.pointerId === INTERNAL_POINTER_IDS.CAMERA_MOVE\n\t\t\t\t\t\t\t\t\t? (this.editor.store.unsafeGetWithoutCapture(TLPOINTER_ID)\n\t\t\t\t\t\t\t\t\t\t\t?.lastActivityTimestamp ?? Date.now())\n\t\t\t\t\t\t\t\t\t: Date.now(),\n\t\t\t\t\t\t\tmeta: {},\n\t\t\t\t\t\t},\n\t\t\t\t\t])\n\t\t\t\t},\n\t\t\t\t{ history: 'ignore' }\n\t\t\t)\n\t\t}\n\t}\n\n\ttoJson() {\n\t\treturn {\n\t\t\toriginPagePoint: this._originPagePoint.get().toJson(),\n\t\t\toriginScreenPoint: this._originScreenPoint.get().toJson(),\n\t\t\tpreviousPagePoint: this._previousPagePoint.get().toJson(),\n\t\t\tpreviousScreenPoint: this._previousScreenPoint.get().toJson(),\n\t\t\tcurrentPagePoint: this._currentPagePoint.get().toJson(),\n\t\t\tcurrentScreenPoint: this._currentScreenPoint.get().toJson(),\n\t\t\tpointerVelocity: this._pointerVelocity.get().toJson(),\n\t\t\tshiftKey: this._shiftKey.get(),\n\t\t\tmetaKey: this._metaKey.get(),\n\t\t\tctrlKey: this._ctrlKey.get(),\n\t\t\taltKey: this._altKey.get(),\n\t\t\tisPen: this._isPen.get(),\n\t\t\tisDragging: this._isDragging.get(),\n\t\t\tisPointing: this._isPointing.get(),\n\t\t\tisPinching: this._isPinching.get(),\n\t\t\tisEditing: this._isEditing.get(),\n\t\t\tisPanning: this._isPanning.get(),\n\t\t\tisSpacebarPanning: this._isSpacebarPanning.get(),\n\t\t\tkeys: Array.from(this.keys.keys()),\n\t\t\tbuttons: Array.from(this.bu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AAN,2BAAM;",
6
+ "names": []
7
+ }
@@ -95,7 +95,7 @@ class SnapManager {
95
95
  this._snapIndicators.set(indicators);
96
96
  }
97
97
  getSnapThreshold() {
98
- return 8 / this.editor.getZoomLevel();
98
+ return this.editor.options.snapThreshold / this.editor.getZoomLevel();
99
99
  }
100
100
  getSnappableShapes() {
101
101
  const { editor } = this;