@tldraw/editor 5.4.0-canary.dc9b1f2c03ff → 5.4.0-canary.dd16e831634d

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.4.0-canary.dc9b1f2c03ff",
395
+ "5.4.0-canary.dd16e831634d",
396
396
  "cjs"
397
397
  );
398
398
  //# sourceMappingURL=index.js.map
@@ -2359,8 +2359,8 @@ class Editor extends import_eventemitter3.default {
2359
2359
  const vsb = this.getViewportScreenBounds();
2360
2360
  if (cameraOptions.constraints) {
2361
2361
  const { constraints } = cameraOptions;
2362
- const py = Math.min(constraints.padding.y, vsb.w / 2);
2363
- const px = Math.min(constraints.padding.x, vsb.h / 2);
2362
+ const px = Math.min(constraints.padding.x, vsb.w / 2);
2363
+ const py = Math.min(constraints.padding.y, vsb.h / 2);
2364
2364
  const bounds = import_Box.Box.From(cameraOptions.constraints.bounds);
2365
2365
  const zx = (vsb.w - px * 2) / bounds.w;
2366
2366
  const zy = (vsb.h - py * 2) / bounds.h;
@@ -2399,12 +2399,12 @@ class Editor extends import_eventemitter3.default {
2399
2399
  break;
2400
2400
  }
2401
2401
  case "inside": {
2402
- if (z < zx) x = (0, import_utils2.clamp)(x, minX, (vsb.w - px) / z - bounds.w);
2402
+ if (z < zx) x = (0, import_utils2.clamp)(x, minX, (vsb.w - px) / z - bounds.w - bounds.x);
2403
2403
  else x = (0, import_utils2.clamp)(x, minX + freeW, minX);
2404
2404
  break;
2405
2405
  }
2406
2406
  case "outside": {
2407
- x = (0, import_utils2.clamp)(x, px / z - bounds.w, (vsb.w - px) / z);
2407
+ x = (0, import_utils2.clamp)(x, px / z - bounds.w - bounds.x, (vsb.w - px) / z - bounds.x);
2408
2408
  break;
2409
2409
  }
2410
2410
  case "free": {
@@ -2425,12 +2425,12 @@ class Editor extends import_eventemitter3.default {
2425
2425
  break;
2426
2426
  }
2427
2427
  case "inside": {
2428
- if (z < zy) y = (0, import_utils2.clamp)(y, minY, (vsb.h - py) / z - bounds.h);
2428
+ if (z < zy) y = (0, import_utils2.clamp)(y, minY, (vsb.h - py) / z - bounds.h - bounds.y);
2429
2429
  else y = (0, import_utils2.clamp)(y, minY + freeH, minY);
2430
2430
  break;
2431
2431
  }
2432
2432
  case "outside": {
2433
- y = (0, import_utils2.clamp)(y, py / z - bounds.h, (vsb.h - py) / z);
2433
+ y = (0, import_utils2.clamp)(y, py / z - bounds.h - bounds.y, (vsb.h - py) / z - bounds.y);
2434
2434
  break;
2435
2435
  }
2436
2436
  case "free": {
@@ -4042,7 +4042,9 @@ class Editor extends import_eventemitter3.default {
4042
4042
  if (pageMask) {
4043
4043
  if (pageMask.length === 0) return void 0;
4044
4044
  const { corners } = pageBounds;
4045
- if (corners.every((p, i) => p && import_Vec.Vec.Equals(p, pageMask[i]))) return pageBounds.clone();
4045
+ if (pageMask.length === corners.length && corners.every((p, i) => import_Vec.Vec.Equals(p, pageMask[i]))) {
4046
+ return pageBounds.clone();
4047
+ }
4046
4048
  const intersection = (0, import_intersect.intersectPolygonPolygon)(pageMask, corners);
4047
4049
  if (!intersection) return;
4048
4050
  return import_Box.Box.FromPoints(intersection);
@@ -4281,7 +4283,7 @@ class Editor extends import_eventemitter3.default {
4281
4283
  const pointInShapeSpace = this.getPointInShapeSpace(shape, point);
4282
4284
  const shapeUtil = this.getShapeUtil(shape);
4283
4285
  const isShapeFrameLike = this.isShapeFrameLike(shape);
4284
- if (isShapeFrameLike || (this.isShapeOfType(shape, "note") || this.isShapeOfType(shape, "arrow") || this.isShapeOfType(shape, "geo") && shape.props.fill === "none") && shapeUtil.getText(shape)?.trim()) {
4286
+ if (isGroup && (isShapeFrameLike || (this.isShapeOfType(shape, "note") || this.isShapeOfType(shape, "arrow") || this.isShapeOfType(shape, "geo") && shape.props.fill === "none") && shapeUtil.getText(shape)?.trim())) {
4285
4287
  for (const childGeometry of geometry.children) {
4286
4288
  if (childGeometry.isLabel && childGeometry.isPointInBounds(pointInShapeSpace)) {
4287
4289
  return shape;
@@ -8704,10 +8706,9 @@ function withIsolatedShapes(editor, shapeIds, callback) {
8704
8706
  }
8705
8707
  function getCameraFitXFitY(editor, cameraOptions) {
8706
8708
  if (!cameraOptions.constraints) throw Error("Should have constraints here");
8707
- const {
8708
- padding: { x: px, y: py }
8709
- } = cameraOptions.constraints;
8710
8709
  const vsb = editor.getViewportScreenBounds();
8710
+ const px = Math.min(cameraOptions.constraints.padding.x, vsb.w / 2);
8711
+ const py = Math.min(cameraOptions.constraints.padding.y, vsb.h / 2);
8711
8712
  const bounds = import_Box.Box.From(cameraOptions.constraints.bounds);
8712
8713
  const zx = (vsb.w - px * 2) / bounds.w;
8713
8714
  const zy = (vsb.h - py * 2) / bounds.h;