Skip to content

AI media harness for planning, generating, and editing locally

TypeScript

Group image view controls in center

Bitti8e95408d41ed
diff --git a/src/components/workspace/ImageEditor.tsx b/src/components/workspace/ImageEditor.tsx
index e716103..a3b4658 100644
--- a/src/components/workspace/ImageEditor.tsx
+++ b/src/components/workspace/ImageEditor.tsx
@@ -491,8 +491,8 @@ export function ImageEditor({ config, folderPath, onChange: changeConfig, onGene
return <div ref={editorRoot} className="image-editor" style={{ ...treePane.style, ...inspectorPane.style }}>
<div className="image-canvas-tools" role="toolbar" aria-label="Image tools">
- {/* Three columns: Generate and the generator lead, the canvas tools
- sit in the middle, the view controls at the trailing edge. */}
+ {/* Generate and the generator lead; canvas tools and view controls
+ share the centered group. */}
<div className="image-tools__start">
<button className="primary-button image-generate-button" data-tooltip={editPlan?.error ?? undefined} disabled={active ? work.cancelling || work.status === "encoding" : !isTauri() || !template || !templateUsable(template) || (imageRoot ? Boolean(editPlan?.error) : !imageScenePrompt(scene))} onClick={() => attempt(() => active ? onCancel(work.id) : onGenerate(template!))}>{active ? <Stop14 aria-hidden="true" /> : <Sparkle16 aria-hidden="true" />}{active ? work.cancelling ? "Cancelling…" : "Cancel" : "Generate"}</button>
<ComboBox
@@ -506,30 +506,30 @@ export function ImageEditor({ config, folderPath, onChange: changeConfig, onGene
onChange={(id) => { setTemplateId(id); localStorage.setItem("slopus.image-generator-template.v1", id); const next = imageTemplates.find((candidate) => candidate.id === id); if (next) commit({ ...scene, steps: next.defaultSteps }); }}
/>
</div>
- <div className="image-tools__group" role="radiogroup" aria-label="Canvas tool" onKeyDown={(event) => {
- if (event.key !== "ArrowLeft" && event.key !== "ArrowRight") return;
- event.preventDefault();
- const at = TOOLS.findIndex((tool) => tool.id === drawKind);
- const next = TOOLS[(at + (event.key === "ArrowRight" ? 1 : -1) + TOOLS.length) % TOOLS.length];
- chooseTool(next.id);
- requestAnimationFrame(() => event.currentTarget.querySelector<HTMLButtonElement>('[aria-checked="true"]')?.focus());
- }}>
- {TOOLS.map((tool) => <button
- key={tool.label}
- type="button"
- role="radio"
- aria-checked={drawKind === tool.id}
- aria-label={tool.label}
- aria-keyshortcuts={tool.key}
- tabIndex={drawKind === tool.id ? 0 : -1}
- className={`image-tool${drawKind === tool.id ? " image-tool--on" : ""}`}
- {...tooltipProps(tool.label, tool.key)}
- onClick={() => chooseTool(tool.id)}
- ><span aria-hidden="true">{drawKind === tool.id ? tool.onIcon : tool.icon}</span></button>)}
- </div>
- <div className="image-tools__end">
- <button className={`image-tool${boxes ? " image-tool--on" : ""}`} aria-label="Show placement boxes" aria-pressed={boxes} data-tooltip="Show placement boxes" onClick={() => { setBoxes(!boxes); setDrawKind(null); }}>{boxes ? <Boxes16Filled aria-hidden="true" /> : <Boxes16 aria-hidden="true" />}</button>
+ <div className="image-tools__center">
+ <div className="image-tools__group" role="radiogroup" aria-label="Canvas tool" onKeyDown={(event) => {
+ if (event.key !== "ArrowLeft" && event.key !== "ArrowRight") return;
+ event.preventDefault();
+ const at = TOOLS.findIndex((tool) => tool.id === drawKind);
+ const next = TOOLS[(at + (event.key === "ArrowRight" ? 1 : -1) + TOOLS.length) % TOOLS.length];
+ chooseTool(next.id);
+ requestAnimationFrame(() => event.currentTarget.querySelector<HTMLButtonElement>('[aria-checked="true"]')?.focus());
+ }}>
+ {TOOLS.map((tool) => <button
+ key={tool.label}
+ type="button"
+ role="radio"
+ aria-checked={drawKind === tool.id}
+ aria-label={tool.label}
+ aria-keyshortcuts={tool.key}
+ tabIndex={drawKind === tool.id ? 0 : -1}
+ className={`image-tool${drawKind === tool.id ? " image-tool--on" : ""}`}
+ {...tooltipProps(tool.label, tool.key)}
+ onClick={() => chooseTool(tool.id)}
+ ><span aria-hidden="true">{drawKind === tool.id ? tool.onIcon : tool.icon}</span></button>)}
+ </div>
<span className="image-tools__separator" role="separator" aria-orientation="vertical" />
+ <button className={`image-tool${boxes ? " image-tool--on" : ""}`} aria-label="Show placement boxes" aria-pressed={boxes} data-tooltip="Show placement boxes" onClick={() => { setBoxes(!boxes); setDrawKind(null); }}>{boxes ? <Boxes16Filled aria-hidden="true" /> : <Boxes16 aria-hidden="true" />}</button>
<ComboBox
editable
className="image-zoom"
diff --git a/src/styles/image-editor.css b/src/styles/image-editor.css
index af95d3b..699e076 100644
--- a/src/styles/image-editor.css
+++ b/src/styles/image-editor.css
@@ -41,8 +41,7 @@
.image-center { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--layer); }
.image-canvas-tools { grid-column: 1 / -1; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: var(--space-2); min-height: var(--space-7); padding: var(--space-1) var(--space-2); border-bottom: 1px solid var(--line); }
.image-generate-button { flex-shrink: 0; white-space: nowrap; }
-.image-tools__start, .image-tools__end { min-width: 0; display: flex; align-items: center; gap: var(--space-1); }
-.image-tools__end { justify-content: flex-end; }
+.image-tools__start, .image-tools__center { min-width: 0; display: flex; align-items: center; gap: var(--space-1); }
.image-generator { width: 160px; min-width: 0; flex-shrink: 1; }
/* Editable: typed percentages up to "800%" plus the 32px drop-down button. */
.image-zoom { width: 112px; min-width: 112px; }