Obey some visibility flags

This commit is contained in:
Jordan Eldredge 2021-06-13 00:07:39 -07:00
parent 395cbfbcb9
commit 626ba0849d
2 changed files with 9 additions and 3 deletions

View file

@ -1,9 +1,11 @@
import { toBool } from "../utils";
import Group from "./Group";
import Layout from "./Layout";
import XmlObj from "./XmlObj";
export default class Container extends XmlObj {
_layouts: Layout[] = [];
_defaultVisible: boolean = true;
constructor() {
super();
}
@ -13,6 +15,8 @@ export default class Container extends XmlObj {
return true;
}
switch (key) {
case "default_visible":
this._defaultVisible = toBool(value);
default:
return false;
}
@ -26,8 +30,10 @@ export default class Container extends XmlObj {
getDebugDom(): HTMLDivElement {
const div = window.document.createElement("div");
for (const layout of this._layouts) {
div.appendChild(layout.getDebugDom());
if (this._defaultVisible) {
for (const layout of this._layouts) {
div.appendChild(layout.getDebugDom());
}
}
return div;
}

View file

@ -45,7 +45,7 @@ export default class Group extends GuiObj {
const div = super.getDebugDom();
div.style.height = Utils.px(this._maximumHeight);
div.style.width = Utils.px(this._maximumWidth);
if (this._background != null) {
if (this._background != null && this._drawBackground) {
const bitmap = UI_ROOT.getBitmap(this._background);
div.style.background = bitmap.getBackgrondCSSAttribute();
}