Skip to content

Commit cd38537

Browse files
committed
Editor: Clean up grid code and improve colors.
1 parent 0dd43bd commit cd38537

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

editor/js/Viewport.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,18 @@ function Viewport( editor ) {
4343

4444
// helpers
4545

46+
const GRID_COLORS_LIGHT = [ 0x999999, 0x777777 ]
47+
const GRID_COLORS_DARK = [ 0x555555, 0x888888 ];
48+
4649
const grid = new THREE.Group();
4750

48-
const grid1 = new THREE.GridHelper( 30, 30, 0x888888 );
49-
grid1.material.color.setHex( 0x888888 );
51+
const grid1 = new THREE.GridHelper( 30, 30 );
52+
grid1.material.color.setHex( GRID_COLORS_LIGHT[ 0 ] );
5053
grid1.material.vertexColors = false;
5154
grid.add( grid1 );
5255

53-
const grid2 = new THREE.GridHelper( 30, 6, 0x222222 );
54-
grid2.material.color.setHex( 0x222222 );
56+
const grid2 = new THREE.GridHelper( 30, 6 );
57+
grid2.material.color.setHex( GRID_COLORS_LIGHT[ 1 ] );
5558
grid2.material.vertexColors = false;
5659
grid.add( grid2 );
5760

@@ -330,14 +333,14 @@ function Viewport( editor ) {
330333
mediaQuery.addEventListener( 'change', function ( event ) {
331334

332335
renderer.setClearColor( event.matches ? 0x333333 : 0xaaaaaa );
333-
updateGridColors( grid1, grid2, event.matches ? [ 0x222222, 0x888888 ] : [ 0x888888, 0x282828 ] );
336+
updateGridColors( grid1, grid2, event.matches ? GRID_COLORS_DARK : GRID_COLORS_LIGHT );
334337

335338
render();
336339

337340
} );
338341

339342
renderer.setClearColor( mediaQuery.matches ? 0x333333 : 0xaaaaaa );
340-
updateGridColors( grid1, grid2, mediaQuery.matches ? [ 0x222222, 0x888888 ] : [ 0x888888, 0x282828 ] );
343+
updateGridColors( grid1, grid2, mediaQuery.matches ? GRID_COLORS_DARK : GRID_COLORS_LIGHT );
341344

342345
}
343346

0 commit comments

Comments
 (0)