Commit 1b01955f authored by Christian Winter's avatar Christian Winter

button keeps the pressed state (visually) when editing prefabs

parent 6d848db5
Pipeline #4801367 passed with stage
in 42 seconds
......@@ -41,9 +41,19 @@
static editPrefab(id) {
if (Logic.backlogState)
{
if (Logic.backlogState.currentPrefab == this.prefabs[id])
{
Logic.backlogState.apply();
Logic.setBacklogState(null);
return;
}
Logic.backlogState.apply();
}
Logic.backlogState = new EditPrefabState(this.prefabs[id]);
Logic.setBacklogState(new EditPrefabState(this.prefabs[id]));
GUI.notify("Editing prefab.", 'green')
}
......
......@@ -86,13 +86,12 @@
Utilities.extrudeSelection();
break;
case Key.Enter:
if (Logic.backlogState) {
/*if (Logic.backlogState) {
if (Logic.backlogState instanceof EditPrefabState) {
Logic.backlogState.apply();
}
} else {
GUI.use2DCursorTogglePressed();
}
} else // */
GUI.use2DCursorTogglePressed();
break;
}
......
......@@ -583,6 +583,12 @@
button.setAttribute("title", "Edit prefab");
button.setAttribute("onclick", "PrefabManager.editPrefab(" + i + ")");
button.innerHTML = "+";
if (Logic.backlogState instanceof EditPrefabState &&
Logic.backlogState.currentPrefab == prefabs[i]) {
button.setAttribute("id", "selectedButton");
}
td.appendChild(button);
// select prefab button
......
......@@ -172,8 +172,11 @@ class Logic {
this.currentState.enter();
Renderer.redraw();
if (Preferences.developerMode)
if (Preferences.developerMode) {
;//console.log(this.previousState + " --> " + this.currentState);
GUI.writeToStats("currentState", state.toString());
}
}
static setWaitingState(state) {
......@@ -185,6 +188,16 @@ class Logic {
Renderer.redraw();
}
static setBacklogState(state) {
if (this.backlogState)
this.backlogState.exit();
this.backlogState = state;
if (this.backlogState)
this.backlogState.enter();
}
static useWaitingState() {
this.setState(this.waitingState);
}
......
......@@ -6,10 +6,11 @@
}
enter() {
GUI.buildPrefabUI();
}
exit() {
GUI.buildPrefabUI();
}
store() {
......@@ -34,9 +35,10 @@
File.currentLayer = this.currentLayer;
Selection.data = this.selectionData;
Logic.backlogState = null;
Logic.setBacklogState(null);
Renderer.redraw();
GUI.notify("");
GUI.buildPrefabUI();
}
apply() {
......
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