Skip to content

Commit 3465153

Browse files
authored
Merge pull request #5 from hindsite/master
Fixes
2 parents b362fe2 + 135c54e commit 3465153

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
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;

src/utils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,8 @@ export function getEdgeOffset(node, parent, offset = {left: 0, top: 0}) {
161161

162162
// Get the actual offsetTop / offsetLeft value, no matter how deep the node is nested
163163
const nodeOffset = {
164-
left: offset.left + node.offsetLeft,
165-
top: offset.top + node.offsetTop,
164+
left: offset.left + node.getBoundingClientRect().left,
165+
top: offset.top + node.getBoundingClientRect().top,
166166
};
167167

168168
if (node.parentNode === parent) {

0 commit comments

Comments
 (0)