@@ -76,15 +76,6 @@ export abstract class GridStackDD extends GridStackDDI {
76
76
GridStack . prototype . _setupAcceptWidget = function ( ) : GridStack {
77
77
if ( this . opts . staticGrid ) return this ;
78
78
79
- // if we don't accept external widgets (default) we still need to accept dragging within our
80
- // list of items (else we get a no-drop icon on windows)
81
- if ( ! this . opts . acceptWidgets ) {
82
- GridStackDD . get ( ) . droppable ( this . el , {
83
- accept : ( el : GridItemHTMLElement ) => el . gridstackNode && el . gridstackNode . grid === this
84
- } )
85
- return this ;
86
- }
87
-
88
79
// vars shared across all methods
89
80
let gridPos : MousePosition ;
90
81
let cellHeight : number , cellWidth : number ;
@@ -128,6 +119,7 @@ GridStack.prototype._setupAcceptWidget = function(): GridStack {
128
119
let node : GridStackNode = el . gridstackNode ;
129
120
// set accept drop to true on ourself (which we ignore) so we don't get "can't drop" icon in HTML5 mode while moving
130
121
if ( node && node . grid === this ) return true ;
122
+ if ( ! this . opts . acceptWidgets ) return false ;
131
123
// check for accept method or class matching
132
124
let canAccept = true ;
133
125
if ( typeof this . opts . acceptWidgets === 'function' ) {
@@ -199,9 +191,6 @@ GridStack.prototype._setupAcceptWidget = function(): GridStack {
199
191
node . _temporaryRemoved = true ; // so we can insert it
200
192
}
201
193
202
- // we're entering this grid (even if we left another)
203
- delete node . _isCursorOutside ;
204
-
205
194
GridStackDD . get ( ) . on ( el , 'drag' , onDrag ) ;
206
195
// make sure this is called at least once when going fast #1578
207
196
onDrag ( event as DragEvent , el , helper ) ;
@@ -477,7 +466,6 @@ GridStack.prototype._onStartMoving = function(el: GridItemHTMLElement, event: Ev
477
466
node . _prevYPix = ui . position . top ;
478
467
node . _moving = ( event . type === 'dragstart' ) ; // 'dropover' are not initially moving so they can go exactly where they enter (will push stuff out of the way)
479
468
delete node . _lastTried ;
480
- delete node . _isCursorOutside ;
481
469
482
470
if ( event . type === 'dropover' && node . _temporaryRemoved ) {
483
471
// TEST console.log('engine.addNode x=' + node.x);
@@ -504,7 +492,6 @@ GridStack.prototype._leave = function(node: GridStackNode, el: GridItemHTMLEleme
504
492
if ( ! node ) return ;
505
493
506
494
if ( dropoutEvent ) {
507
- node . _isCursorOutside = true ;
508
495
GridStackDD . get ( ) . off ( el , 'drag' ) ; // no need to track while being outside
509
496
}
510
497
@@ -535,7 +522,7 @@ GridStack.prototype._dragOrResize = function(el: GridItemHTMLElement, event: Eve
535
522
let resizing : boolean ;
536
523
537
524
if ( event . type === 'drag' ) {
538
- if ( node . _isCursorOutside ) return ; // handled by dropover
525
+ if ( node . _temporaryRemoved ) return ; // handled by dropover
539
526
let distance = ui . position . top - node . _prevYPix ;
540
527
node . _prevYPix = ui . position . top ;
541
528
Utils . updateScrollPosition ( el , ui . position , distance ) ;
@@ -545,19 +532,6 @@ GridStack.prototype._dragOrResize = function(el: GridItemHTMLElement, event: Eve
545
532
let top = ui . position . top + ( ui . position . top > node . _lastUiPosition . top ? - this . opts . marginBottom : this . opts . marginTop ) ;
546
533
p . x = Math . round ( left / cellWidth ) ;
547
534
p . y = Math . round ( top / cellHeight ) ;
548
-
549
- // if inTrash or outside of the bounds (but not external which is handled by 'dropout' event), temporarily remove it from us
550
- if ( node . _isAboutToRemove || ( ! node . _isExternal && this . engine . isOutside ( p . x , p . y , node ) ) ) {
551
- this . _leave ( node , event . target ) ;
552
- } else {
553
- if ( node . _temporaryRemoved ) {
554
- node . el = this . placeholder ;
555
- this . engine . addNode ( node ) ;
556
- this . el . appendChild ( this . placeholder ) ;
557
- // TEST console.log('drag placeholder');
558
- delete node . _temporaryRemoved ;
559
- }
560
- }
561
535
if ( node . x === p . x && node . y === p . y ) return ; // skip same
562
536
// DON'T skip one we tried as we might have failed because of coverage <50% before
563
537
// if (node._lastTried && node._lastTried.x === x && node._lastTried.y === y) return;
0 commit comments