Started tool tutorials

This commit is contained in:
Nicola
2022-01-25 00:33:23 +01:00
parent 33f362ef09
commit 2e360dcf51
11 changed files with 125 additions and 20 deletions

View File

@ -24,6 +24,7 @@ class Tool {
biggerButton = undefined;
smallerButton = undefined;
brushPreview = document.getElementById("brush-preview");
toolTutorial = document.getElementById("tool-tutorial");
constructor (name, options) {
this.name = name;
@ -34,6 +35,22 @@ class Tool {
this.smallerButton = document.getElementById(name + "-smaller-button");
}
resetTutorial() {
this.toolTutorial.innerHTML = "<ul></ul>";
}
addTutorialKey(key, text) {
this.toolTutorial.children[0].append(
'<li><span class="keyboard-key">' + key + '</span> ' + text + '</li>');
}
addTutorialText(key, text) {
this.toolTutorial.children[0].append(
'<li>' + key + ': ' + text + '</li>');
}
addTutorialImg(imgPath) {
this.toolTutorial.children[0].append(
'<img src="' + imgPath + '"/>');
}
onSelect() {
if (this.mainButton != undefined)
this.mainButton.parentElement.classList.add("selected");