gravity/toolbar-group.js
2026-01-01 15:13:13 -06:00

38 lines
745 B
JavaScript

import {TOOLBAR_GROUP_CLASSNAME, WIDE_CLASSNAME} from './config.js';
export class ToolbarGroup {
sim = undefined;
toolbars = [];
constructor(sim) {
this.sim = sim;
this.div = document.createElement('div');
this.sim.div.appendChild(this.div);
this.div.classList.add(TOOLBAR_GROUP_CLASSNAME);
}
topRight() {
this.div.style.position = 'fixed';
this.div.style.top = '0px';
this.div.style.right = '0px';
return this;
}
wide() {
this.div.classList.add(WIDE_CLASSNAME);
return this;
}
addToolbar(toolbar) {
this.div.appendChild(toolbar.div);
this.toolbars.push(toolbar);
return this;
}
frame() {
for (let toolbar of this.toolbars) {
toolbar.frame();
}
}
}