@tldraw/editor 5.5.0-canary.d8bde7cf0e8d → 5.5.0-canary.d97e6960f142

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.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.d8bde7cf0e8d",
395
+ "5.5.0-canary.d97e6960f142",
396
396
  "cjs"
397
397
  );
398
398
  //# sourceMappingURL=index.js.map
@@ -7986,7 +7986,6 @@ class Editor extends import_eventemitter3.default {
7986
7986
  const cameraOptions = this._cameraOptions.__unsafe__getWithoutCapture();
7987
7987
  switch (type) {
7988
7988
  case "pinch": {
7989
- if (cameraOptions.isLocked) return;
7990
7989
  clearTimeout(this._longPressTimeout);
7991
7990
  this.inputs.updateFromEvent(info);
7992
7991
  switch (info.name) {
@@ -8008,6 +8007,7 @@ class Editor extends import_eventemitter3.default {
8008
8007
  }
8009
8008
  case "pinch": {
8010
8009
  if (!inputs.getIsPinching()) return;
8010
+ if (cameraOptions.isLocked) return;
8011
8011
  const {
8012
8012
  point: { z = 1 },
8013
8013
  delta: { x: dx, y: dy }
@@ -8063,7 +8063,7 @@ class Editor extends import_eventemitter3.default {
8063
8063
  const { panSpeed, zoomSpeed } = cameraOptions;
8064
8064
  let wheelBehavior = cameraOptions.wheelBehavior;
8065
8065
  const inputMode = this.user.getUserPreferences().inputMode;
8066
- if (inputMode !== null) {
8066
+ if (inputMode !== null && wheelBehavior !== "none") {
8067
8067
  wheelBehavior = inputMode === "trackpad" ? "pan" : "zoom";
8068
8068
  }
8069
8069
  if (wheelBehavior !== "none") {
@@ -8115,12 +8115,12 @@ class Editor extends import_eventemitter3.default {
8115
8115
  }
8116
8116
  case "pointer": {
8117
8117
  if (inputs.getIsPinching()) return;
8118
- this.inputs.updateFromEvent(info);
8119
8118
  const { isPen } = info;
8120
8119
  const { isPenMode } = instanceState;
8120
+ if (isPenMode && !isPen) return;
8121
+ this.inputs.updateFromEvent(info);
8121
8122
  switch (info.name) {
8122
8123
  case "pointer_down": {
8123
- if (isPenMode && !isPen) return;
8124
8124
  this._releaseDebouncedModifiers();
8125
8125
  if (!this.inputs.getIsPanning()) {
8126
8126
  this._longPressTimeout = this.timers.setTimeout(() => {
@@ -8149,7 +8149,7 @@ class Editor extends import_eventemitter3.default {
8149
8149
  this.updateInstanceState({ isPenMode: true });
8150
8150
  this.interrupt();
8151
8151
  }
8152
- if (info.button === import_constants.STYLUS_ERASER_BUTTON) {
8152
+ if (info.button === import_constants.STYLUS_ERASER_BUTTON && this.getStateDescendant("eraser")) {
8153
8153
  this._restoreToolId = this.getCurrentToolId();
8154
8154
  this.complete();
8155
8155
  this.setCurrentTool("eraser");
@@ -8172,7 +8172,6 @@ class Editor extends import_eventemitter3.default {
8172
8172
  break;
8173
8173
  }
8174
8174
  case "pointer_move": {
8175
- if (!isPen && isPenMode) return;
8176
8175
  const { x: cx, y: cy, z: cz } = (0, import_state.unsafe__withoutCapture)(() => this.getCamera());
8177
8176
  if (this.inputs.getIsRightPointing() && !this.inputs.getIsPanning()) {
8178
8177
  const currentScreenPoint = this.inputs.getCurrentScreenPoint();
@@ -8212,7 +8211,6 @@ class Editor extends import_eventemitter3.default {
8212
8211
  inputs.setIsPointing(false);
8213
8212
  clearTimeout(this._longPressTimeout);
8214
8213
  inputs.buttons.delete(info.button);
8215
- if (instanceState.isPenMode && !isPen) return;
8216
8214
  if (this.inputs.getIsRightPointing() && !this.inputs.getIsPanning()) {
8217
8215
  this.inputs.setIsRightPointing(false);
8218
8216
  this._selectedShapeIdsAtPointerDown = [];
@@ -8268,7 +8266,7 @@ class Editor extends import_eventemitter3.default {
8268
8266
  });
8269
8267
  }
8270
8268
  } else {
8271
- if (info.button === import_constants.STYLUS_ERASER_BUTTON) {
8269
+ if (info.button === import_constants.STYLUS_ERASER_BUTTON && this.getStateDescendant("eraser")) {
8272
8270
  this.complete();
8273
8271
  this.setCurrentTool(this._restoreToolId);
8274
8272
  }
@@ -8321,7 +8319,7 @@ class Editor extends import_eventemitter3.default {
8321
8319
  break;
8322
8320
  }
8323
8321
  }
8324
- if (offset) {
8322
+ if (offset && !cameraOptions.isLocked) {
8325
8323
  const bounds = this.getViewportPageBounds();
8326
8324
  const next = bounds.clone().translate(offset.mulV({ x: bounds.w, y: bounds.h }));
8327
8325
  this._animateToViewport(next, { animation: { duration: 320 } });
@@ -8361,7 +8359,7 @@ class Editor extends import_eventemitter3.default {
8361
8359
  this.setCurrentTool("select");
8362
8360
  }
8363
8361
  const { isPenMode } = this.store.unsafeGetWithoutCapture(import_tlschema.TLINSTANCE_ID);
8364
- if (info.isPen === isPenMode) {
8362
+ if (!isPenMode || info.isPen) {
8365
8363
  const clickInfo = this._clickManager.handlePointerEvent(info);
8366
8364
  if (info.name !== clickInfo.name) {
8367
8365
  this.root.handleEvent(info);