Skip to content
Snippets Groups Projects
Commit 1382c3db authored by Maximilian Giller's avatar Maximilian Giller
Browse files

Made settings button right aligned and toggable

parent d1b777ac
No related branches found
No related tags found
No related merge requests found
...@@ -52,3 +52,7 @@ div#ks-editor img.preview-image { ...@@ -52,3 +52,7 @@ div#ks-editor img.preview-image {
max-width: 5rem; max-width: 5rem;
height: auto; height: auto;
} }
div#ks-editor #toolbar-settings {
float: right;
}
...@@ -64,7 +64,12 @@ export default class Toolbar { ...@@ -64,7 +64,12 @@ export default class Toolbar {
"", "",
tool, tool,
(e) => { (e) => {
state.setTool(e.data); var sameTool = state.tool === tool;
if (sameTool && tool.toggleBehaviour) {
state.setTool(state.previousTool);
} else {
state.setTool(e.data);
}
} }
); );
} }
......
...@@ -9,7 +9,7 @@ import Tool from "./tool"; ...@@ -9,7 +9,7 @@ import Tool from "./tool";
export default class SettingsTool extends Tool { export default class SettingsTool extends Tool {
constructor(key) { constructor(key) {
super("Settings", "settings", key, new SettingsMenu()); super("Settings", "settings", key, new SettingsMenu(), true);
} }
onMenuChange(key, value) { onMenuChange(key, value) {
......
export default class Tool { export default class Tool {
constructor(name, icon, key, menu) { constructor(name, icon, key, menu, toggleBehaviour = false) {
this.name = name; this.name = name;
this.icon = icon; this.icon = icon;
this.key = key; this.key = key;
this.warnings = false; this.warnings = false;
this.menu = menu; this.menu = menu;
this.toggleBehaviour = toggleBehaviour;
if (this.menu !== undefined) { if (this.menu !== undefined) {
this.menu.loadTool(this); this.menu.loadTool(this);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment