@@ -126,10 +126,14 @@ export class GridStackEngine {
126126
127127 /** return the nodes that intercept the given node. Optionally a different area can be used, as well as a second node to skip */
128128 public collide ( skip : GridStackNode , area = skip , skip2 ?: GridStackNode ) : GridStackNode {
129- return this . nodes . find ( n => n !== skip && n !== skip2 && Utils . isIntercepted ( n , area ) ) ;
129+ const skipId = skip . _id ;
130+ const skip2Id = skip2 ?. _id ;
131+ return this . nodes . find ( n => n . _id !== skipId && n . _id !== skip2Id && Utils . isIntercepted ( n , area ) ) ;
130132 }
131133 public collideAll ( skip : GridStackNode , area = skip , skip2 ?: GridStackNode ) : GridStackNode [ ] {
132- return this . nodes . filter ( n => n !== skip && n !== skip2 && Utils . isIntercepted ( n , area ) ) ;
134+ const skipId = skip . _id ;
135+ const skip2Id = skip2 ?. _id ;
136+ return this . nodes . filter ( n => n . _id !== skipId && n . _id !== skip2Id && Utils . isIntercepted ( n , area ) ) ;
133137 }
134138
135139 /** does a pixel coverage collision based on where we started, returning the node that has the most coverage that is >50% mid line */
@@ -522,7 +526,7 @@ export class GridStackEngine {
522526 }
523527
524528 public removeNode ( node : GridStackNode , removeDOM = true , triggerEvent = false ) : GridStackEngine {
525- if ( ! this . nodes . find ( n => n === node ) ) {
529+ if ( ! this . nodes . find ( n => n . _id === node . _id ) ) {
526530 // TEST console.log(`Error: GridStackEngine.removeNode() node._id=${node._id} not found!`)
527531 return this ;
528532 }
@@ -531,7 +535,7 @@ export class GridStackEngine {
531535 }
532536 if ( removeDOM ) node . _removeDOM = true ; // let CB remove actual HTML (used to set _id to null, but then we loose layout info)
533537 // don't use 'faster' .splice(findIndex(),1) in case node isn't in our list, or in multiple times.
534- this . nodes = this . nodes . filter ( n => n !== node ) ;
538+ this . nodes = this . nodes . filter ( n => n . _id !== node . _id ) ;
535539 return this . _packNodes ( )
536540 . _notify ( [ node ] ) ;
537541 }
@@ -564,7 +568,7 @@ export class GridStackEngine {
564568 column : this . column ,
565569 float : this . float ,
566570 nodes : this . nodes . map ( n => {
567- if ( n === node ) {
571+ if ( n . _id === node . _id ) {
568572 clonedNode = { ...n } ;
569573 return clonedNode ;
570574 }
0 commit comments