integrate unreliable camera_drag_move
This commit is contained in:
@ -20,6 +20,7 @@ import {
|
||||
EngineCommand,
|
||||
Subscription,
|
||||
EngineCommandManager,
|
||||
UnreliableSubscription,
|
||||
} from 'lang/std/engineConnection'
|
||||
import { uuidv4 } from 'lib/utils'
|
||||
import { deg2Rad } from 'lib/utils2d'
|
||||
@ -232,9 +233,18 @@ export class CameraControls {
|
||||
this.update()
|
||||
this._usePerspectiveCamera()
|
||||
|
||||
const cb: Subscription<
|
||||
'default_camera_zoom' | 'camera_drag_end' | 'default_camera_get_settings'
|
||||
>['callback'] = ({ data, type }) => {
|
||||
type CallBackParam = Parameters<
|
||||
(
|
||||
| Subscription<
|
||||
| 'default_camera_zoom'
|
||||
| 'camera_drag_end'
|
||||
| 'default_camera_get_settings'
|
||||
>
|
||||
| UnreliableSubscription<'camera_drag_move'>
|
||||
)['callback']
|
||||
>[0]
|
||||
|
||||
const cb = ({ data, type }: CallBackParam) => {
|
||||
const camSettings = data.settings
|
||||
this.camera.position.set(
|
||||
camSettings.pos.x,
|
||||
@ -287,6 +297,10 @@ export class CameraControls {
|
||||
event: 'default_camera_get_settings',
|
||||
callback: cb,
|
||||
})
|
||||
this.engineCommandManager.subscribeToUnreliable({
|
||||
event: 'camera_drag_move',
|
||||
callback: cb,
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user