diff --git a/app/pages/PageEnigma/js/editor.ts b/app/pages/PageEnigma/js/editor.ts index 728b46a170..c4a73e07df 100644 --- a/app/pages/PageEnigma/js/editor.ts +++ b/app/pages/PageEnigma/js/editor.ts @@ -332,6 +332,7 @@ class Editor { // OnClick and MouseMove events. window.addEventListener("mousemove", this.onMouseMove.bind(this), false); window.addEventListener("click", this.onMouseClick.bind(this), false); + window.addEventListener("keydown", this.onkeydown.bind(this), false); // Base control and debug stuff remove debug in prod. if (this.control == undefined) { return; @@ -1325,6 +1326,15 @@ class Editor { } } + onkeydown(event: any) { + if (event.key === 'f' && this.selected && this.orbitControls) { + this.orbitControls.target.copy(this.selected.position); + this.orbitControls.maxDistance = 4; + this.orbitControls.update(); + this.orbitControls.maxDistance = 999; + } + } + // Sets new mouse location usually used in raycasts. onMouseMove(event: any) { const rect = this.canvReference.getBoundingClientRect();