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
168
168
return coordinates
169
169
}
170
170
171
+ _node ( ) {
172
+ return this . el . gridstackNode ;
173
+ }
174
+
175
+ _grid ( ) {
176
+ return this . _node ( ) . grid
177
+ }
178
+
171
179
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
176
182
let xCoord : number , yCoord : number
177
183
178
184
switch ( event . code ) {
179
185
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 }
181
189
182
- xCoord = cellWidth
190
+ xCoord = this . _grid ( ) . cellWidth ( )
183
191
break
184
192
case 'ArrowLeft' :
185
- if ( node . x === 0 ) { break }
193
+ if ( selectedNode . x === 0 ) { break }
186
194
187
- xCoord = - cellWidth
195
+ xCoord = - this . _grid ( ) . cellWidth ( )
188
196
break
189
197
case 'ArrowUp' :
190
- if ( node . y === 0 ) { break }
198
+ if ( selectedNode . y === 0 ) { break }
191
199
192
200
yCoord = - cellHeight
193
201
break
You can’t perform that action at this time.
0 commit comments