@@ -5,23 +5,20 @@ import SelectBox from './selectbox'
55import { Theme , ALL_THEMES } from './themes.js'
66import { DESATURATION_FILTER } from './filters.js'
77import { JSON_delta } from './vendor/json_delta.js'
8+ import Config from './config.js'
89
910const PIXI = require ( 'pixi.js' )
1011
1112const addWheelListener = require ( './vendor/addWheelListener' )
1213
13- const TRUTHY_VALUES = new Set ( [ '1' , 'true' ] )
14-
1514
1615export default class App {
1716
1817 constructor ( ) {
1918 const params = this . parseLocationHash ( )
20- this . dashboardMode = TRUTHY_VALUES . has ( params . get ( 'dashboard' ) )
21- this . reloadIntervalSeconds = parseInt ( params . get ( 'reload' ) ) || 0
19+ this . config = Config . fromParams ( params )
2220 this . filterString = params . get ( 'q' ) || ''
2321 this . selectedClusters = new Set ( ( params . get ( 'clusters' ) || '' ) . split ( ',' ) . filter ( x => x ) )
24- this . initialScale = parseFloat ( params . get ( 'scale' ) ) || 1.0
2522 this . seenPods = new Set ( )
2623 this . sorterFn = ''
2724 this . theme = Theme . get ( localStorage . getItem ( 'theme' ) )
@@ -104,8 +101,9 @@ export default class App {
104101 initialize ( ) {
105102 App . current = this
106103
107- //Create the renderer
108- const renderer = PIXI . autoDetectRenderer ( 256 , 256 , { resolution : 2 } )
104+ // create the renderer
105+ const noWebGL = this . config . renderer === 'canvas'
106+ const renderer = PIXI . autoDetectRenderer ( 256 , 256 , { resolution : 2 } , noWebGL )
109107 renderer . view . style . display = 'block'
110108 renderer . autoResize = true
111109 renderer . resize ( window . innerWidth , window . innerHeight )
@@ -124,8 +122,8 @@ export default class App {
124122 this . registerEventListeners ( )
125123 setInterval ( this . pruneUnavailableClusters . bind ( this ) , 5 * 1000 )
126124
127- if ( this . reloadIntervalSeconds ) {
128- setTimeout ( function ( ) { location . reload ( false ) } , this . reloadIntervalSeconds * 1000 )
125+ if ( this . config . reloadIntervalSeconds ) {
126+ setTimeout ( function ( ) { location . reload ( false ) } , this . config . reloadIntervalSeconds * 1000 )
129127 }
130128 }
131129
@@ -152,7 +150,7 @@ export default class App {
152150 }
153151 else if ( event . key == 'Home' ) {
154152 this . viewContainerTargetPosition . x = 20
155- this . viewContainerTargetPosition . y = this . dashboardMode ? 20 : 40
153+ this . viewContainerTargetPosition . y = this . config . dashboardMode ? 20 : 40
156154 }
157155 else if ( event . key && event . key . length == 1 && ! event . ctrlKey && ! event . metaKey ) {
158156 this . filterString += event . key
@@ -334,14 +332,14 @@ export default class App {
334332 this . theme . apply ( this . stage )
335333
336334 const viewContainer = new PIXI . Container ( )
337- viewContainer . scale . set ( this . initialScale )
335+ viewContainer . scale . set ( this . config . initialScale )
338336 viewContainer . x = 20
339- viewContainer . y = this . dashboardMode ? 20 : 40
337+ viewContainer . y = this . config . dashboardMode ? 20 : 40
340338 this . viewContainerTargetPosition . x = viewContainer . x
341339 this . viewContainerTargetPosition . y = viewContainer . y
342340 this . stage . addChild ( viewContainer )
343341
344- if ( ! this . dashboardMode ) {
342+ if ( ! this . config . dashboardMode ) {
345343 this . drawMenuBar ( )
346344 }
347345
0 commit comments