File tree Expand file tree Collapse file tree 2 files changed +17
-15
lines changed
renderers/Array2DRenderer Expand file tree Collapse file tree 2 files changed +17
-15
lines changed Original file line number Diff line number Diff line change 11import { Data } from '/core/datas' ;
22import { Array2DRenderer } from '/core/renderers' ;
33
4+ class Element {
5+ constructor ( value ) {
6+ this . value = value ;
7+ this . patched = false ;
8+ this . selected = false ;
9+ }
10+ }
11+
412class Array2DData extends Data {
513 getRendererClass ( ) {
614 return Array2DRenderer ;
715 }
816
917 set ( array2d = [ ] ) {
10- this . data = [ ] ;
11- for ( const array1d of array2d ) {
12- const row = [ ] ;
13- for ( const value of array1d ) {
14- const col = {
15- value,
16- patched : false ,
17- selected : false ,
18- } ;
19- row . push ( col ) ;
20- }
21- this . data . push ( row ) ;
22- }
18+ this . data = array2d . map ( array1d => [ ...array1d ] . map ( value => new Element ( value ) ) ) ;
2319 super . set ( ) ;
2420 }
2521
2622 patch ( x , y , v = this . data [ x ] [ y ] . value ) {
23+ if ( ! this . data [ x ] [ y ] ) this . data [ x ] [ y ] = new Element ( ) ;
2724 this . data [ x ] [ y ] . value = v ;
2825 this . data [ x ] [ y ] . patched = true ;
2926 }
Original file line number Diff line number Diff line change 77
88 .row {
99 display : flex ;
10+ min-height : 28em ;
11+ align-items : stretch ;
12+
13+ & :empty {
14+ border-left : 1em solid $theme-light ;
15+ }
1016
1117 .col {
1218 display : flex ;
1319 align-items : center ;
1420 justify-content : center ;
1521 min-width : 28em ;
16- height : 28em ;
1722 background-color : $theme-normal ;
1823 border : 1em solid $theme-light ;
1924 margin-right : -1em ;
3338 }
3439 }
3540 }
36- }
41+ }
You can’t perform that action at this time.
0 commit comments