Skip to content

Commit b7473ac

Browse files
committed
Merge branch 'master' of https://github.com/SortableJS/Sortable
2 parents 97b5a03 + ad9efbd commit b7473ac

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

Sortable.js

+5-9
Original file line numberDiff line numberDiff line change
@@ -825,17 +825,18 @@
825825
if (!ghostEl) {
826826
var rect = dragEl.getBoundingClientRect(),
827827
css = _css(dragEl),
828-
options = this.options,
829-
ghostRect;
828+
options = this.options;
830829

831830
ghostEl = dragEl.cloneNode(true);
832831

833832
_toggleClass(ghostEl, options.ghostClass, false);
834833
_toggleClass(ghostEl, options.fallbackClass, true);
835834
_toggleClass(ghostEl, options.dragClass, true);
836835

837-
_css(ghostEl, 'top', rect.top - parseInt(css.marginTop, 10));
838-
_css(ghostEl, 'left', rect.left - parseInt(css.marginLeft, 10));
836+
_css(ghostEl, 'box-sizing', 'border-box');
837+
_css(ghostEl, 'margin', 0);
838+
_css(ghostEl, 'top', rect.top);
839+
_css(ghostEl, 'left', rect.left);
839840
_css(ghostEl, 'width', rect.width);
840841
_css(ghostEl, 'height', rect.height);
841842
_css(ghostEl, 'opacity', '0.8');
@@ -844,11 +845,6 @@
844845
_css(ghostEl, 'pointerEvents', 'none');
845846

846847
options.fallbackOnBody && document.body.appendChild(ghostEl) || rootEl.appendChild(ghostEl);
847-
848-
// Fixing dimensions.
849-
ghostRect = ghostEl.getBoundingClientRect();
850-
_css(ghostEl, 'width', rect.width * 2 - ghostRect.width);
851-
_css(ghostEl, 'height', rect.height * 2 - ghostRect.height);
852848
}
853849
},
854850

0 commit comments

Comments
 (0)