Commit a6530728 authored by Christian Winter's avatar Christian Winter

wip. focus stuff

parent 26618e9a
...@@ -190,6 +190,10 @@ ...@@ -190,6 +190,10 @@
focus(focusable) { focus(focusable) {
this.currentFocus = focusable; this.currentFocus = focusable;
if (this.currentFocus)
GUI.writeToStats("currentFocus", this.currentFocus.toString());
else
GUI.writeToStats("currentFocus", "null");
} }
setView(view) { setView(view) {
...@@ -208,6 +212,8 @@ ...@@ -208,6 +212,8 @@
this._currentView = view; this._currentView = view;
this._currentView.activate(); this._currentView.activate();
this._currentView.canvas.focus(); this._currentView.canvas.focus();
GUI.writeToStats("currentView", this._currentView.toString());
} }
get currentView() { get currentView() {
......
...@@ -14,4 +14,7 @@ ...@@ -14,4 +14,7 @@
this.renderer.redraw(); this.renderer.redraw();
} }
toString() {
return "PrefabEditorView";
}
} }
\ No newline at end of file
...@@ -4,4 +4,7 @@ ...@@ -4,4 +4,7 @@
this.renderer = new SceneRenderer(this); this.renderer = new SceneRenderer(this);
} }
toString() {
return "SceneView";
}
} }
\ No newline at end of file
...@@ -651,4 +651,8 @@ ...@@ -651,4 +651,8 @@
this.canvas.width = this.canvas.offsetWidth; this.canvas.width = this.canvas.offsetWidth;
this.canvas.height = this.canvas.offsetHeight; this.canvas.height = this.canvas.offsetHeight;
} }
toString() {
console.log("toString() not implemented for view!")
}
} }
\ No newline at end of file
...@@ -31,11 +31,13 @@ class Input { ...@@ -31,11 +31,13 @@ class Input {
break; break;
} }
if (Application.currentView) if (Application.currentView) {
Application.currentView.keyDown(e.keyCode);
Application.currentView.logic.currentState.keyDown(e.keyCode); Application.currentView.logic.currentState.keyDown(e.keyCode);
}
if (Application.currentFocus) //if (Application.currentFocus)
Application.currentFocus.keyDown(e.keyCode); // Application.currentFocus.keyDown(e.keyCode);
// dont prevent default // dont prevent default
if (Application.currentView && !( if (Application.currentView && !(
...@@ -67,9 +69,12 @@ class Input { ...@@ -67,9 +69,12 @@ class Input {
switch (e.keyCode) { switch (e.keyCode) {
default: default:
if (Application.currentView) if (Application.currentView)
{
Application.currentView.keyUp(e.keyCode);
Application.currentView.logic.currentState.keyUp(e.keyCode); Application.currentView.logic.currentState.keyUp(e.keyCode);
if (Application.currentFocus) }
Application.currentFocus.keyUp(e.keyCode); //if (Application.currentFocus)
// Application.currentFocus.keyUp(e.keyCode);
break; break;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment