Remove most of modelingMachine.context.store (#3867)

This commit is contained in:
Frank Noirot
2024-09-12 22:06:50 -04:00
committed by GitHub
parent 772034af68
commit 728e87a627
21 changed files with 97 additions and 227 deletions

View File

@ -343,7 +343,8 @@ export class CameraControls {
this.camera.updateProjectionMatrix()
}
onMouseDown = (event: MouseEvent) => {
onMouseDown = (event: PointerEvent) => {
this.domElement.setPointerCapture(event.pointerId)
this.isDragging = true
this.mouseDownPosition.set(event.clientX, event.clientY)
let interaction = this.getInteractionType(event)
@ -363,7 +364,7 @@ export class CameraControls {
}
}
onMouseMove = (event: MouseEvent) => {
onMouseMove = (event: PointerEvent) => {
if (this.isDragging) {
this.mouseNewPosition.set(event.clientX, event.clientY)
const deltaMove = this.mouseNewPosition
@ -401,10 +402,29 @@ export class CameraControls {
this.pendingPan.x += -deltaMove.x * panSpeed
this.pendingPan.y += deltaMove.y * panSpeed
}
} else {
/**
* If we're not in sketch mode and not dragging, we can highlight entities
* under the cursor. This recently moved from being handled in App.tsx.
* This might not be the right spot, but it is more consolidated.
*/
if (this.syncDirection === 'engineToClient') {
const newCmdId = uuidv4()
this.throttledEngCmd({
type: 'modeling_cmd_req',
cmd: {
type: 'highlight_set_entity',
selected_at_window: { x: event.clientX, y: event.clientY },
},
cmd_id: newCmdId,
})
}
}
}
onMouseUp = (event: MouseEvent) => {
onMouseUp = (event: PointerEvent) => {
this.domElement.releasePointerCapture(event.pointerId)
this.isDragging = false
this.handleEnd()
if (this.syncDirection === 'engineToClient') {