@@ -2,6 +2,7 @@ import { want } from '../../unit/'
22import event from '../../unit/event'
33import states from '../states'
44import { music } from '../../unit/music'
5+ import { fromJS , List } from 'immutable'
56const down = store => {
67 store . commit ( 'key_down' , true )
78 if ( store . state . cur !== null ) {
@@ -31,18 +32,17 @@ const down = store => {
3132 // store.dispatch(actions.moveBlock(next));
3233 states . auto ( )
3334 } else {
34- let matrix = state . matrix
35+ let matrix = fromJS ( state . matrix )
3536 const shape = cur . shape
36- const xy = cur . xy
37+ const xy = fromJS ( cur . xy )
38+ console . log ( { matrix, shape, xy } )
3739 shape . forEach ( ( m , k1 ) =>
3840 m . forEach ( ( n , k2 ) => {
39- if ( n && xy [ 0 ] + k1 >= 0 ) {
41+ if ( n && xy . get ( 0 ) + k1 >= 0 ) {
4042 // 竖坐标可以为负
41- let line = matrix [ xy [ 0 ] + k1 ]
42- // line = line.set(xy[1] + k2, 1);
43- line [ xy [ 1 ] + k2 ] = 1
44- matrix [ xy [ 0 ] + k1 ] = line
45- // matrix = matrix.set(xy[0] + k1, line);
43+ let line = matrix . get ( xy . get ( 0 ) + k1 )
44+ line = line . set ( xy . get ( 1 ) + k2 , 1 )
45+ matrix = matrix . set ( xy . get ( 0 ) + k1 , line )
4646 }
4747 } )
4848 )
0 commit comments