mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
Minor refactor and bug fixing
This commit is contained in:
5
client/src/toolbars/commandmodetoolbar.ts
Normal file
5
client/src/toolbars/commandmodetoolbar.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import { Toolbar } from "./toolbar";
|
||||
|
||||
export class CommandModeToolbar extends Toolbar {
|
||||
// TODO move here all code about the command mode toolbar
|
||||
}
|
||||
13
client/src/toolbars/primarytoolbar.ts
Normal file
13
client/src/toolbars/primarytoolbar.ts
Normal 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", () => { });
|
||||
}
|
||||
}
|
||||
38
client/src/toolbars/toolbar.ts
Normal file
38
client/src/toolbars/toolbar.ts
Normal 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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user