Spaces:
Running
Running
File size: 818 Bytes
8194362 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
import DeviceOrientationControls from './DeviceOrientationControls'
import TouchControls from './TouchControls'
import ControlsBase from './ControlsBase'
export default class MobileDeviceControls extends ControlsBase {
constructor (player, element) {
super(player, element)
this.deviceOrientationControls = new DeviceOrientationControls(player)
this.touchControls = new TouchControls(player, element)
}
enable () {
this.deviceOrientationControls.enable()
this.touchControls.enable()
this.enabled = true
}
disable () {
this.deviceOrientationControls.disable()
this.touchControls.disable()
this.enabled = false
}
update () {
if (this.enabled === false) {
return
}
this.deviceOrientationControls.update()
this.touchControls.update()
}
}
|