mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-05 01:38:44 +00:00
added focus.
This commit is contained in:
1 parent
c1b5f052cc
commit
eaf9a10e4e
1 file changed
+10
@@ -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();
|
||||
|
||||
Reference in new issue
Block a user