mirror of
https://github.com/storytold/photocraft.git
synced 2026-10-25 11:54:39 +01:00
* Crop tool: Photoshop's default mode turns the image behind an upright box; Use Classic Mode (P), Auto Center Preview (#1919) The Crop tool's gear menu gets Use Classic Mode (P toggles it while the tool shows a box; off by default, as in Photoshop) and Auto Center Preview (on by default). In the default mode the box stays upright on screen: a drag outside it turns the image about the box's centre (Shift 15 deg steps, angle readout), a drag inside moves the image under the box, the arrow keys nudge the image, Straighten turns the image so the line is level, and with Auto Center Preview a drawn or resized box is re-centred in the canvas. Classic Mode is the previous behaviour. The crop model and the commit are shared: crop_rect + crop_angle and one image.crop {angle}. crop_mode.rs only drives the view: while a frame is edited the view's rotation is -crop_angle, pivoting so the box (or the pressed point) stays put, and the user's view (a Rotate View turn, its centre) is put back on commit, cancel, leaving the tool or switching to Classic Mode. The untouched default frame leaves an R turn alone. The options live in ToolOptions.crop_shield (classic_mode, auto_center_preview; ui.set cropShield). ui.pointer reads a default-mode drag's points in the view at its press, so an up where the last move was is idempotent. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * Crop default mode: match Photoshop (view upright on tool pick, live Auto Center, image-turn readout, gear menu order) (#1919) Checked by hand against Photoshop in its default (non-classic) mode: - Picking the Crop tool turns a Rotate View (R) turn upright at once (about the view centre), and the view stays upright after Enter or Esc: the save/restore of the user's view is gone. Classic Mode still leaves the view alone (not checked against Photoshop). - The angle beside the pointer while the image turns is the image's turn, clockwise positive. - Auto Center Preview keeps a box being resized centred live: the handle follows the pointer, the box grows on both sides, and on the image the opposite edge (with Alt the centre) stays put. Computed from the press, so the view following the frame can't feed back into the drag. - Gear menu order as Photoshop's: Use Classic Mode (P), Show Cropped Area (H), Auto Center Preview, no separator; Classic Mode greys out the other two. Show Cropped Area then acts as on and H does nothing (the stored choice is kept). German: Classic-Modus verwenden, Automatische zentrierte Vorschau. - Crop preview past the canvas in a turned view: each band is drawn as its turned quad (the screen bounding box stretched band textures and spread the checkerboard). The white corners in the earlier offscreen snapshot were egui_kittest clamping the repeating checker texture; the real app shows the checkerboard in both modes. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * docs: regenerate scorecard for the crop default-mode row (#1919) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * Crop default mode: the canvas keeps the view the Crop tool moves; a move starts from a centred box (#1919) Tried by hand in the app: with Auto Center Preview on, a drag inside the box made the box wander instead of moving the image, and a handle drag didn't keep the box's centre in place (after a Space pan, too). Root cause: canvas_view works on a copy of the view for the frame and writes it back at the end, so every camera change the Crop tool made during the frame (the image moving with the pointer, the live-centred resize, Auto Center on release, the pivot while turning) was undone, while the frame itself moved in the document. Tests driving tool_event never saw it. - canvas_view notes the camera before the frame's input and, before writing its copy back, keeps a centre or rotation a tool changed meanwhile. - With Auto Center Preview a move inside an off-centre box (after a pan) centres the box first, then grabs the image point now under the pointer. - New tests/crop_default_mode.rs drives the full app UI with egui pointer and key events over several frames (offscreen wgpu): the box stays put while the image follows the pointer, and a resize after a Space pan keeps the box's centre fixed while the handle follows the pointer. Both failed before the fix. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * Crop default mode: a moved or resized box stays where it is on screen (#1919) Checked in Photoshop: after a Space (Hand) pan the box isn't snapped back to the middle of the canvas. A drag inside moves only the image, the box staying wherever it is; a resize keeps the box's centre where it was at the press (also after a pan), and its release no longer pans the box to the middle. Auto Center Preview still centres a newly drawn box on release and X still re-centres. Classic Mode is unchanged. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * Crop tool: Classic Mode turns a Rotate View turn upright too (#1919) Checked in Photoshop: with Classic Mode on and the view turned with Rotate View (R), picking the Crop tool also turns the view upright, and the crop frame stays on the same image area. So the Crop tool now drives the camera in both modes: default mode keeps it at -crop_angle (the box upright), Classic Mode at 0 with the frame drawn with its own turn. Picking the tool pivots about the view centre; commit and cancel leave the view upright in both modes, and P switching modes never brings the R turn back. Auto Center Preview stays default-mode only. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * Regenerate the scorecard; update the crop test's header Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Crop: snap a new box's corner inside the untouched default frame in both modes (#2549 with #2545) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Co-authored-by: Brandon Thomas <echelon@gmail.com>