2018-11-19 15:04:16 +00:00
|
|
|
import UI from "./ui.js";
|
2018-11-19 15:03:05 +00:00
|
|
|
|
|
|
|
class Panel extends UI {
|
2018-11-19 14:44:36 +00:00
|
|
|
constructor(width, height) {
|
2018-11-19 15:03:05 +00:00
|
|
|
super(document.createElement("div"), width, height);
|
|
|
|
|
2018-11-19 14:44:36 +00:00
|
|
|
this._hidden = true;
|
2018-11-19 15:06:01 +00:00
|
|
|
this.element.classList.add("panel");
|
2018-11-19 14:44:36 +00:00
|
|
|
this.element.classList.add("shadow");
|
|
|
|
this.element.classList.add("hidden");
|
|
|
|
}
|
2018-11-20 11:42:02 +00:00
|
|
|
add(ui) {
|
|
|
|
this.element.appendChild(ui.element);
|
|
|
|
}
|
2018-11-19 14:44:36 +00:00
|
|
|
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;
|