many
This commit is contained in:
parent
0b9ff1363b
commit
0a6148c73f
67 changed files with 2653 additions and 1519 deletions
|
|
@ -6,6 +6,37 @@ const SIZE_ORDER = ["small", "medium", "large"];
|
|||
|
||||
const SIZE_LABELS = { small: "\u5c0f", medium: "\u4e2d", large: "\u5927" };
|
||||
|
||||
function renderToolPalette() {
|
||||
if (!ui?.toolPalette || typeof toolCategories !== "function") return;
|
||||
ui.toolPalette.innerHTML = "";
|
||||
const frag = document.createDocumentFragment();
|
||||
for (const category of toolCategories()) {
|
||||
const section = document.createElement("section");
|
||||
section.className = `tool-category ${category.themeClass || ""}`.trim();
|
||||
section.dataset.toolCategory = category.id;
|
||||
const toggle = document.createElement("button");
|
||||
toggle.className = "tool-category-toggle";
|
||||
toggle.type = "button";
|
||||
toggle.setAttribute("aria-expanded", "true");
|
||||
toggle.textContent = category.label || category.id;
|
||||
const body = document.createElement("div");
|
||||
body.className = "tool-grid tool-category-body";
|
||||
for (const toolId of category.toolIds || []) {
|
||||
const def = toolDefinition(toolId);
|
||||
if (!def || def.simulationOnly) continue;
|
||||
const btn = document.createElement("button");
|
||||
btn.className = "tool";
|
||||
btn.dataset.tool = toolId;
|
||||
btn.textContent = def.label || toolId;
|
||||
if (toolId === world?.tool) btn.classList.add("selected");
|
||||
body.appendChild(btn);
|
||||
}
|
||||
section.append(toggle, body);
|
||||
frag.appendChild(section);
|
||||
}
|
||||
ui.toolPalette.appendChild(frag);
|
||||
}
|
||||
|
||||
function toolSizeFor(tool) {
|
||||
if (!SCALABLE_TOOLS.has(tool)) return "";
|
||||
return (world.toolSizes && world.toolSizes[tool]) || world.toolSize || "medium";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue