diff --git a/editor/css/editor.css b/editor/css/editor.css index 61852b227bff466abcd59bebe3470981e9a7362e..c677e85b07dd217591e75d878fe689fe1c5ff134 100644 --- a/editor/css/editor.css +++ b/editor/css/editor.css @@ -52,3 +52,7 @@ div#ks-editor img.preview-image { max-width: 5rem; height: auto; } + +div#ks-editor #toolbar-settings { + float: right; +} diff --git a/editor/js/toolbar.js b/editor/js/toolbar.js index a4b93c25e70aab9386f1c69b7d5ea40d900003dc..795628b92177c0f4d447a838a67a266f6ce3986b 100644 --- a/editor/js/toolbar.js +++ b/editor/js/toolbar.js @@ -64,7 +64,12 @@ export default class Toolbar { "", tool, (e) => { - state.setTool(e.data); + var sameTool = state.tool === tool; + if (sameTool && tool.toggleBehaviour) { + state.setTool(state.previousTool); + } else { + state.setTool(e.data); + } } ); } diff --git a/editor/js/tools/settingstool.js b/editor/js/tools/settingstool.js index 0812a270d12f404165dd54ad86ef1284a5aaa343..ca217e5c19d689308b07a2588f802ca374bc3777 100644 --- a/editor/js/tools/settingstool.js +++ b/editor/js/tools/settingstool.js @@ -9,7 +9,7 @@ import Tool from "./tool"; export default class SettingsTool extends Tool { constructor(key) { - super("Settings", "settings", key, new SettingsMenu()); + super("Settings", "settings", key, new SettingsMenu(), true); } onMenuChange(key, value) { diff --git a/editor/js/tools/tool.js b/editor/js/tools/tool.js index 63ab11725ff252d56e49ab12499e36888643c6a6..31ee19ac3b1e2ae5d733b326e5d8cdda97943ed8 100644 --- a/editor/js/tools/tool.js +++ b/editor/js/tools/tool.js @@ -1,10 +1,11 @@ export default class Tool { - constructor(name, icon, key, menu) { + constructor(name, icon, key, menu, toggleBehaviour = false) { this.name = name; this.icon = icon; this.key = key; this.warnings = false; this.menu = menu; + this.toggleBehaviour = toggleBehaviour; if (this.menu !== undefined) { this.menu.loadTool(this);