@tldraw/editor 5.5.0-canary.d8bde7cf0e8d → 5.5.0-canary.d932cb38b3dd
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-cjs/index.d.ts +17 -11
- package/dist-cjs/index.js +1 -1
- package/dist-cjs/lib/editor/Editor.js +35 -28
- package/dist-cjs/lib/editor/Editor.js.map +2 -2
- package/dist-cjs/lib/editor/managers/ClickManager/ClickManager.js +3 -2
- package/dist-cjs/lib/editor/managers/ClickManager/ClickManager.js.map +2 -2
- package/dist-cjs/lib/editor/managers/EditorManager.js +11 -2
- package/dist-cjs/lib/editor/managers/EditorManager.js.map +2 -2
- package/dist-cjs/lib/editor/managers/PerformanceManager/PerformanceManager.js +49 -63
- package/dist-cjs/lib/editor/managers/PerformanceManager/PerformanceManager.js.map +2 -2
- package/dist-cjs/lib/editor/managers/ScribbleManager/ScribbleManager.js +1 -1
- package/dist-cjs/lib/editor/managers/ScribbleManager/ScribbleManager.js.map +2 -2
- package/dist-cjs/lib/editor/managers/SnapManager/BoundsSnaps.js +24 -24
- package/dist-cjs/lib/editor/managers/SnapManager/BoundsSnaps.js.map +2 -2
- package/dist-cjs/lib/editor/managers/SnapManager/HandleSnaps.js +7 -1
- package/dist-cjs/lib/editor/managers/SnapManager/HandleSnaps.js.map +2 -2
- package/dist-cjs/lib/editor/managers/SnapManager/SnapManager.js +4 -3
- package/dist-cjs/lib/editor/managers/SnapManager/SnapManager.js.map +2 -2
- package/dist-cjs/lib/editor/shapes/shared/resizeBox.js +21 -16
- package/dist-cjs/lib/editor/shapes/shared/resizeBox.js.map +2 -2
- package/dist-cjs/lib/utils/sync/LocalIndexedDb.js +10 -1
- package/dist-cjs/lib/utils/sync/LocalIndexedDb.js.map +2 -2
- package/dist-cjs/lib/utils/sync/TLLocalSyncClient.js +12 -5
- package/dist-cjs/lib/utils/sync/TLLocalSyncClient.js.map +2 -2
- package/dist-cjs/version.js +3 -3
- package/dist-cjs/version.js.map +1 -1
- package/dist-esm/index.d.mts +17 -11
- package/dist-esm/index.mjs +1 -1
- package/dist-esm/lib/editor/Editor.mjs +37 -29
- package/dist-esm/lib/editor/Editor.mjs.map +2 -2
- package/dist-esm/lib/editor/managers/ClickManager/ClickManager.mjs +3 -2
- package/dist-esm/lib/editor/managers/ClickManager/ClickManager.mjs.map +2 -2
- package/dist-esm/lib/editor/managers/EditorManager.mjs +11 -2
- package/dist-esm/lib/editor/managers/EditorManager.mjs.map +2 -2
- package/dist-esm/lib/editor/managers/PerformanceManager/PerformanceManager.mjs +49 -63
- package/dist-esm/lib/editor/managers/PerformanceManager/PerformanceManager.mjs.map +2 -2
- package/dist-esm/lib/editor/managers/ScribbleManager/ScribbleManager.mjs +1 -1
- package/dist-esm/lib/editor/managers/ScribbleManager/ScribbleManager.mjs.map +2 -2
- package/dist-esm/lib/editor/managers/SnapManager/BoundsSnaps.mjs +24 -24
- package/dist-esm/lib/editor/managers/SnapManager/BoundsSnaps.mjs.map +2 -2
- package/dist-esm/lib/editor/managers/SnapManager/HandleSnaps.mjs +7 -1
- package/dist-esm/lib/editor/managers/SnapManager/HandleSnaps.mjs.map +2 -2
- package/dist-esm/lib/editor/managers/SnapManager/SnapManager.mjs +4 -3
- package/dist-esm/lib/editor/managers/SnapManager/SnapManager.mjs.map +2 -2
- package/dist-esm/lib/editor/shapes/shared/resizeBox.mjs +21 -16
- package/dist-esm/lib/editor/shapes/shared/resizeBox.mjs.map +2 -2
- package/dist-esm/lib/utils/sync/LocalIndexedDb.mjs +10 -1
- package/dist-esm/lib/utils/sync/LocalIndexedDb.mjs.map +2 -2
- package/dist-esm/lib/utils/sync/TLLocalSyncClient.mjs +13 -6
- package/dist-esm/lib/utils/sync/TLLocalSyncClient.mjs.map +2 -2
- package/dist-esm/version.mjs +3 -3
- package/dist-esm/version.mjs.map +1 -1
- package/package.json +16 -18
- package/src/lib/editor/Editor.test.ts +45 -0
- package/src/lib/editor/Editor.ts +70 -41
- package/src/lib/editor/managers/ClickManager/ClickManager.test.ts +1 -0
- package/src/lib/editor/managers/ClickManager/ClickManager.ts +3 -2
- package/src/lib/editor/managers/EditorManager.test.ts +32 -1
- package/src/lib/editor/managers/EditorManager.ts +15 -3
- package/src/lib/editor/managers/PerformanceManager/PerformanceManager.test.ts +80 -0
- package/src/lib/editor/managers/PerformanceManager/PerformanceManager.ts +54 -81
- package/src/lib/editor/managers/ScribbleManager/ScribbleManager.ts +1 -1
- package/src/lib/editor/managers/SnapManager/BoundsSnaps.ts +32 -36
- package/src/lib/editor/managers/SnapManager/HandleSnaps.ts +13 -2
- package/src/lib/editor/managers/SnapManager/SnapManager.test.ts +13 -0
- package/src/lib/editor/managers/SnapManager/SnapManager.ts +6 -4
- package/src/lib/editor/shapes/shared/resizeBox.ts +21 -16
- package/src/lib/utils/sync/LocalIndexedDb.test.ts +26 -1
- package/src/lib/utils/sync/LocalIndexedDb.ts +10 -1
- package/src/lib/utils/sync/TLLocalSyncClient.test.ts +73 -0
- package/src/lib/utils/sync/TLLocalSyncClient.ts +24 -8
- package/src/version.ts +3 -3
package/dist-cjs/index.d.ts
CHANGED
|
@@ -1274,6 +1274,9 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
1274
1274
|
* @public
|
|
1275
1275
|
*/
|
|
1276
1276
|
readonly timers: {
|
|
1277
|
+
cancelAnimationFrame: (id: number | undefined) => void;
|
|
1278
|
+
clearInterval: (id: number | undefined) => void;
|
|
1279
|
+
clearTimeout: (id: number | undefined) => void;
|
|
1277
1280
|
dispose: () => void;
|
|
1278
1281
|
requestAnimationFrame: (callback: FrameRequestCallback) => number;
|
|
1279
1282
|
setInterval: (handler: TimerHandler, timeout?: number, ...args: any[]) => number;
|
|
@@ -4576,6 +4579,8 @@ export declare const EditorContext: React_3.Context<Editor | null>;
|
|
|
4576
4579
|
* - Reaction (`react(...)` from `@tldraw/state`): `this.register(react(...))`
|
|
4577
4580
|
* - DOM listener: `this.register(() => el.removeEventListener(...))`
|
|
4578
4581
|
* - Other resource (cache, index, child manager): `this.register(() => x.dispose())`
|
|
4582
|
+
* - Resource held only part of the time (a listener attached while subscribers exist):
|
|
4583
|
+
* `this.register(...)` on attach and `this.unregister(...)` on detach, see `PerformanceManager`
|
|
4579
4584
|
*
|
|
4580
4585
|
* For timeouts, intervals, and animation frames prefer `editor.timers` (context-grouped
|
|
4581
4586
|
* and auto-disposed) over raw `setTimeout`. For cleanup on the editor itself rather than a
|
|
@@ -4595,11 +4600,18 @@ export declare abstract class EditorManager {
|
|
|
4595
4600
|
* make a resource "see itself out". Returns the same function for convenience.
|
|
4596
4601
|
*/
|
|
4597
4602
|
protected register(dispose: () => void): () => void;
|
|
4603
|
+
/**
|
|
4604
|
+
* Run a registered teardown now instead of at `dispose()`. A teardown that is no longer
|
|
4605
|
+
* registered (already run by `dispose()`, or never registered) is skipped, so nothing is
|
|
4606
|
+
* torn down twice.
|
|
4607
|
+
*/
|
|
4608
|
+
protected unregister(dispose: () => void): void;
|
|
4598
4609
|
/**
|
|
4599
4610
|
* Subscribe to an editor bus event and register the matching unsubscribe, so the listener
|
|
4600
|
-
* is removed automatically on `dispose()`.
|
|
4611
|
+
* is removed automatically on `dispose()`. Returns that unsubscribe, for passing to
|
|
4612
|
+
* {@link EditorManager.unregister} to detach it before `dispose()`.
|
|
4601
4613
|
*/
|
|
4602
|
-
protected addEditorEvent<E extends keyof TLEventMap>(event: E, fn: (...args: TLEventMap[E]) => void): void;
|
|
4614
|
+
protected addEditorEvent<E extends keyof TLEventMap>(event: E, fn: (...args: TLEventMap[E]) => void): () => void;
|
|
4603
4615
|
/* Excluded from this release type: dispose */
|
|
4604
4616
|
}
|
|
4605
4617
|
|
|
@@ -5987,17 +5999,11 @@ export declare class PerformanceApiAdapter {
|
|
|
5987
5999
|
*
|
|
5988
6000
|
* @public
|
|
5989
6001
|
*/
|
|
5990
|
-
export declare class PerformanceManager {
|
|
6002
|
+
export declare class PerformanceManager extends EditorManager {
|
|
5991
6003
|
/* Excluded from this release type: emitter */
|
|
5992
|
-
private editor;
|
|
5993
6004
|
private activeInteraction;
|
|
5994
6005
|
private activeCamera;
|
|
5995
|
-
private
|
|
5996
|
-
private shapeCreatedCleanup;
|
|
5997
|
-
private shapeEditedCleanup;
|
|
5998
|
-
private shapeDeletedCleanup;
|
|
5999
|
-
private loafObserver;
|
|
6000
|
-
constructor(editor: Editor);
|
|
6006
|
+
private readonly lazyCleanups;
|
|
6001
6007
|
/**
|
|
6002
6008
|
* Subscribe to a performance event. Returns an unsubscribe function.
|
|
6003
6009
|
*
|
|
@@ -6031,11 +6037,11 @@ export declare class PerformanceManager {
|
|
|
6031
6037
|
private _onShapesEdited;
|
|
6032
6038
|
private _onShapesDeleted;
|
|
6033
6039
|
private _startLoafObserver;
|
|
6034
|
-
private _stopLoafObserver;
|
|
6035
6040
|
private _needsFrameListener;
|
|
6036
6041
|
private _needsLoafObserver;
|
|
6037
6042
|
private _maybeAttachLazyListeners;
|
|
6038
6043
|
private _maybeDetachLazyListeners;
|
|
6044
|
+
private _detachLazy;
|
|
6039
6045
|
}
|
|
6040
6046
|
|
|
6041
6047
|
/**
|
package/dist-cjs/index.js
CHANGED
|
@@ -392,7 +392,7 @@ var import_uniq = require("./lib/utils/uniq");
|
|
|
392
392
|
var import_defaultThemes2 = require("./lib/editor/managers/ThemeManager/defaultThemes");
|
|
393
393
|
(0, import_utils.registerTldrawLibraryVersion)(
|
|
394
394
|
"@tldraw/editor",
|
|
395
|
-
"5.5.0-canary.
|
|
395
|
+
"5.5.0-canary.d932cb38b3dd",
|
|
396
396
|
"cjs"
|
|
397
397
|
);
|
|
398
398
|
//# sourceMappingURL=index.js.map
|
|
@@ -1408,7 +1408,7 @@ class Editor extends import_eventemitter3.default {
|
|
|
1408
1408
|
updateInstanceState(partial, historyOptions) {
|
|
1409
1409
|
this._updateInstanceState(partial, { history: "ignore", ...historyOptions });
|
|
1410
1410
|
if (partial.isChangingStyle !== void 0) {
|
|
1411
|
-
clearTimeout(this._isChangingStyleTimeout);
|
|
1411
|
+
this.timers.clearTimeout(this._isChangingStyleTimeout);
|
|
1412
1412
|
if (partial.isChangingStyle === true) {
|
|
1413
1413
|
this._isChangingStyleTimeout = this.timers.setTimeout(() => {
|
|
1414
1414
|
this._updateInstanceState({ isChangingStyle: false }, { history: "ignore" });
|
|
@@ -6030,11 +6030,20 @@ class Editor extends import_eventemitter3.default {
|
|
|
6030
6030
|
initialShape: options.initialShape,
|
|
6031
6031
|
initialBounds: options.initialBounds,
|
|
6032
6032
|
isAspectRatioLocked: options.isAspectRatioLocked,
|
|
6033
|
-
initialPageTransform: options.initialPageTransform
|
|
6033
|
+
initialPageTransform: options.initialPageTransform,
|
|
6034
|
+
dragHandle: options.dragHandle,
|
|
6035
|
+
mode: options.mode,
|
|
6036
|
+
// this is one frame of the same resize, not a new one, so don't fire start/end again
|
|
6037
|
+
skipStartAndEndCallbacks: options.skipStartAndEndCallbacks
|
|
6034
6038
|
});
|
|
6035
6039
|
if (Math.sign(scale.x) * Math.sign(scale.y) < 0) {
|
|
6036
6040
|
const parentRotation = this.getShapeParentTransform(id).rotation();
|
|
6037
|
-
const
|
|
6041
|
+
const parentDelta = (0, import_utils2.shortAngleDist)(
|
|
6042
|
+
import_Mat.Mat.Cast(options.initialPageTransform).rotation() - options.initialShape.rotation,
|
|
6043
|
+
parentRotation
|
|
6044
|
+
);
|
|
6045
|
+
const initialParentRotation = parentRotation - parentDelta;
|
|
6046
|
+
const rotation = 2 * options.scaleAxisRotation - options.initialShape.rotation - 2 * initialParentRotation - parentDelta;
|
|
6038
6047
|
this.updateShapes([{ id, type, rotation }]);
|
|
6039
6048
|
}
|
|
6040
6049
|
const preScaleShapePageCenter = import_Mat.Mat.applyToPoint(
|
|
@@ -7822,22 +7831,22 @@ class Editor extends import_eventemitter3.default {
|
|
|
7822
7831
|
const releaseCtrl = this._ctrlKeyTimeout !== -1;
|
|
7823
7832
|
const releaseMeta = this._metaKeyTimeout !== -1;
|
|
7824
7833
|
if (releaseShift) {
|
|
7825
|
-
clearTimeout(this._shiftKeyTimeout);
|
|
7834
|
+
this.timers.clearTimeout(this._shiftKeyTimeout);
|
|
7826
7835
|
this._shiftKeyTimeout = -1;
|
|
7827
7836
|
this.inputs.setShiftKey(false);
|
|
7828
7837
|
}
|
|
7829
7838
|
if (releaseAlt) {
|
|
7830
|
-
clearTimeout(this._altKeyTimeout);
|
|
7839
|
+
this.timers.clearTimeout(this._altKeyTimeout);
|
|
7831
7840
|
this._altKeyTimeout = -1;
|
|
7832
7841
|
this.inputs.setAltKey(false);
|
|
7833
7842
|
}
|
|
7834
7843
|
if (releaseCtrl) {
|
|
7835
|
-
clearTimeout(this._ctrlKeyTimeout);
|
|
7844
|
+
this.timers.clearTimeout(this._ctrlKeyTimeout);
|
|
7836
7845
|
this._ctrlKeyTimeout = -1;
|
|
7837
7846
|
this.inputs.setCtrlKey(false);
|
|
7838
7847
|
}
|
|
7839
7848
|
if (releaseMeta) {
|
|
7840
|
-
clearTimeout(this._metaKeyTimeout);
|
|
7849
|
+
this.timers.clearTimeout(this._metaKeyTimeout);
|
|
7841
7850
|
this._metaKeyTimeout = -1;
|
|
7842
7851
|
this.inputs.setMetaKey(false);
|
|
7843
7852
|
}
|
|
@@ -7951,28 +7960,28 @@ class Editor extends import_eventemitter3.default {
|
|
|
7951
7960
|
return;
|
|
7952
7961
|
}
|
|
7953
7962
|
if (info.shiftKey) {
|
|
7954
|
-
clearTimeout(this._shiftKeyTimeout);
|
|
7963
|
+
this.timers.clearTimeout(this._shiftKeyTimeout);
|
|
7955
7964
|
this._shiftKeyTimeout = -1;
|
|
7956
7965
|
inputs.setShiftKey(true);
|
|
7957
7966
|
} else if (!info.shiftKey && inputs.getShiftKey() && this._shiftKeyTimeout === -1) {
|
|
7958
7967
|
this._shiftKeyTimeout = this.timers.setTimeout(this._releaseShiftKey, 150);
|
|
7959
7968
|
}
|
|
7960
7969
|
if (info.altKey) {
|
|
7961
|
-
clearTimeout(this._altKeyTimeout);
|
|
7970
|
+
this.timers.clearTimeout(this._altKeyTimeout);
|
|
7962
7971
|
this._altKeyTimeout = -1;
|
|
7963
7972
|
inputs.setAltKey(true);
|
|
7964
7973
|
} else if (!info.altKey && inputs.getAltKey() && this._altKeyTimeout === -1) {
|
|
7965
7974
|
this._altKeyTimeout = this.timers.setTimeout(this._releaseAltKey, 150);
|
|
7966
7975
|
}
|
|
7967
7976
|
if (info.ctrlKey) {
|
|
7968
|
-
clearTimeout(this._ctrlKeyTimeout);
|
|
7977
|
+
this.timers.clearTimeout(this._ctrlKeyTimeout);
|
|
7969
7978
|
this._ctrlKeyTimeout = -1;
|
|
7970
7979
|
inputs.setCtrlKey(true);
|
|
7971
7980
|
} else if (!info.ctrlKey && inputs.getCtrlKey() && this._ctrlKeyTimeout === -1) {
|
|
7972
7981
|
this._ctrlKeyTimeout = this.timers.setTimeout(this._releaseCtrlKey, 150);
|
|
7973
7982
|
}
|
|
7974
7983
|
if (info.metaKey && info.name !== "key_up") {
|
|
7975
|
-
clearTimeout(this._metaKeyTimeout);
|
|
7984
|
+
this.timers.clearTimeout(this._metaKeyTimeout);
|
|
7976
7985
|
this._metaKeyTimeout = -1;
|
|
7977
7986
|
inputs.setMetaKey(true);
|
|
7978
7987
|
} else if (!info.metaKey && inputs.getMetaKey() && this._metaKeyTimeout === -1) {
|
|
@@ -7986,8 +7995,7 @@ class Editor extends import_eventemitter3.default {
|
|
|
7986
7995
|
const cameraOptions = this._cameraOptions.__unsafe__getWithoutCapture();
|
|
7987
7996
|
switch (type) {
|
|
7988
7997
|
case "pinch": {
|
|
7989
|
-
|
|
7990
|
-
clearTimeout(this._longPressTimeout);
|
|
7998
|
+
this.timers.clearTimeout(this._longPressTimeout);
|
|
7991
7999
|
this.inputs.updateFromEvent(info);
|
|
7992
8000
|
switch (info.name) {
|
|
7993
8001
|
case "pinch_start": {
|
|
@@ -8008,6 +8016,7 @@ class Editor extends import_eventemitter3.default {
|
|
|
8008
8016
|
}
|
|
8009
8017
|
case "pinch": {
|
|
8010
8018
|
if (!inputs.getIsPinching()) return;
|
|
8019
|
+
if (cameraOptions.isLocked) return;
|
|
8011
8020
|
const {
|
|
8012
8021
|
point: { z = 1 },
|
|
8013
8022
|
delta: { x: dx, y: dy }
|
|
@@ -8063,7 +8072,7 @@ class Editor extends import_eventemitter3.default {
|
|
|
8063
8072
|
const { panSpeed, zoomSpeed } = cameraOptions;
|
|
8064
8073
|
let wheelBehavior = cameraOptions.wheelBehavior;
|
|
8065
8074
|
const inputMode = this.user.getUserPreferences().inputMode;
|
|
8066
|
-
if (inputMode !== null) {
|
|
8075
|
+
if (inputMode !== null && wheelBehavior !== "none") {
|
|
8067
8076
|
wheelBehavior = inputMode === "trackpad" ? "pan" : "zoom";
|
|
8068
8077
|
}
|
|
8069
8078
|
if (wheelBehavior !== "none") {
|
|
@@ -8115,12 +8124,12 @@ class Editor extends import_eventemitter3.default {
|
|
|
8115
8124
|
}
|
|
8116
8125
|
case "pointer": {
|
|
8117
8126
|
if (inputs.getIsPinching()) return;
|
|
8118
|
-
this.inputs.updateFromEvent(info);
|
|
8119
8127
|
const { isPen } = info;
|
|
8120
8128
|
const { isPenMode } = instanceState;
|
|
8129
|
+
if (isPenMode && !isPen) return;
|
|
8130
|
+
this.inputs.updateFromEvent(info);
|
|
8121
8131
|
switch (info.name) {
|
|
8122
8132
|
case "pointer_down": {
|
|
8123
|
-
if (isPenMode && !isPen) return;
|
|
8124
8133
|
this._releaseDebouncedModifiers();
|
|
8125
8134
|
if (!this.inputs.getIsPanning()) {
|
|
8126
8135
|
this._longPressTimeout = this.timers.setTimeout(() => {
|
|
@@ -8149,7 +8158,7 @@ class Editor extends import_eventemitter3.default {
|
|
|
8149
8158
|
this.updateInstanceState({ isPenMode: true });
|
|
8150
8159
|
this.interrupt();
|
|
8151
8160
|
}
|
|
8152
|
-
if (info.button === import_constants.STYLUS_ERASER_BUTTON) {
|
|
8161
|
+
if (info.button === import_constants.STYLUS_ERASER_BUTTON && this.getStateDescendant("eraser")) {
|
|
8153
8162
|
this._restoreToolId = this.getCurrentToolId();
|
|
8154
8163
|
this.complete();
|
|
8155
8164
|
this.setCurrentTool("eraser");
|
|
@@ -8158,10 +8167,10 @@ class Editor extends import_eventemitter3.default {
|
|
|
8158
8167
|
this._prevCursor = this.getInstanceState().cursor.type;
|
|
8159
8168
|
}
|
|
8160
8169
|
this.inputs.setIsPanning(true);
|
|
8161
|
-
clearTimeout(this._longPressTimeout);
|
|
8170
|
+
this.timers.clearTimeout(this._longPressTimeout);
|
|
8162
8171
|
} else if (info.button === import_constants.RIGHT_MOUSE_BUTTON && this.options.rightClickPanning) {
|
|
8163
8172
|
this.inputs.setIsRightPointing(true);
|
|
8164
|
-
clearTimeout(this._longPressTimeout);
|
|
8173
|
+
this.timers.clearTimeout(this._longPressTimeout);
|
|
8165
8174
|
return this;
|
|
8166
8175
|
}
|
|
8167
8176
|
if (this.inputs.getIsPanning()) {
|
|
@@ -8172,7 +8181,6 @@ class Editor extends import_eventemitter3.default {
|
|
|
8172
8181
|
break;
|
|
8173
8182
|
}
|
|
8174
8183
|
case "pointer_move": {
|
|
8175
|
-
if (!isPen && isPenMode) return;
|
|
8176
8184
|
const { x: cx, y: cy, z: cz } = (0, import_state.unsafe__withoutCapture)(() => this.getCamera());
|
|
8177
8185
|
if (this.inputs.getIsRightPointing() && !this.inputs.getIsPanning()) {
|
|
8178
8186
|
const currentScreenPoint = this.inputs.getCurrentScreenPoint();
|
|
@@ -8203,16 +8211,15 @@ class Editor extends import_eventemitter3.default {
|
|
|
8203
8211
|
}
|
|
8204
8212
|
if (inputs.getIsPointing() && !inputs.getIsDragging() && import_Vec.Vec.Dist2(inputs.getOriginPagePoint(), inputs.getCurrentPagePoint()) * this.getZoomLevel() > (instanceState.isCoarsePointer ? this.options.coarseDragDistanceSquared : this.options.dragDistanceSquared) / cz) {
|
|
8205
8213
|
inputs.setIsDragging(true);
|
|
8206
|
-
clearTimeout(this._longPressTimeout);
|
|
8214
|
+
this.timers.clearTimeout(this._longPressTimeout);
|
|
8207
8215
|
}
|
|
8208
8216
|
break;
|
|
8209
8217
|
}
|
|
8210
8218
|
case "pointer_up": {
|
|
8211
8219
|
inputs.setIsDragging(false);
|
|
8212
8220
|
inputs.setIsPointing(false);
|
|
8213
|
-
clearTimeout(this._longPressTimeout);
|
|
8221
|
+
this.timers.clearTimeout(this._longPressTimeout);
|
|
8214
8222
|
inputs.buttons.delete(info.button);
|
|
8215
|
-
if (instanceState.isPenMode && !isPen) return;
|
|
8216
8223
|
if (this.inputs.getIsRightPointing() && !this.inputs.getIsPanning()) {
|
|
8217
8224
|
this.inputs.setIsRightPointing(false);
|
|
8218
8225
|
this._selectedShapeIdsAtPointerDown = [];
|
|
@@ -8268,7 +8275,7 @@ class Editor extends import_eventemitter3.default {
|
|
|
8268
8275
|
});
|
|
8269
8276
|
}
|
|
8270
8277
|
} else {
|
|
8271
|
-
if (info.button === import_constants.STYLUS_ERASER_BUTTON) {
|
|
8278
|
+
if (info.button === import_constants.STYLUS_ERASER_BUTTON && this.getStateDescendant("eraser")) {
|
|
8272
8279
|
this.complete();
|
|
8273
8280
|
this.setCurrentTool(this._restoreToolId);
|
|
8274
8281
|
}
|
|
@@ -8295,7 +8302,7 @@ class Editor extends import_eventemitter3.default {
|
|
|
8295
8302
|
}
|
|
8296
8303
|
this.inputs.setIsPanning(true);
|
|
8297
8304
|
this.inputs.setIsSpacebarPanning(true);
|
|
8298
|
-
clearTimeout(this._longPressTimeout);
|
|
8305
|
+
this.timers.clearTimeout(this._longPressTimeout);
|
|
8299
8306
|
this.setCursor({
|
|
8300
8307
|
type: this.inputs.getIsPointing() ? "grabbing" : "grab",
|
|
8301
8308
|
rotation: 0
|
|
@@ -8321,7 +8328,7 @@ class Editor extends import_eventemitter3.default {
|
|
|
8321
8328
|
break;
|
|
8322
8329
|
}
|
|
8323
8330
|
}
|
|
8324
|
-
if (offset) {
|
|
8331
|
+
if (offset && !cameraOptions.isLocked) {
|
|
8325
8332
|
const bounds = this.getViewportPageBounds();
|
|
8326
8333
|
const next = bounds.clone().translate(offset.mulV({ x: bounds.w, y: bounds.h }));
|
|
8327
8334
|
this._animateToViewport(next, { animation: { duration: 320 } });
|
|
@@ -8361,7 +8368,7 @@ class Editor extends import_eventemitter3.default {
|
|
|
8361
8368
|
this.setCurrentTool("select");
|
|
8362
8369
|
}
|
|
8363
8370
|
const { isPenMode } = this.store.unsafeGetWithoutCapture(import_tlschema.TLINSTANCE_ID);
|
|
8364
|
-
if (info.isPen
|
|
8371
|
+
if (!isPenMode || info.isPen) {
|
|
8365
8372
|
const clickInfo = this._clickManager.handlePointerEvent(info);
|
|
8366
8373
|
if (info.name !== clickInfo.name) {
|
|
8367
8374
|
this.root.handleEvent(info);
|
|
@@ -8383,7 +8390,7 @@ class Editor extends import_eventemitter3.default {
|
|
|
8383
8390
|
maybeTrackPerformance(name) {
|
|
8384
8391
|
if (import_debug_flags.debugFlags.measurePerformance.get()) {
|
|
8385
8392
|
if (this.performanceTracker.isStarted()) {
|
|
8386
|
-
clearTimeout(this.performanceTrackerTimeout);
|
|
8393
|
+
this.timers.clearTimeout(this.performanceTrackerTimeout);
|
|
8387
8394
|
} else {
|
|
8388
8395
|
this.performanceTracker.start(name);
|
|
8389
8396
|
}
|