added focus.

This commit is contained in:
Quicksticks-oss committed 2024-04-23 14:17:47 -04:00
1 parent c1b5f052cc
commit eaf9a10e4e
1 file changed
+10
+10
View File
@@ -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();