mirror of
https://github.com/lovasoa/whitebophir
synced 2024-11-10 14:34:20 +00:00
change eraser and zoom icon
Co-authored-by: Finn Böger <finnboeger@googlemail.com>
This commit is contained in:
parent
f42b609bbb
commit
851e234778
3 changed files with 13 additions and 8 deletions
|
@ -92,7 +92,7 @@ Tools.HTML = {
|
|||
}
|
||||
});
|
||||
},
|
||||
addTool: function (toolName, toolIcon, toolShortcut) {
|
||||
addTool: function (toolName, toolIcon, toolIconHTML, toolShortcut) {
|
||||
var callback = function () {
|
||||
Tools.change(toolName);
|
||||
};
|
||||
|
@ -104,13 +104,16 @@ Tools.HTML = {
|
|||
elem.addEventListener("click", callback);
|
||||
elem.id = "toolID-" + toolName;
|
||||
elem.getElementsByClassName("tool-name")[0].textContent = Tools.i18n.t(toolName);
|
||||
var toolIconElem = elem.getElementsByClassName("tool-icon")[0];
|
||||
toolIconElem.src = toolIcon;
|
||||
toolIconElem.alt = toolIcon;
|
||||
if (toolIconHTML) {
|
||||
elem.getElementsByClassName("tool-icon")[0].innerHTML = toolIconHTML;
|
||||
} else {
|
||||
elem.getElementsByClassName("tool-icon")[0].textContent = toolIcon;
|
||||
}
|
||||
elem.title =
|
||||
Tools.i18n.t(toolName) + " (" +
|
||||
Tools.i18n.t("keyboard shortcut") + ": " +
|
||||
toolShortcut + ")";
|
||||
toolShortcut + ")" +
|
||||
(Tools.list[toolName].toggle? " [" + Tools.i18n.t("Click to togle")+ "]":"");
|
||||
});
|
||||
},
|
||||
changeTool: function (oldToolName, newToolName) {
|
||||
|
@ -161,7 +164,7 @@ Tools.add = function (newTool) {
|
|||
}
|
||||
|
||||
//Add the tool to the GUI
|
||||
Tools.HTML.addTool(newTool.name, newTool.icon, newTool.shortcut);
|
||||
Tools.HTML.addTool(newTool.name, newTool.icon, newTool.iconHTML, newTool.shortcut);
|
||||
|
||||
//There may be pending messages for the tool
|
||||
var pending = Tools.pendingMessages[newTool.name];
|
||||
|
|
|
@ -77,6 +77,8 @@
|
|||
|
||||
Tools.add({ //The new tool
|
||||
"name": "Eraser",
|
||||
"icon": "❌",
|
||||
"iconHTML": "<i style='color: #e75480;margin-top:7px' class='fas fa-skull-crossbones'></i>",
|
||||
"shortcut": "e",
|
||||
"listeners": {
|
||||
"press": startErasing,
|
||||
|
@ -84,7 +86,6 @@
|
|||
"release": stopErasing,
|
||||
},
|
||||
"draw": draw,
|
||||
"icon": "tools/eraser/icon.svg",
|
||||
"mouseCursor": "crosshair",
|
||||
});
|
||||
|
||||
|
|
|
@ -156,6 +156,8 @@
|
|||
|
||||
var zoomTool = {
|
||||
"name": "Zoom",
|
||||
"icon": "🔎",
|
||||
"iconHTML": "<i style='margin-top:7px' class='fas fa-search-plus' aria-hidden='true'></i>",
|
||||
"shortcut": "z",
|
||||
"listeners": {
|
||||
"press": press,
|
||||
|
@ -165,7 +167,6 @@
|
|||
"onstart": onstart,
|
||||
"onquit": onquit,
|
||||
"mouseCursor": "zoom-in",
|
||||
"icon": "tools/zoom/icon.svg",
|
||||
"helpText": "click_to_zoom",
|
||||
};
|
||||
Tools.add(zoomTool);
|
||||
|
|
Loading…
Reference in a new issue