Skip to content

Commit 135c54e

Browse files
authored
Merge pull request #4 from Rustamhabibullin/patch-3
fix different height drag issue
2 parents 4632e4e + f96bb31 commit 135c54e

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/SortableContainer/index.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -640,8 +640,8 @@ export default function sortableContainer(
640640
for (let i = 0, len = nodes.length; i < len; i++) {
641641
const {node} = nodes[i];
642642
const {index} = node.sortableInfo;
643-
const width = node.offsetWidth;
644-
const height = node.offsetHeight;
643+
const width = node.getBoundingClientRect().width;
644+
const height = node.getBoundingClientRect().height;
645645
const offset = {
646646
height: this.height > height ? height / 2 : this.height / 2,
647647
width: this.width > width ? width / 2 : this.width / 2,
@@ -793,9 +793,7 @@ export default function sortableContainer(
793793
} else if (this.axis.y) {
794794
if (
795795
mustShiftBackward ||
796-
(index > this.index &&
797-
sortingOffset.top + windowScrollDelta.top + offset.height >=
798-
edgeOffset.top)
796+
(index > this.index && sortingOffset.top + windowScrollDelta.top + this.boundingClientRect.height >= edgeOffset.top + offset.height)
799797
) {
800798
translate.y = -(this.height + this.marginOffset.y);
801799
this.newIndex = index;

0 commit comments

Comments
 (0)