Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 949cc52

Browse files
authored
Merge pull request gridstack#1791 from nelsieborja/master
quickly set external helper initial position + fix scrollbar issue
2 parents 500bd78 + d2fa818 commit 949cc52

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/h5/dd-draggable.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@ export class DDDraggable extends DDBaseImplement implements HTMLElementExtendOpt
126126
const ev = DDUtils.initEvent<DragEvent>(event, { target: this.el, type: 'dragstart' });
127127
if (this.helper !== this.el) {
128128
this._setupDragFollowNodeNotifyStart(ev);
129+
// immediately set external helper initial position to avoid flickering behavior and unnecessary looping in `_packNodes()`
130+
this._dragFollow(event);
129131
} else {
130132
this.dragFollowTimer = window.setTimeout(() => {
131133
delete this.dragFollowTimer;
@@ -286,6 +288,7 @@ export class DDDraggable extends DDBaseImplement implements HTMLElementExtendOpt
286288
let img = document.createElement('div');
287289
img.style.width = '1px';
288290
img.style.height = '1px';
291+
img.style.position = 'fixed'; // prevent unwanted scrollbar
289292
document.body.appendChild(img);
290293
e.dataTransfer.setDragImage(img, 0, 0);
291294
setTimeout(() => document.body.removeChild(img)); // nuke once drag had a chance to grab this 'image'

0 commit comments

Comments
 (0)