Minor refactor and bug fixing

This commit is contained in:
Pax1601
2023-09-08 22:41:37 +02:00
parent 89c39c7038
commit 74d5480587
59 changed files with 174 additions and 2392 deletions

View File

@@ -0,0 +1,5 @@
import { Toolbar } from "./toolbar";
export class CommandModeToolbar extends Toolbar {
// TODO move here all code about the command mode toolbar
}

View File

@@ -0,0 +1,13 @@
import { Dropdown } from "../controls/dropdown";
import { Toolbar } from "./toolbar";
export class PrimaryToolbar extends Toolbar {
constructor(ID: string) {
super(ID);
// TODO move here all code about primary toolbar
/* The content of the dropdown is entirely defined in the .ejs file */
new Dropdown("app-icon", () => { });
}
}

View File

@@ -0,0 +1,38 @@
export class Toolbar {
#element: HTMLElement
#visible: boolean = true;
/**
*
* @param ID - the ID of the HTML element which will contain the context menu
*/
constructor(ID: string){
this.#element = document.getElementById(ID) as HTMLElement;
}
show() {
this.#element.classList.toggle("hide", false);
this.#visible = true;
}
hide() {
this.#element.classList.toggle("hide", true);
this.#visible = false;
}
toggle() {
// Simple way to track if currently visible
if (this.#visible)
this.hide();
else
this.show();
}
getElement() {
return this.#element;
}
getVisible(){
return this.#visible;
}
}