From 287f4369ffda61c65f7f57ff31679933775227b9 Mon Sep 17 00:00:00 2001 From: Max <m.giller.dev@gmail.com> Date: Fri, 9 Jul 2021 13:03:54 +0200 Subject: [PATCH] Separated icon from key --- editor/js/display.js | 2 +- editor/js/tools/collecttool.js | 2 +- editor/js/tools/deletetool.js | 2 +- editor/js/tools/selecttool.js | 2 +- editor/js/tools/tool.js | 7 ++++++- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/editor/js/display.js b/editor/js/display.js index de6379c..91eb1bd 100644 --- a/editor/js/display.js +++ b/editor/js/display.js @@ -49,7 +49,7 @@ class Display { tool.getName() + '"><img src="' + TOOL_ICON_SRC + - tool.getKey() + + tool.getIcon() + TOOL_ICON_FORMAT + '"></button>' ); diff --git a/editor/js/tools/collecttool.js b/editor/js/tools/collecttool.js index 5554a0f..fa2ab96 100644 --- a/editor/js/tools/collecttool.js +++ b/editor/js/tools/collecttool.js @@ -1,6 +1,6 @@ class CollectTool extends Tool { constructor(key) { - super("Collect", key); + super("Collect", "collect", key); } onNodeClick(node) { diff --git a/editor/js/tools/deletetool.js b/editor/js/tools/deletetool.js index 6f99000..35110df 100644 --- a/editor/js/tools/deletetool.js +++ b/editor/js/tools/deletetool.js @@ -1,6 +1,6 @@ class DeleteTool extends Tool { constructor(key) { - super("Delete", key); + super("Delete", "delete", key); } onNodeClick(node) { diff --git a/editor/js/tools/selecttool.js b/editor/js/tools/selecttool.js index 4c4b427..c50a726 100644 --- a/editor/js/tools/selecttool.js +++ b/editor/js/tools/selecttool.js @@ -1,6 +1,6 @@ class SelectTool extends Tool { constructor(key) { - super("Select", key); + super("Select", "select", key); } onNodeClick(node) { diff --git a/editor/js/tools/tool.js b/editor/js/tools/tool.js index 3cbce81..babede8 100644 --- a/editor/js/tools/tool.js +++ b/editor/js/tools/tool.js @@ -1,6 +1,7 @@ class Tool { - constructor(name, key) { + constructor(name, icon, key) { this.name = name; + this.icon = icon; this.key = key; this.warnings = false; } @@ -13,6 +14,10 @@ class Tool { return this.key; } + getIcon() { + return this.icon; + } + onNodeClick(node) { if (this.warnings) { console.warn('Method "onNodeClick" not implemented.'); -- GitLab