@tldraw/editor 3.8.0-canary.cd989361f969 → 3.8.0-canary.d0e779ce7b64

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 (37) hide show
  1. package/dist-cjs/index.d.ts +0 -59
  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 +15 -25
  7. package/dist-cjs/lib/editor/Editor.js.map +2 -2
  8. package/dist-cjs/lib/editor/shapes/ShapeUtil.js.map +2 -2
  9. package/dist-cjs/lib/options.js +1 -2
  10. package/dist-cjs/lib/options.js.map +2 -2
  11. package/dist-cjs/version.js +3 -3
  12. package/dist-cjs/version.js.map +1 -1
  13. package/dist-esm/index.d.mts +0 -59
  14. package/dist-esm/index.mjs +1 -3
  15. package/dist-esm/index.mjs.map +2 -2
  16. package/dist-esm/lib/components/default-components/DefaultCanvas.mjs +1 -1
  17. package/dist-esm/lib/components/default-components/DefaultCanvas.mjs.map +2 -2
  18. package/dist-esm/lib/editor/Editor.mjs +15 -25
  19. package/dist-esm/lib/editor/Editor.mjs.map +2 -2
  20. package/dist-esm/lib/editor/shapes/ShapeUtil.mjs.map +2 -2
  21. package/dist-esm/lib/options.mjs +1 -2
  22. package/dist-esm/lib/options.mjs.map +2 -2
  23. package/dist-esm/version.mjs +3 -3
  24. package/dist-esm/version.mjs.map +1 -1
  25. package/editor.css +1 -2
  26. package/package.json +7 -7
  27. package/src/index.ts +0 -2
  28. package/src/lib/components/default-components/DefaultCanvas.tsx +1 -1
  29. package/src/lib/editor/Editor.ts +16 -43
  30. package/src/lib/editor/shapes/ShapeUtil.ts +1 -30
  31. package/src/lib/options.ts +0 -6
  32. package/src/version.ts +3 -3
  33. package/dist-cjs/lib/editor/shapes/shared/resizeScaled.js +0 -66
  34. package/dist-cjs/lib/editor/shapes/shared/resizeScaled.js.map +0 -7
  35. package/dist-esm/lib/editor/shapes/shared/resizeScaled.mjs +0 -46
  36. package/dist-esm/lib/editor/shapes/shared/resizeScaled.mjs.map +0 -7
  37. package/src/lib/editor/shapes/shared/resizeScaled.ts +0 -61
@@ -839,10 +839,6 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
839
839
  assert(shapeUtil, `No shape util found for type "${type}"`);
840
840
  return shapeUtil;
841
841
  }
842
- hasShapeUtil(arg) {
843
- const type = typeof arg === "string" ? arg : arg.type;
844
- return hasOwnProperty(this.shapeUtils, type);
845
- }
846
842
  getBindingUtil(arg) {
847
843
  const type = typeof arg === "string" ? arg : arg.type;
848
844
  const bindingUtil = getOwnProperty(this.bindingUtils, type);
@@ -1245,7 +1241,7 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
1245
1241
  if (partial.isChangingStyle === true) {
1246
1242
  this._isChangingStyleTimeout = this.timers.setTimeout(() => {
1247
1243
  this._updateInstanceState({ isChangingStyle: false }, { history: "ignore" });
1248
- }, 1e3);
1244
+ }, 2e3);
1249
1245
  }
1250
1246
  }
1251
1247
  return this;
@@ -5124,7 +5120,6 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
5124
5120
  scale = new Vec(Math.sign(scale.x) * Math.abs(scale.y), scale.y);
5125
5121
  }
5126
5122
  }
5127
- let didResize = false;
5128
5123
  if (util.onResize && util.canResize(initialShape)) {
5129
5124
  const newPagePoint = this._scalePagePoint(
5130
5125
  Mat.applyToPoint(pageTransform, new Vec(0, 0)),
@@ -5149,28 +5144,24 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
5149
5144
  util.onResizeStart?.(initialShape) ?? void 0
5150
5145
  );
5151
5146
  }
5152
- const resizedShape = util.onResize(
5153
- { ...initialShape, x, y },
5154
- {
5155
- newPoint: newLocalPoint,
5156
- handle: opts.dragHandle ?? "bottom_right",
5157
- // don't set isSingle to true for children
5158
- mode: opts.mode ?? "scale_shape",
5159
- scaleX: myScale.x,
5160
- scaleY: myScale.y,
5161
- initialBounds,
5162
- initialShape
5163
- }
5164
- );
5165
- if (resizedShape) {
5166
- didResize = true;
5167
- }
5168
5147
  workingShape = applyPartialToRecordWithProps(workingShape, {
5169
5148
  id,
5170
5149
  type: initialShape.type,
5171
5150
  x: newLocalPoint.x,
5172
5151
  y: newLocalPoint.y,
5173
- ...resizedShape
5152
+ ...util.onResize(
5153
+ { ...initialShape, x, y },
5154
+ {
5155
+ newPoint: newLocalPoint,
5156
+ handle: opts.dragHandle ?? "bottom_right",
5157
+ // don't set isSingle to true for children
5158
+ mode: opts.mode ?? "scale_shape",
5159
+ scaleX: myScale.x,
5160
+ scaleY: myScale.y,
5161
+ initialBounds,
5162
+ initialShape
5163
+ }
5164
+ )
5174
5165
  });
5175
5166
  if (!opts.skipStartAndEndCallbacks) {
5176
5167
  workingShape = applyPartialToRecordWithProps(
@@ -5179,8 +5170,7 @@ class Editor extends (_a = EventEmitter, _getIsShapeHiddenCache_dec = [computed]
5179
5170
  );
5180
5171
  }
5181
5172
  this.updateShapes([workingShape]);
5182
- }
5183
- if (!didResize) {
5173
+ } else {
5184
5174
  const initialPageCenter = Mat.applyToPoint(pageTransform, initialBounds.center);
5185
5175
  const newPageCenter = this._scalePagePoint(
5186
5176
  initialPageCenter,