gravity/toolbar.js
2025-12-27 17:10:34 -06:00

32 lines
620 B
JavaScript

export class Toolbar {
sim = undefined;
tools = [];
constructor(sim) {
this.sim = sim;
// Create ourselves a div, as child of sim's div
const div = document.createElement('div');
this.div = div;
this.sim.div.appendChild(div);
div.style.position = 'relative';
div.style.width = '20EM';
div.style.top = 0;
div.style.left = 0;
div.style.zIndex = 2;
}
// tool: instance of Tool
addTool(tool) {
this.div.appendChild(tool.div);
this.tools.push(tool);
}
frame() {
for (let tool in this.tools) {
// TODO: tool.frame()
tool.frame();
}
}
}