Skip to content

Commit

Permalink
update: add pan on right click
Browse files Browse the repository at this point in the history
  • Loading branch information
VsevolodX committed Aug 1, 2023
1 parent 15ceaa9 commit fdcfe77
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/components/ThreejsEditorModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,21 @@ export class ThreejsEditorModal extends ModalDialog {
},
false,
);

// on right click and hold disable orbit controls to allow pan
document.addEventListener("mousedown", (event) => {
if (event.button === THREE.MOUSE.RIGHT) {
this.editor.controls.enabled = false;
}
});

// on right click release enable orbit controls
document.addEventListener("mouseup", (event) => {
if (event.button === THREE.MOUSE.RIGHT) {
this.editor.controls.enabled = true;
}
});

const onResize = () => this.editor.signals.windowResize.dispatch();
window.addEventListener("resize", onResize, false);
onResize();
Expand Down

0 comments on commit fdcfe77

Please sign in to comment.