diff --git a/apps/studio/src/PresetFlow.tsx b/apps/studio/src/PresetFlow.tsx index 4ccc17cb..8b98f8bd 100644 --- a/apps/studio/src/PresetFlow.tsx +++ b/apps/studio/src/PresetFlow.tsx @@ -44,6 +44,9 @@ export function PresetFlow({ projectId, files, container, start, title = "New op const [focal, setFocal] = useState(start?.primes?.[0] ?? start?.zoom?.[0] ?? 35); const [view, setView] = useState<"on" | "sees">("on"); const [own, setOwn] = useState(null); + // "Own width and height" is a choice of its own (#562): read off the numbers, it snapped back to the format they + // still matched. Chosen, it stays, even when the numbers typed match a format of the list. + const [ownFormat, setOwnFormat] = useState(() => !FORMATS.some((f) => f.w === (start?.format ?? EMPTY.format)[0] && f.h === (start?.format ?? EMPTY.format)[1])); const [busy, setBusy] = useState(false); const set = (c: Partial) => setD({ ...d, ...c }); const example = examples.find((x) => x.id === scene) ?? examples[0]; @@ -74,9 +77,9 @@ export function PresetFlow({ projectId, files, container, start, title = "New op
set({ name: e.currentTarget.value })} /> - { const f = FORMATS.find((x) => x.name === n); setOwnFormat(!f); if (f) set({ format: [f.w, f.h], formatName: f.name }); else set({ formatName: null }); }} options={[...FORMATS.map((f) => ({ value: f.name, label: `${f.name} · ${f.w} × ${f.h} mm` })), { value: "own", label: "Own width and height…" }]} /> - {!known && set({ format: [x, d.format[1]], formatName: null })} />× set({ format: [d.format[0], x], formatName: null })} />} + {(ownFormat || !known) && set({ format: [x, d.format[1]], formatName: null })} />× set({ format: [d.format[0], x], formatName: null })} />}
set({ multiplier: x })} /> diff --git a/apps/studio/src/canvas/CanvasEditor.tsx b/apps/studio/src/canvas/CanvasEditor.tsx index e6e40d89..410c8b61 100644 --- a/apps/studio/src/canvas/CanvasEditor.tsx +++ b/apps/studio/src/canvas/CanvasEditor.tsx @@ -140,6 +140,8 @@ export function CanvasEditor(props: CanvasEditorProps) { const [placing, setPlacing] = useState(photos[0]?.id ?? null); const [editing, setEditing] = useState(null); const [selF, setSelF] = useState(null); + // The free-form frame whose format is "Own width and height" by choice (#562), even while its numbers match one of the list. + const [ownFormat, setOwnFormat] = useState(null); const [mode, setMode] = useState("outline"); const [panels, setPanels] = useDockLayout(props.hosted ? "canvas-hosted.v2" : "canvas.v2", { left: { tabs: ["tools"] }, right: { dir: "col", kids: [{ tabs: ["properties"] }, { tabs: ["layers", "frames", "comments"] }], sizes: [1, 1] } }); const setTab = (id: string) => setPanels(dockShow(panels, id, false)); @@ -619,7 +621,8 @@ export function CanvasEditor(props: CanvasEditorProps) { ) :

The preset of this frame is gone, so it cannot be drawn. Remove it, or restore the preset from the recycle bin.

)} {cur.kind === "free" && ( <> - f.w === cur.format?.[0] && f.h === cur.format?.[1]) ? "own" : FORMATS.find((f) => f.w === cur.format?.[0] && f.h === cur.format?.[1])!.name} onChange={(v) => { const f = FORMATS.find((x) => x.name === v); setOwnFormat(f ? null : cur.id); if (f) patchF(cur.id, { format: [f.w, f.h] }); }} options={[...FORMATS.map((f) => ({ value: f.name, label: f.name })), { value: "own", label: "Own width and height…" }]} /> + {(ownFormat === cur.id || !FORMATS.some((f) => f.w === cur.format?.[0] && f.h === cur.format?.[1])) && patchF(cur.id, { format: [w, cur.format?.[1] ?? 24] })} /> patchF(cur.id, { format: [cur.format?.[0] ?? 36, h] })} />} { const n = Math.round(mm); patchF(cur.id, { focal: n, name: cur.name === `${cur.focal} mm` ? `${n} mm` : cur.name }); }} /> {PRIMES.map((mm) => )} patchF(cur.id, { multiplier: m })} /> diff --git a/docs/features/canvas.md b/docs/features/canvas.md index 523fb452..de427481 100644 --- a/docs/features/canvas.md +++ b/docs/features/canvas.md @@ -37,13 +37,13 @@ Whoever edits a canvas uploads its render (the whole surface flattened) and a th A standard app (`#/presets`). The list shows each preset's format and lenses and how many of its focal lengths frames use; archived ones on request. A preset's page: the name (editable), what it is (fixed, with a lock), its lenses with angle of view and full-frame equivalent per focal length (primes: remove one that no frame uses, add any whole mm; a zoom: widen it, narrow it only down to the focal lengths frames use), Duplicate (opens the create flow with its values, for a changed camera), Archive or take out of the archive, Delete (only when no frame uses it). Which focal lengths are in use is read from the project's canvases in the Studio; the Worker checks the same with its frames table. -**The create flow**: name; format from the generic list or an own width and height; multiplier; squeeze (spherical or anamorphic factors); delivery aspect; lenses as primes (ticked from the built-in list, own focal lengths added) or one zoom. Beside it the preview: an example with the frame at one focal length, drawn with the optics math, "On the photo" (dimmed outside, hatched where the preset sees more than the example) or "What it sees" (fitted to the frame), the angle of view and full-frame equivalent, and a strip with one small picture per focal length (four across a zoom, with a slider). **Examples**: a drawn test chart that stands for a photo at 14 mm on full frame (104° × 81°, with the full-frame focal lengths marked), and the project's own photos that have an angle of view. The example photos of the shot list ([optics-example-photos](../rewrite/optics-example-photos.md)) take the chart's place once they exist. +**The create flow**: name; format from the generic list or **Own width and height…** (a choice of its own, #562: it shows the width and height starting from the format chosen before, and stays chosen even when the numbers typed match a format of the list); multiplier; squeeze (spherical or anamorphic factors); delivery aspect; lenses as primes (ticked from the built-in list, own focal lengths added) or one zoom. Beside it the preview: an example with the frame at one focal length, drawn with the optics math, "On the photo" (dimmed outside, hatched where the preset sees more than the example) or "What it sees" (fitted to the frame), the angle of view and full-frame equivalent, and a strip with one small picture per focal length (four across a zoom, with a slider). **Examples**: a drawn test chart that stands for a photo at 14 mm on full frame (104° × 81°, with the full-frame focal lengths marked), and the project's own photos that have an angle of view. The example photos of the shot list ([optics-example-photos](../rewrite/optics-example-photos.md)) take the chart's place once they exist. ## In the Studio: the Canvas app (`apps/studio/src/apps/CanvasApp.tsx`, `canvas/`) One window per canvas (`#/canvas/`), opened from Files (double-click), made with **New, Canvas** in Files (blank, 16:9) or **Make a canvas** on a photo (the Files menu, the Photo app; the canvas sits where the photo is, or next to its collection). -- **The editor** (`canvas/CanvasEditor.tsx`, U2's tool on the real model): tools Move (V), Pen (P; pen, marker, highlighter, brush, dashed), Eraser (E; Cuts strokes: the parts of pen strokes under it go and the stroke splits, anything else it touches goes whole; or Whole objects; its size in screen pixels; locked, hidden and grouped objects are left alone; `canvas/erase.ts`), Line (L), Arrow (A), Rectangle (R), Ellipse (O), Text (T, edited in place), Stencil (S), Place a photo (I, a photo of the project), Comment (C). Objects in one stack: select, Shift-select, a box drawn from empty paper with Move (it chooses the shown, unlocked objects it touches, a group as a whole; Shift adds to the selection), move, resize from a corner, rotate just outside a corner (Shift: 15°), end points of lines, Alt-drag copies, Ctrl+D duplicates, Delete, Group (Ctrl+G) and Ungroup (Ctrl+Shift+G), the layer list reordered by dragging, hide and lock. **Properties** (#552, a panel of its own above Layers, Frames and Comments; selecting on the canvas or making an object brings it to the front, a click in the layer list leaves the list in view): the selection's stroke, fill, width, opacity, rotation, pen, stencil, photo and its look; with nothing selected, the surface. It is laid out as drawing programs do theirs: short labels at the left, several controls on a line, the name without a label, and a number beside every slider to type an exact value (`PropertyLine`, `NumberSlider` in the design system). While objects are selected, the toolbar's colour and width change them too (and are what the next object gets). Every colour chooser offers the canvas's **kept colours** after the eight (#551): a colour of one's own is kept when its chooser closes; right-click (a long press on a touch screen) removes one. The highlighter is plainly see-through (no blend), so it marks white paper and dark photos alike (#551). The surface: a base photo (with its look, and a photo to choose) or paper (**size** in pixels, width and height each on its own, or by dragging the paper's right or bottom edge or its corner; a **ratio** preset keeps the height (#551). The top-left corner stays and objects and comments keep their size and place in pixels, so nothing stretches and what no longer fits sticks out; the view keeps its scale while the paper changes, so it is not fitted into the window again. Colour, or transparent: a checkerboard in the editor, a PNG with transparency as its render; a shot's overlay starts that way); a blank canvas gets a photo underneath from the surface's row. **Grid** on paper (#554): a switch, the cell size in pixels and the lines' colour; it shows in the editor (viewers too, it is stored) and moving objects snap to its lines while snapping is on, but it is never in the render or the thumbnail. Frames (only with a base photo): from a preset with its focal lengths (buttons for primes, a slider for a zoom), free-form (format, focal length with the prime stops, multiplier, squeeze, delivery; "Create a preset from it"), or an aspect ratio; orientation, colour, name, the picture, Link centres, what it sees. A photo without an angle of view takes aspect frames only. View modes Outline, Mask, Crop, Full (the window's choice, never stored), Compare (two frames side by side), zoom and pan (Ctrl + wheel, wheel, Space-drag, 0 fits), snapping with a switch (Ctrl suspends it), comments (point or region, replies, resolve, move, redraw the region, list with resolved too). +- **The editor** (`canvas/CanvasEditor.tsx`, U2's tool on the real model): tools Move (V), Pen (P; pen, marker, highlighter, brush, dashed), Eraser (E; Cuts strokes: the parts of pen strokes under it go and the stroke splits, anything else it touches goes whole; or Whole objects; its size in screen pixels; locked, hidden and grouped objects are left alone; `canvas/erase.ts`), Line (L), Arrow (A), Rectangle (R), Ellipse (O), Text (T, edited in place), Stencil (S), Place a photo (I, a photo of the project), Comment (C). Objects in one stack: select, Shift-select, a box drawn from empty paper with Move (it chooses the shown, unlocked objects it touches, a group as a whole; Shift adds to the selection), move, resize from a corner, rotate just outside a corner (Shift: 15°), end points of lines, Alt-drag copies, Ctrl+D duplicates, Delete, Group (Ctrl+G) and Ungroup (Ctrl+Shift+G), the layer list reordered by dragging, hide and lock. **Properties** (#552, a panel of its own above Layers, Frames and Comments; selecting on the canvas or making an object brings it to the front, a click in the layer list leaves the list in view): the selection's stroke, fill, width, opacity, rotation, pen, stencil, photo and its look; with nothing selected, the surface. It is laid out as drawing programs do theirs: short labels at the left, several controls on a line, the name without a label, and a number beside every slider to type an exact value (`PropertyLine`, `NumberSlider` in the design system). While objects are selected, the toolbar's colour and width change them too (and are what the next object gets). Every colour chooser offers the canvas's **kept colours** after the eight (#551): a colour of one's own is kept when its chooser closes; right-click (a long press on a touch screen) removes one. The highlighter is plainly see-through (no blend), so it marks white paper and dark photos alike (#551). The surface: a base photo (with its look, and a photo to choose) or paper (**size** in pixels, width and height each on its own, or by dragging the paper's right or bottom edge or its corner; a **ratio** preset keeps the height (#551). The top-left corner stays and objects and comments keep their size and place in pixels, so nothing stretches and what no longer fits sticks out; the view keeps its scale while the paper changes, so it is not fitted into the window again. Colour, or transparent: a checkerboard in the editor, a PNG with transparency as its render; a shot's overlay starts that way); a blank canvas gets a photo underneath from the surface's row. **Grid** on paper (#554): a switch, the cell size in pixels and the lines' colour; it shows in the editor (viewers too, it is stored) and moving objects snap to its lines while snapping is on, but it is never in the render or the thumbnail. Frames (only with a base photo): from a preset with its focal lengths (buttons for primes, a slider for a zoom), free-form (format from the list or Own width and height…, as in the create flow, #562; focal length with the prime stops, multiplier, squeeze, delivery; "Create a preset from it"), or an aspect ratio; orientation, colour, name, the picture, Link centres, what it sees. A photo without an angle of view takes aspect frames only. View modes Outline, Mask, Crop, Full (the window's choice, never stored), Compare (two frames side by side), zoom and pan (Ctrl + wheel, wheel, Space-drag, 0 fits), snapping with a switch (Ctrl suspends it), comments (point or region, replies, resolve, move, redraw the region, list with resolved too). - **Saving**: automatic, 0.7 s after the last change, with the body and its references (base and placed); then the render (2048 px on the long side) and the thumbnail (400 px) are drawn in the browser (`canvas/render.ts`, the editor's geometry on a 2D canvas) and uploaded. The status bar says Changed, Saving…, Saved or Not saved. Pen strokes keep a point every few pixels and coordinates are rounded to four decimals, so a body stays small. - **Undo and redo** (Ctrl+Z, Ctrl+Shift+Z or Ctrl+Y): the window's own history of bodies, a drag being one step, up to 100. - **The lock, editing and watching**: the window takes the lock when it opens (its own token, so a second window of the same person is someone else), renews it every 20 s and lets it go when it closes. **Stop editing** (in the toolbar) saves, lets the lock go and keeps the window open as a viewer. A viewer shows the canvas read-only: zoom, pan, view modes and Compare work; the tools, the Layers and Frames panels, undo, redo and Snap cannot be used and look disabled (muted text, dashed controls); comments can be read, opened on the canvas and listed, but not written, answered or resolved with who edits it, **Edit** (when nobody does: takes the lock and starts from the canvas as the server has it now). A viewer never takes the lock on its own: watching the Studio while drawing on the tablet stays that way. **Take over** (#556) replaces Edit when the lock is held by another window of the same person ("Editing in another window of yours", perhaps one left open, minimised or in another workspace): this window takes the lock (`take_over`), the other hears it through the room at once and becomes a viewer; what it had not saved yet is lost. Someone else's lock is never taken over.