AI media harness for planning, generating, and editing locally
TypeScript
Image editor: canvas tools centred in the toolbar
Bitti4f1635228b1f
diff --git a/src/components/workspace/ImageEditor.tsx b/src/components/workspace/ImageEditor.tsxindex c1d6f23..95f83b5 100644--- a/src/components/workspace/ImageEditor.tsx+++ b/src/components/workspace/ImageEditor.tsx@@ -470,20 +470,21 @@ export function ImageEditor({ config, folderPath, onChange: changeConfig, onGene]} />}<section className="image-center" aria-label="Image panel"><div className="image-canvas-tools" role="toolbar" aria-label="Image tools">- <button className="primary-button image-generate-button" data-tooltip={editPlan?.error ?? undefined} disabled={active ? work.cancelling || work.status === "encoding" : !isTauri() || !template || templateNeedsDownload(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- className="image-generator"- aria-label="Generator"- data-tooltip="Generator"- value={template?.id ?? ""}- disabled={Boolean(active) || !imageTemplates.length}- placeholder="No MiniMax H3 templates"- options={imageTemplates.map((item) => ({ value: item.id, label: item.name, disabled: templateNeedsDownload(item), description: templateNeedsDownload(item) ? "Download in Settings" : undefined }))}- 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 }); }}- />- {/* The canvas tools sit at the trailing edge; Generate and the generator lead. */}- <span className="image-tools__spacer" aria-hidden="true" />- <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>+ {/* Three columns: Generate and the generator lead, the canvas tools+ sit in the middle, the view controls at the trailing edge. */}+ <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 || templateNeedsDownload(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+ className="image-generator"+ aria-label="Generator"+ data-tooltip="Generator"+ value={template?.id ?? ""}+ disabled={Boolean(active) || !imageTemplates.length}+ placeholder="No MiniMax H3 templates"+ options={imageTemplates.map((item) => ({ value: item.id, label: item.name, disabled: templateNeedsDownload(item), description: templateNeedsDownload(item) ? "Download in Settings" : undefined }))}+ 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();@@ -505,18 +506,21 @@ export function ImageEditor({ config, folderPath, onChange: changeConfig, onGeneonClick={() => 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" />- <ComboBox- editable- className="image-zoom"- aria-label="Image zoom"- data-tooltip="Zoom (Ctrl+0 fit, Ctrl+1 100%, Ctrl+= in, Ctrl+- out)"- value={zoomValue}- displayText={zoomText}- parseText={parseZoom}- options={zoomOptions}- onChange={(value) => { if (value === "fit") fit(); else zoomTo(Number(value)); }}- />+ <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>+ <span className="image-tools__separator" role="separator" aria-orientation="vertical" />+ <ComboBox+ editable+ className="image-zoom"+ aria-label="Image zoom"+ data-tooltip="Zoom (Ctrl+0 fit, Ctrl+1 100%, Ctrl+= in, Ctrl+- out)"+ value={zoomValue}+ displayText={zoomText}+ parseText={parseZoom}+ options={zoomOptions}+ onChange={(value) => { if (value === "fit") fit(); else zoomTo(Number(value)); }}+ />+ </div></div><div ref={viewport} tabIndex={-1} className={`image-viewport${panning ? " panning" : ""}`} data-tooltip="Scroll to zoom · drag with the middle button to pan"onPointerDownCapture={(event) => {diff --git a/src/styles/image-editor.css b/src/styles/image-editor.cssindex 44eb10d..8420aad 100644--- a/src/styles/image-editor.css+++ b/src/styles/image-editor.css@@ -39,12 +39,13 @@/* --- Canvas and its tool strip ------------------------------------------------ */.image-center { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--layer); }-.image-canvas-tools { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-1); min-height: var(--space-7); padding: var(--space-1) var(--space-2); border-bottom: 1px solid var(--line); }+.image-canvas-tools { 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-generator { width: 160px; max-width: 32%; }+.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-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; }-.image-tools__spacer { flex: 1 1 auto; }.image-tools__separator { width: 1px; height: 20px; margin: 0 var(--space-1); background: var(--line); }.image-tools__group { display: inline-flex; gap: 2px; }/* 32px icon toggles; the checked tool is an accent-soft fill. */