66 IconButton ,
77 Icon ,
88 Modal ,
9+ Slider ,
910 TextField ,
1011 Tooltip ,
1112 Tabs ,
@@ -87,17 +88,19 @@ class ConfigModal extends Component {
8788 super ( props ) ;
8889 this . state = {
8990 open : false ,
90- skyColor : this . props . scene . settings . color ,
9191 displaySkyColorPicker : false ,
92- anchorEl : null ,
9392 displayFloorColorPicker : false ,
93+ displayMoveSpeedSlider : false ,
9494 qrCodeOpen : false ,
9595 pwProtectOpen : false ,
9696 shareOpen : false ,
9797 addClassOpen : false ,
9898 defaultLight : true ,
9999 castShadow : false ,
100100 spawnLightIndicator : false ,
101+ skyColor : this . props . scene . settings . color ,
102+ moveSpeed : this . props . scene . settings . moveSpeed ,
103+ anchorEl : null ,
101104 email : "" ,
102105 sendTo : [ ] ,
103106 collectionID : "" ,
@@ -118,7 +121,12 @@ class ConfigModal extends Component {
118121 * Closes the modal
119122 */
120123 handleClose = ( ) => {
121- this . setState ( { open : false , displaySkyColorPicker : false , displayFloorColorPicker : false } ) ;
124+ this . setState ( {
125+ open : false ,
126+ displaySkyColorPicker : false ,
127+ displayFloorColorPicker : false ,
128+ displayMoveSpeedSlider : false
129+ } ) ;
122130 } ;
123131
124132 handleClick = event => {
@@ -227,6 +235,16 @@ class ConfigModal extends Component {
227235 this . props . sceneActions . changeFloorColor ( color . hex ) ;
228236 } ;
229237
238+ handleMoveSpeedUpdate = ( e , newSpeed ) => {
239+ /* update component state whenever the slider's value changes
240+ * so text displays correctly, only update redux store on
241+ * mouseup when user drags slider */
242+ this . setState ( { moveSpeed : newSpeed } ) ;
243+ if ( ! e || e . type === "mouseup" ) {
244+ this . props . sceneActions . updateMoveSpeed ( newSpeed ) ;
245+ }
246+ } ;
247+
230248 handleSkyColorClick = ( ) => {
231249 this . setState ( { displaySkyColorPicker : ! this . state . displaySkyColorPicker } ) ;
232250 } ;
@@ -235,6 +253,10 @@ class ConfigModal extends Component {
235253 this . setState ( { displayFloorColorPicker : ! this . state . displayFloorColorPicker } ) ;
236254 } ;
237255
256+ handleMoveSpeedClick = ( ) => {
257+ this . setState ( { displayMoveSpeedSlider : ! this . state . displayMoveSpeedSlider } ) ;
258+ } ;
259+
238260 handleSkyColorClose = ( ) => {
239261 this . setState ( { displaySkyColorPicker : false } ) ;
240262 } ;
@@ -288,6 +310,7 @@ class ConfigModal extends Component {
288310 </ ButtonBase >
289311 ) ;
290312 } ;
313+
291314 defaultLightToggle = ( ) => {
292315 let style = this . props . scene . settings . defaultLight ? btnStyle . on : btnStyle . off ;
293316 style = { ...btnStyle . base , ...style } ;
@@ -307,7 +330,8 @@ class ConfigModal extends Component {
307330 Default Light
308331 </ ButtonBase >
309332 ) ;
310- }
333+ } ;
334+
311335 castShadowToggle = ( ) => {
312336 let style = this . props . scene . settings . castShadow ? btnStyle . on : btnStyle . off ;
313337 style = { ...btnStyle . base , ...style } ;
@@ -327,7 +351,8 @@ class ConfigModal extends Component {
327351 Cast Shadow
328352 </ ButtonBase >
329353 ) ;
330- }
354+ } ;
355+
331356 lightIndicatorToggle = ( ) => {
332357 let style = this . props . scene . settings . lightIndicator ? btnStyle . on : btnStyle . off ;
333358 style = { ...btnStyle . base , ...style } ;
@@ -347,7 +372,7 @@ class ConfigModal extends Component {
347372 Light Indicator
348373 </ ButtonBase >
349374 ) ;
350- }
375+ } ;
351376
352377 /**
353378 * Toggles the floor on and off
@@ -446,6 +471,20 @@ class ConfigModal extends Component {
446471 ) ;
447472 } ;
448473
474+ updateMoveSpeed = ( ) => {
475+ return (
476+ < ButtonBase
477+ style = { btnStyle . base }
478+ onClick = { ( ) => {
479+ this . props . handleRender ( ) ;
480+ this . handleMoveSpeedClick ( ) ;
481+ } } >
482+ < Icon className = "material-icons" > tune</ Icon >
483+ Change Speed
484+ </ ButtonBase >
485+ ) ;
486+ } ;
487+
449488 changeSkyColor = ( ) => {
450489 return (
451490 < ButtonBase
@@ -539,6 +578,9 @@ class ConfigModal extends Component {
539578 < this . lightIndicatorToggle />
540579 </ div >
541580 < div className = "col-12 border-bottom pt-4" > Camera Control</ div >
581+ < div className = "col-6" >
582+ < this . updateMoveSpeed />
583+ </ div >
542584 < div className = "col-6" >
543585 < this . resetPosition />
544586 </ div >
@@ -551,7 +593,10 @@ class ConfigModal extends Component {
551593 < Icon className = "material-icons" > clear</ Icon >
552594 </ ButtonBase >
553595 < div id = "color-cover" onClick = { this . handleSkyColorClose } />
554- < ChromePicker disableAlpha = { true } color = { this . state . skyColor } onChangeComplete = { this . handleSkyChangeComplete } />
596+ < ChromePicker
597+ disableAlpha = { true }
598+ color = { this . state . skyColor }
599+ onChangeComplete = { this . handleSkyChangeComplete } />
555600 </ div >
556601 :
557602 null
@@ -565,7 +610,35 @@ class ConfigModal extends Component {
565610 < Icon className = "material-icons" > clear</ Icon >
566611 </ ButtonBase >
567612 < div id = "color-cover" onClick = { this . handleFloorColorClose } />
568- < ChromePicker disableAlpha = { true } color = { this . state . floorColor } onChangeComplete = { this . handleFloorChangeComplete } />
613+ < ChromePicker
614+ disableAlpha = { true }
615+ color = { this . state . floorColor }
616+ onChangeComplete = { this . handleFloorChangeComplete } />
617+ </ div >
618+ :
619+ null
620+ }
621+ { this . state . displayMoveSpeedSlider
622+ ?
623+ < div id = "speed-config" className = "col-12 pt-4" >
624+ < div className = "row" >
625+ < div className = "col-9" >
626+ < Slider
627+ value = { this . state . moveSpeed }
628+ valueLabelDisplay = "auto"
629+ onChange = { this . handleMoveSpeedUpdate }
630+ onChangeCommitted = { this . handleMoveSpeedUpdate }
631+ min = { 0 }
632+ max = { 1000 } />
633+ </ div >
634+ < div className = "col-3 align-top" >
635+ < ButtonBase
636+ onClick = { ( ) => this . handleMoveSpeedUpdate ( null , 150 ) } >
637+ < Icon className = "material-icons" > settings_backup_restore</ Icon >
638+ Reset
639+ </ ButtonBase >
640+ </ div >
641+ </ div >
569642 </ div >
570643 :
571644 null
@@ -686,4 +759,4 @@ class ConfigModal extends Component {
686759
687760const SceneConfigMenu = withStyles ( modelStyles ) ( ConfigModal ) ;
688761
689- export default SceneConfigMenu ;
762+ export default SceneConfigMenu ;
0 commit comments