@tldraw/editor 3.8.0-internal.6de9eab7a026 → 3.8.0-internal.af5331ba6061

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 (51) hide show
  1. package/dist-cjs/index.d.ts +47 -143
  2. package/dist-cjs/index.js +1 -3
  3. package/dist-cjs/index.js.map +2 -2
  4. package/dist-cjs/lib/components/default-components/DefaultCanvas.js +1 -1
  5. package/dist-cjs/lib/components/default-components/DefaultCanvas.js.map +2 -2
  6. package/dist-cjs/lib/editor/Editor.js +14 -25
  7. package/dist-cjs/lib/editor/Editor.js.map +2 -2
  8. package/dist-cjs/lib/editor/managers/TextManager.js +0 -1
  9. package/dist-cjs/lib/editor/managers/TextManager.js.map +2 -2
  10. package/dist-cjs/lib/editor/shapes/ShapeUtil.js.map +2 -2
  11. package/dist-cjs/lib/editor/types/emit-types.js.map +1 -1
  12. package/dist-cjs/lib/editor/types/external-content.js.map +1 -1
  13. package/dist-cjs/lib/hooks/usePassThroughWheelEvents.js +2 -5
  14. package/dist-cjs/lib/hooks/usePassThroughWheelEvents.js.map +2 -2
  15. package/dist-cjs/lib/options.js +1 -2
  16. package/dist-cjs/lib/options.js.map +2 -2
  17. package/dist-cjs/version.js +3 -3
  18. package/dist-cjs/version.js.map +1 -1
  19. package/dist-esm/index.d.mts +47 -143
  20. package/dist-esm/index.mjs +1 -3
  21. package/dist-esm/index.mjs.map +2 -2
  22. package/dist-esm/lib/components/default-components/DefaultCanvas.mjs +1 -1
  23. package/dist-esm/lib/components/default-components/DefaultCanvas.mjs.map +2 -2
  24. package/dist-esm/lib/editor/Editor.mjs +14 -25
  25. package/dist-esm/lib/editor/Editor.mjs.map +2 -2
  26. package/dist-esm/lib/editor/managers/TextManager.mjs +0 -1
  27. package/dist-esm/lib/editor/managers/TextManager.mjs.map +2 -2
  28. package/dist-esm/lib/editor/shapes/ShapeUtil.mjs.map +2 -2
  29. package/dist-esm/lib/hooks/usePassThroughWheelEvents.mjs +2 -5
  30. package/dist-esm/lib/hooks/usePassThroughWheelEvents.mjs.map +2 -2
  31. package/dist-esm/lib/options.mjs +1 -2
  32. package/dist-esm/lib/options.mjs.map +2 -2
  33. package/dist-esm/version.mjs +3 -3
  34. package/dist-esm/version.mjs.map +1 -1
  35. package/editor.css +1 -2
  36. package/package.json +7 -7
  37. package/src/index.ts +1 -15
  38. package/src/lib/components/default-components/DefaultCanvas.tsx +1 -1
  39. package/src/lib/editor/Editor.ts +23 -50
  40. package/src/lib/editor/managers/TextManager.ts +0 -1
  41. package/src/lib/editor/shapes/ShapeUtil.ts +1 -30
  42. package/src/lib/editor/types/emit-types.ts +0 -1
  43. package/src/lib/editor/types/external-content.ts +50 -90
  44. package/src/lib/hooks/usePassThroughWheelEvents.ts +2 -9
  45. package/src/lib/options.ts +0 -6
  46. package/src/version.ts +3 -3
  47. package/dist-cjs/lib/editor/shapes/shared/resizeScaled.js +0 -66
  48. package/dist-cjs/lib/editor/shapes/shared/resizeScaled.js.map +0 -7
  49. package/dist-esm/lib/editor/shapes/shared/resizeScaled.mjs +0 -46
  50. package/dist-esm/lib/editor/shapes/shared/resizeScaled.mjs.map +0 -7
  51. package/src/lib/editor/shapes/shared/resizeScaled.ts +0 -61
@@ -813,10 +813,6 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
813
813
  (0, import_utils.assert)(shapeUtil, `No shape util found for type "${type}"`);
814
814
  return shapeUtil;
815
815
  }
816
- hasShapeUtil(arg) {
817
- const type = typeof arg === "string" ? arg : arg.type;
818
- return (0, import_utils.hasOwnProperty)(this.shapeUtils, type);
819
- }
820
816
  getBindingUtil(arg) {
821
817
  const type = typeof arg === "string" ? arg : arg.type;
822
818
  const bindingUtil = (0, import_utils.getOwnProperty)(this.bindingUtils, type);
@@ -5098,7 +5094,6 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
5098
5094
  scale = new import_Vec.Vec(Math.sign(scale.x) * Math.abs(scale.y), scale.y);
5099
5095
  }
5100
5096
  }
5101
- let didResize = false;
5102
5097
  if (util.onResize && util.canResize(initialShape)) {
5103
5098
  const newPagePoint = this._scalePagePoint(
5104
5099
  import_Mat.Mat.applyToPoint(pageTransform, new import_Vec.Vec(0, 0)),
@@ -5123,28 +5118,24 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
5123
5118
  util.onResizeStart?.(initialShape) ?? void 0
5124
5119
  );
5125
5120
  }
5126
- const resizedShape = util.onResize(
5127
- { ...initialShape, x, y },
5128
- {
5129
- newPoint: newLocalPoint,
5130
- handle: opts.dragHandle ?? "bottom_right",
5131
- // don't set isSingle to true for children
5132
- mode: opts.mode ?? "scale_shape",
5133
- scaleX: myScale.x,
5134
- scaleY: myScale.y,
5135
- initialBounds,
5136
- initialShape
5137
- }
5138
- );
5139
- if (resizedShape) {
5140
- didResize = true;
5141
- }
5142
5121
  workingShape = applyPartialToRecordWithProps(workingShape, {
5143
5122
  id,
5144
5123
  type: initialShape.type,
5145
5124
  x: newLocalPoint.x,
5146
5125
  y: newLocalPoint.y,
5147
- ...resizedShape
5126
+ ...util.onResize(
5127
+ { ...initialShape, x, y },
5128
+ {
5129
+ newPoint: newLocalPoint,
5130
+ handle: opts.dragHandle ?? "bottom_right",
5131
+ // don't set isSingle to true for children
5132
+ mode: opts.mode ?? "scale_shape",
5133
+ scaleX: myScale.x,
5134
+ scaleY: myScale.y,
5135
+ initialBounds,
5136
+ initialShape
5137
+ }
5138
+ )
5148
5139
  });
5149
5140
  if (!opts.skipStartAndEndCallbacks) {
5150
5141
  workingShape = applyPartialToRecordWithProps(
@@ -5153,8 +5144,7 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
5153
5144
  );
5154
5145
  }
5155
5146
  this.updateShapes([workingShape]);
5156
- }
5157
- if (!didResize) {
5147
+ } else {
5158
5148
  const initialPageCenter = import_Mat.Mat.applyToPoint(pageTransform, initialBounds.center);
5159
5149
  const newPageCenter = this._scalePagePoint(
5160
5150
  initialPageCenter,
@@ -6873,7 +6863,6 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
6873
6863
  }
6874
6864
  _flushEventForTick(info) {
6875
6865
  if (this.getCrashingError()) return this;
6876
- this.emit("before-event", info);
6877
6866
  const { inputs } = this;
6878
6867
  const { type } = info;
6879
6868
  if (info.type === "misc") {