File tree Expand file tree Collapse file tree 1 file changed +17
-9
lines changed Expand file tree Collapse file tree 1 file changed +17
-9
lines changed Original file line number Diff line number Diff line change @@ -168,26 +168,34 @@ export class DDDraggable extends DDBaseImplement implements HTMLElementExtendOpt
168168 return coordinates
169169 }
170170
171+ _node ( ) {
172+ return this . el . gridstackNode ;
173+ }
174+
175+ _grid ( ) {
176+ return this . _node ( ) . grid
177+ }
178+
171179 protected _elNewCoordinates ( event : KeyboardEvent , element : HTMLElement ) {
172- const node = this . el . gridstackNode
173- const cellHeight = node . grid . getCellHeight ( ) * node . h
174- const cellWidth = node . grid . cellWidth ( )
175- const maxColumn = node . grid . opts . column
180+ const selectedNode = this . _node ( ) ;
181+ const cellHeight = this . _grid ( ) . getCellHeight ( ) * selectedNode . h
176182 let xCoord : number , yCoord : number
177183
178184 switch ( event . code ) {
179185 case 'ArrowRight' :
180- if ( typeof ( maxColumn ) == 'number' && node . x === ( maxColumn - 1 ) ) { break }
186+ const maxColumn = this . _grid ( ) . opts . column
187+
188+ if ( typeof ( maxColumn ) == 'number' && selectedNode . x === ( maxColumn - 1 ) ) { break }
181189
182- xCoord = cellWidth
190+ xCoord = this . _grid ( ) . cellWidth ( )
183191 break
184192 case 'ArrowLeft' :
185- if ( node . x === 0 ) { break }
193+ if ( selectedNode . x === 0 ) { break }
186194
187- xCoord = - cellWidth
195+ xCoord = - this . _grid ( ) . cellWidth ( )
188196 break
189197 case 'ArrowUp' :
190- if ( node . y === 0 ) { break }
198+ if ( selectedNode . y === 0 ) { break }
191199
192200 yCoord = - cellHeight
193201 break
You can’t perform that action at this time.
0 commit comments