Spaces:
Sleeping
Sleeping
Pim Schreurs commited on
Commit ·
aa14f68
1
Parent(s): 80d8f72
Fix orientation controls for iOS13
Browse filesFiles changed (4)
122 unmodified lines12312412512612712812913013113233 unmodified lines166167168169170171172173122 unmodified lines}.no-ui #loading { display: none; }#keyboard-controls { display: block; }#mobile-device-controls { display: none; }.mobile-device #keyboard-controls { display: none; }.mobile-device #mobile-device-controls { display: block; }canvas { display: block; }33 unmodified linesScroll to increase/decrease your field of view.</div><div id="mobile-device-controls"><div class="no-pointer-events">Point your device around you to look around. Touch the screen to move forwards. Use two fingers to go faster.</div><div id="teleport">Teleport to next object</div></div></div>122 unmodified lines12312412512612712812913013113213313413513613713813914014114214314414514614714814915033 unmodified lines184185186187188189190191192193194195122 unmodified lines}.no-ui #loading { display: none; }button {color: orange;font: inherit;text-shadow: inherit;border: 1px solid;background: rgba(0,0,0,0.5);line-height: 1.5;}#keyboard-controls { display: block; }#mobile-device-controls { display: none; }.mobile-device #keyboard-controls { display: none; }.mobile-device #mobile-device-controls { display: block; }#permit-motion-controls {display: none;}.no-motion-controls #permit-motion-controls {display: inline-block;}.no-motion-controls .motion-description {display: none;}canvas { display: block; }33 unmodified linesScroll to increase/decrease your field of view.</div><div id="mobile-device-controls"><div class="no-pointer-events"><span class="motion-description">Point your device around you to look around.</span>Touch the screen to move forwards. Use two fingers to go faster.</div><button id="permit-motion-controls">Click here to enable looking around</button><button id="teleport">Teleport to next object</button></div></div>
139 unmodified lines140141142143144145139 unmodified lines})}this.player.addController(this.keyboardControls)this.player.addController(this.mobileDeviceControls)}139 unmodified lines140141142143144145146147139 unmodified lines})}this.controlsManager.start()this.player.addController(this.keyboardControls)this.player.addController(this.mobileDeviceControls)}
7 unmodified lines8910111213141516171819206 unmodified lines2728293031323313 unmodified lines4748495051527 unmodified linesthis.onKeyPress = this.onKeyPress.bind(this)this.onDeviceOrientation = this.onDeviceOrientation.bind(this)this.setDesktop()}setDesktop () {window.addEventListener('deviceorientation', this.onDeviceOrientation, false)this.keyboardControls.enable()this.mobileDeviceControls.disable()6 unmodified linesthis.controls = 'mobile'window.addEventListener('keypress', this.onKeyPress, false)window.removeEventListener('deviceorientation', this.onDeviceOrientation, false)this.keyboardControls.disable()this.mobileDeviceControls.enable()13 unmodified lines}this.setMobile()}}7 unmodified lines89101112131415161718192021222324252627282930313233346 unmodified lines41424344454613 unmodified lines6061626364656667687 unmodified linesthis.onKeyPress = this.onKeyPress.bind(this)this.onDeviceOrientation = this.onDeviceOrientation.bind(this)}start () {window.addEventListener('deviceorientation', this.onDeviceOrientation, false)if (window.DeviceOrientationEvent && window.DeviceOrientationEvent.requestPermission) {this.setMobile()document.body.classList.add('no-motion-controls')document.querySelector('#permit-motion-controls').addEventListener('click',() => window.DeviceOrientationEvent.requestPermission(),false)}else {this.setDesktop()}}setDesktop () {this.keyboardControls.enable()this.mobileDeviceControls.disable()6 unmodified linesthis.controls = 'mobile'window.addEventListener('keypress', this.onKeyPress, false)this.keyboardControls.disable()this.mobileDeviceControls.enable()13 unmodified lines}this.setMobile()document.body.classList.remove('no-motion-controls')window.removeEventListener('deviceorientation', this.onDeviceOrientation, false)}}
47 unmodified lines48495051525354555647 unmodified linesrender () {for (let i = 0; i < this.passes.length; i++) {let pass = this.passes[i]pass.render(this.renderer, this.writeBuffer, this.readBuffer)}}47 unmodified lines4849505152535447 unmodified linesrender () {for (let i = 0; i < this.passes.length; i++) {this.passes[i].render(this.renderer, this.writeBuffer, this.readBuffer)}}
index.html+24-2
src/Simulation.js+2
src/controls/ControlsManager.js+20-4
src/postprocessing/EffectComposer.js+1-3