@@ -40,7 +40,7 @@ export class GridStackEngine {
40
40
/** @internal cached layouts of difference column count so we can restore back (eg 12 -> 1 -> 12) */
41
41
protected _layouts ?: GridStackNode [ ] [ ] ; // maps column # to array of values nodes
42
42
/** @internal true while we are resizing widgets during column resize to skip certain parts */
43
- protected _inColumnResize : boolean ;
43
+ protected _inColumnResize ? : boolean ;
44
44
/** @internal true if we have some items locked */
45
45
protected _hasLocked : boolean ;
46
46
/** @internal unique global internal _id counter */
@@ -127,7 +127,7 @@ export class GridStackEngine {
127
127
}
128
128
129
129
/** return the nodes that intercept the given node. Optionally a different area can be used, as well as a second node to skip */
130
- public collide ( skip : GridStackNode , area = skip , skip2 ?: GridStackNode ) : GridStackNode {
130
+ public collide ( skip : GridStackNode , area = skip , skip2 ?: GridStackNode ) : GridStackNode | undefined {
131
131
const skipId = skip . _id ;
132
132
const skip2Id = skip2 ?. _id ;
133
133
return this . nodes . find ( n => n . _id !== skipId && n . _id !== skip2Id && Utils . isIntercepted ( n , area ) ) ;
@@ -139,7 +139,7 @@ export class GridStackEngine {
139
139
}
140
140
141
141
/** does a pixel coverage collision based on where we started, returning the node that has the most coverage that is >50% mid line */
142
- protected directionCollideCoverage ( node : GridStackNode , o : GridStackMoveOpts , collides : GridStackNode [ ] ) : GridStackNode {
142
+ protected directionCollideCoverage ( node : GridStackNode , o : GridStackMoveOpts , collides : GridStackNode [ ] ) : GridStackNode | undefined {
143
143
if ( ! o . rect || ! node . _rect ) return ;
144
144
let r0 = node . _rect ; // where started
145
145
let r = { ...o . rect } ; // where we are
@@ -218,7 +218,7 @@ export class GridStackEngine {
218
218
}
219
219
220
220
/** called to possibly swap between 2 nodes (same size or column, not locked, touching), returning true if successful */
221
- public swap ( a : GridStackNode , b : GridStackNode ) : boolean {
221
+ public swap ( a : GridStackNode , b : GridStackNode ) : boolean | undefined {
222
222
if ( ! b || b . locked || ! a || a . locked ) return false ;
223
223
224
224
function _doSwap ( ) : true { // assumes a is before b IFF they have different height (put after rather than exact swap)
@@ -953,7 +953,7 @@ export class GridStackEngine {
953
953
return this ;
954
954
}
955
955
956
- protected findCacheLayout ( n : GridStackNode , column : number ) : number {
956
+ protected findCacheLayout ( n : GridStackNode , column : number ) : number | undefined {
957
957
return this . _layouts ?. [ column ] ?. findIndex ( l => l . _id === n . _id ) ?? - 1 ;
958
958
}
959
959
0 commit comments