|
825 | 825 | if (!ghostEl) { |
826 | 826 | var rect = dragEl.getBoundingClientRect(), |
827 | 827 | css = _css(dragEl), |
828 | | - options = this.options, |
829 | | - ghostRect; |
| 828 | + options = this.options; |
830 | 829 |
|
831 | 830 | ghostEl = dragEl.cloneNode(true); |
832 | 831 |
|
833 | 832 | _toggleClass(ghostEl, options.ghostClass, false); |
834 | 833 | _toggleClass(ghostEl, options.fallbackClass, true); |
835 | 834 | _toggleClass(ghostEl, options.dragClass, true); |
836 | 835 |
|
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); |
839 | 840 | _css(ghostEl, 'width', rect.width); |
840 | 841 | _css(ghostEl, 'height', rect.height); |
841 | 842 | _css(ghostEl, 'opacity', '0.8'); |
|
844 | 845 | _css(ghostEl, 'pointerEvents', 'none'); |
845 | 846 |
|
846 | 847 | 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); |
852 | 848 | } |
853 | 849 | }, |
854 | 850 |
|
|
0 commit comments