@@ -76,15 +76,6 @@ export abstract class GridStackDD extends GridStackDDI {
7676GridStack . prototype . _setupAcceptWidget = function ( ) : GridStack {
7777 if ( this . opts . staticGrid ) return this ;
7878
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-
8879 // vars shared across all methods
8980 let gridPos : MousePosition ;
9081 let cellHeight : number , cellWidth : number ;
@@ -128,6 +119,7 @@ GridStack.prototype._setupAcceptWidget = function(): GridStack {
128119 let node : GridStackNode = el . gridstackNode ;
129120 // set accept drop to true on ourself (which we ignore) so we don't get "can't drop" icon in HTML5 mode while moving
130121 if ( node && node . grid === this ) return true ;
122+ if ( ! this . opts . acceptWidgets ) return false ;
131123 // check for accept method or class matching
132124 let canAccept = true ;
133125 if ( typeof this . opts . acceptWidgets === 'function' ) {
@@ -199,9 +191,6 @@ GridStack.prototype._setupAcceptWidget = function(): GridStack {
199191 node . _temporaryRemoved = true ; // so we can insert it
200192 }
201193
202- // we're entering this grid (even if we left another)
203- delete node . _isCursorOutside ;
204-
205194 GridStackDD . get ( ) . on ( el , 'drag' , onDrag ) ;
206195 // make sure this is called at least once when going fast #1578
207196 onDrag ( event as DragEvent , el , helper ) ;
@@ -477,7 +466,6 @@ GridStack.prototype._onStartMoving = function(el: GridItemHTMLElement, event: Ev
477466 node . _prevYPix = ui . position . top ;
478467 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)
479468 delete node . _lastTried ;
480- delete node . _isCursorOutside ;
481469
482470 if ( event . type === 'dropover' && node . _temporaryRemoved ) {
483471 // TEST console.log('engine.addNode x=' + node.x);
@@ -504,7 +492,6 @@ GridStack.prototype._leave = function(node: GridStackNode, el: GridItemHTMLEleme
504492 if ( ! node ) return ;
505493
506494 if ( dropoutEvent ) {
507- node . _isCursorOutside = true ;
508495 GridStackDD . get ( ) . off ( el , 'drag' ) ; // no need to track while being outside
509496 }
510497
@@ -535,7 +522,7 @@ GridStack.prototype._dragOrResize = function(el: GridItemHTMLElement, event: Eve
535522 let resizing : boolean ;
536523
537524 if ( event . type === 'drag' ) {
538- if ( node . _isCursorOutside ) return ; // handled by dropover
525+ if ( node . _temporaryRemoved ) return ; // handled by dropover
539526 let distance = ui . position . top - node . _prevYPix ;
540527 node . _prevYPix = ui . position . top ;
541528 Utils . updateScrollPosition ( el , ui . position , distance ) ;
@@ -545,19 +532,6 @@ GridStack.prototype._dragOrResize = function(el: GridItemHTMLElement, event: Eve
545532 let top = ui . position . top + ( ui . position . top > node . _lastUiPosition . top ? - this . opts . marginBottom : this . opts . marginTop ) ;
546533 p . x = Math . round ( left / cellWidth ) ;
547534 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- }
561535 if ( node . x === p . x && node . y === p . y ) return ; // skip same
562536 // DON'T skip one we tried as we might have failed because of coverage <50% before
563537 // if (node._lastTried && node._lastTried.x === x && node._lastTried.y === y) return;
0 commit comments