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