File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -91,6 +91,7 @@ Application.prototype.hotkey = function (event) {
91
91
if ( event . target . tagName == 'BODY' ) {
92
92
var direction = { 37 : LEFT , 38 : TOP , 39 : RIGHT , 40 : BOTTOM } [ event . keyCode ]
93
93
if ( typeof direction != 'undefined' ) {
94
+ event . preventDefault ( )
94
95
if ( direction == this . boxbot . bot . getCurrentDirection ( ) ) {
95
96
this . boxbot . run ( this . boxbot . go ) . then ( null , function ( e ) {
96
97
console . log ( e )
@@ -99,10 +100,9 @@ Application.prototype.hotkey = function (event) {
99
100
this . boxbot . run ( this . boxbot . turn , [ direction ] )
100
101
}
101
102
} else if ( event . keyCode == 32 ) {
103
+ event . preventDefault ( )
102
104
this . boxbot . run ( this . boxbot . build )
103
105
}
104
- //防止操作键盘上下键时,导致整个页面的上下移动
105
- event . preventDefault ( )
106
106
}
107
107
}
108
108
You can’t perform that action at this time.
0 commit comments