@dtducas/wh-forge-viewer 3.0.0-beta.10 → 3.0.0-beta.11

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/index.esm.js CHANGED
@@ -84680,10 +84680,20 @@ var SelectionTransformService = /*#__PURE__*/function () {
84680
84680
  case 'text':
84681
84681
  {
84682
84682
  var t = shape;
84683
+ // Same clean shrink behaviour as callout: clamp the scale so the text
84684
+ // box never collapses below a small minimum, and derive boxCenter from
84685
+ // the SAME clamped scale so the anchor corner stays fixed (lets the box
84686
+ // resize smaller without jumping / refusing to shrink).
84687
+ var minBoxWorld = CALLOUT_MIN_BOX_PX / (scaleFactor || 1);
84688
+ var sX = t.boxW > 0 ? Math.max(Math.abs(scaleX), minBoxWorld / t.boxW) : Math.abs(scaleX);
84689
+ var sY = t.boxH > 0 ? Math.max(Math.abs(scaleY), minBoxWorld / t.boxH) : Math.abs(scaleY);
84683
84690
  return _objectSpread2(_objectSpread2({}, t), {}, {
84684
- boxCenter: scalePoint(t.boxCenter),
84685
- boxW: Math.max(1, t.boxW * Math.abs(scaleX)),
84686
- boxH: Math.max(1, t.boxH * Math.abs(scaleY)),
84691
+ boxCenter: {
84692
+ x: ax + (t.boxCenter.x - ax) * sX,
84693
+ y: ay + (t.boxCenter.y - ay) * sY
84694
+ },
84695
+ boxW: t.boxW * sX,
84696
+ boxH: t.boxH * sY,
84687
84697
  updatedAt: ts
84688
84698
  });
84689
84699
  }
@@ -84696,16 +84706,16 @@ var SelectionTransformService = /*#__PURE__*/function () {
84696
84706
  // anchor corner stays fixed. Without this, shrinking past the minimum
84697
84707
  // collapses the box toward the anchor and the box appears to jump to a
84698
84708
  // new position ("đổi toạ độ"); now it simply stops, anchored, in place.
84699
- var minBoxWorld = CALLOUT_MIN_BOX_PX / (scaleFactor || 1);
84700
- var sX = c.boxW > 0 ? Math.max(Math.abs(scaleX), minBoxWorld / c.boxW) : Math.abs(scaleX);
84701
- var sY = c.boxH > 0 ? Math.max(Math.abs(scaleY), minBoxWorld / c.boxH) : Math.abs(scaleY);
84709
+ var _minBoxWorld = CALLOUT_MIN_BOX_PX / (scaleFactor || 1);
84710
+ var _sX = c.boxW > 0 ? Math.max(Math.abs(scaleX), _minBoxWorld / c.boxW) : Math.abs(scaleX);
84711
+ var _sY = c.boxH > 0 ? Math.max(Math.abs(scaleY), _minBoxWorld / c.boxH) : Math.abs(scaleY);
84702
84712
  return _objectSpread2(_objectSpread2({}, c), {}, {
84703
84713
  boxCenter: {
84704
- x: ax + (c.boxCenter.x - ax) * sX,
84705
- y: ay + (c.boxCenter.y - ay) * sY
84714
+ x: ax + (c.boxCenter.x - ax) * _sX,
84715
+ y: ay + (c.boxCenter.y - ay) * _sY
84706
84716
  },
84707
- boxW: c.boxW * sX,
84708
- boxH: c.boxH * sY,
84717
+ boxW: c.boxW * _sX,
84718
+ boxH: c.boxH * _sY,
84709
84719
  updatedAt: ts
84710
84720
  });
84711
84721
  }