@dnd-kit/dom 0.1.9 → 0.1.10

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/index.cjs CHANGED
@@ -658,22 +658,34 @@ render_fn = function() {
658
658
  }
659
659
  if (status2.dragging) {
660
660
  const initialTranslate2 = (_a5 = initial.translate) != null ? _a5 : { x: 0, y: 0 };
661
- const x = transform2.x / frameTransform.scaleX + initialTranslate2.x;
662
- const y = transform2.y / frameTransform.scaleY + initialTranslate2.y;
661
+ const translate2 = {
662
+ x: transform2.x / frameTransform.scaleX + initialTranslate2.x,
663
+ y: transform2.y / frameTransform.scaleY + initialTranslate2.y
664
+ };
663
665
  const translateTransition = isKeyboardOperation ? "250ms cubic-bezier(0.25, 1, 0.5, 1)" : "0ms linear";
664
666
  styles.set(
665
667
  {
666
668
  transition: `${transition}, translate ${translateTransition}`,
667
- translate: `${x}px ${y}px 0`
669
+ translate: `${translate2.x}px ${translate2.y}px 0`
668
670
  },
669
671
  CSS_PREFIX
670
672
  );
671
673
  elementMutationObserver == null ? void 0 : elementMutationObserver.takeRecords();
672
- dragOperation.shape = new utilities.DOMRectangle(feedbackElement);
673
- state$1.current.translate = {
674
- x,
675
- y
676
- };
674
+ const previousTranslate = state$1.current.translate;
675
+ const modifiers = state.untracked(() => dragOperation.modifiers);
676
+ const currentShape = state.untracked(() => {
677
+ var _a6;
678
+ return (_a6 = dragOperation.shape) == null ? void 0 : _a6.current;
679
+ });
680
+ if (currentShape && previousTranslate && !modifiers.length) {
681
+ const delta2 = geometry.Point.delta(translate2, previousTranslate);
682
+ dragOperation.shape = geometry.Rectangle.from(
683
+ currentShape.boundingRectangle
684
+ ).translate(delta2.x, delta2.y);
685
+ } else {
686
+ dragOperation.shape = new utilities.DOMRectangle(feedbackElement);
687
+ }
688
+ state$1.current.translate = translate2;
677
689
  }
678
690
  });
679
691
  const id = (_c3 = manager.dragOperation.source) == null ? void 0 : _c3.id;