File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2020 this . inputpeke ( ) ;
2121 }
2222 } ,
23- inputpeke : function ( ) {
24- // TODO replace with triangle inputs
25- this . inputarrow_cell ( ) ;
23+
24+ mousereset : function ( ) {
25+ this . prevPekeDir = 0 ;
26+ this . common . mousereset . call ( this ) ;
2627 } ,
27- inputarrow_cell_main : function ( cell , dir ) {
28- var value = 1 << ( dir + 1 ) ;
29- cell . setQsub ( cell . qsub ^ value ) ;
28+
29+ inputpeke : function ( ) {
30+ var cell = this . getcell ( ) ;
31+ if ( ! cell . isValid ( ) ) {
32+ return ;
33+ }
34+
35+ var dx = this . inputPoint . bx - cell . bx ,
36+ dy = this . inputPoint . by - cell . by ;
37+
38+ var dir = 0 ;
39+ if ( Math . abs ( dx ) > Math . abs ( dy ) ) {
40+ dir = dx > 0.2 ? 4 : dx < - 0.2 ? 3 : 0 ;
41+ } else {
42+ dir = dy > 0.2 ? 2 : dy < - 0.2 ? 1 : 0 ;
43+ }
44+
45+ if ( dir && ( dir !== this . prevPekeDir || this . mouseCell !== cell ) ) {
46+ this . mouseCell = cell ;
47+ this . prevPekeDir = dir ;
48+
49+ // TODO inputData for set/unset instead of xor
50+ var value = 1 << ( dir + 1 ) ;
51+ cell . setQsub ( cell . qsub ^ value ) ;
52+ cell . draw ( ) ;
53+ }
3054 } ,
3155
3256 inputLine : function ( ) {
You can’t perform that action at this time.
0 commit comments