35 lines
756 B
JavaScript
35 lines
756 B
JavaScript
import UI from "./ui.js";
|
|
|
|
class Panel extends UI {
|
|
constructor(width, height) {
|
|
super(document.createElement("div"), width, height);
|
|
|
|
this._hidden = true;
|
|
this.element.classList.add("panel");
|
|
this.element.classList.add("shadow");
|
|
this.element.classList.add("hidden");
|
|
}
|
|
|
|
toggle() {
|
|
if (this._hidden) {
|
|
this.show();
|
|
} else {
|
|
this.hide();
|
|
}
|
|
}
|
|
show() {
|
|
if (this._hidden) {
|
|
this.element.classList.remove("hidden");
|
|
this._hidden = false;
|
|
}
|
|
}
|
|
hide() {
|
|
if (!this._hidden) {
|
|
this.element.classList.add("hidden");
|
|
this._hidden = true;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
export default Panel; |