Skip to content

Dev - #67

Merged
TheJoeFin merged 36 commits into
mainfrom
dev
Nov 17, 2026
Merged

Dev#67
TheJoeFin merged 36 commits into
mainfrom
dev

Conversation

@TheJoeFin

@TheJoeFin TheJoeFin commented Nov 17, 2026 •

Copy link
Copy Markdown
Owner

Summary

Promotes the current dev branch to main for Magick Crop & Measure 1.14.0. This release adds substantially more precise canvas manipulation, a parametric construction system, a redesigned aspect-ratio workflow, and several persistence, export, usability, and reliability improvements.

What changed

Precise canvas and transform controls

  • Added a pixel-accurate loupe for perspective handles with adaptive magnification, nearest-neighbor rendering, and a crosshair that leaves the target pixel visible.
  • Kept transform, crop, and local-adjustment handles at a consistent on-screen size across zoom levels.
  • Added keyboard nudging for the active transform handle: 1 px, Shift for 10 px, and Ctrl for 0.25 px.
  • Added operation-specific progress labels for perspective correction, un-warp, grid/edge correction, crop, resize, erase, detection, capture, paste, and project load/save.
  • Added a grabbing cursor while panning and remembered the Allow outside and Show mini map canvas toggles between sessions.
  • Clamped existing handles back into the image when Allow outside is disabled.

Parametric construction tools

  • Added a persistent construction graph based on points, lines, circles, intersections, and circle centers rather than storing only fixed corners.
  • Added selection-first point dragging to prevent accidental movement while selecting points.
  • Added construction line and circle creation, derived-point tracking, face selection and merging, and conversion of construction geometry into transform/measurement workflows.
  • Added a Boundary / Find Edge Point tool with a live probe preview and image-based sub-pixel edge detection, including visual feedback for weak detections.
  • Added whole-graph undo/redo support so dependent geometry stays synchronized; edits and drags are recorded as coherent steps.
  • Cancelled in-progress construction gestures safely when pointer capture is lost and moved boundary probing off the UI thread.
  • Persisted construction entities and dependent relationships in project files while defaulting new fields for compatibility with older projects.
  • Rejected invalid hole-shaped face polygons before merging them into measurements.

Measurements, colors, and exports

  • Added per-item color selection for measurement, markup, and construction controls through a shared swatch picker.
  • Added per-shape measurement-label visibility and a global construction readout toggle, with both settings persisted in project files.
  • Kept overlays aligned correctly when images are resized and during image export.
  • Excluded construction gizmos from exported images while preserving the intended visible overlay content.

Aspect-ratio workflow and navigation

  • Replaced the aspect-ratio selector with a dedicated picker for standard and saved ratios.
  • Added custom named ratios with optional real-world dimensions and units, saved-ratio deletion, and controls for choosing a default ratio or prompting each time.
  • Improved linked width/height editing and aspect-ratio behavior in save options.
  • Added app-wide smooth scrolling and kept sidebar actions visible while scrolling.

Project reliability and tooling

  • Added a new MSTest project covering construction face solving, geometry math, measurement formatting, aspect ratios, smooth scrolling, and undo/redo behavior.
  • Updated image, computer-vision, Windows App SDK, and packaging dependencies.
  • Updated PR and release workflows, serialized competing CI runs, isolated release concurrency, and enabled tests in PR CI.
  • Bumped the application and package versions to 1.14.0.

Backward compatibility

  • Existing project files remain loadable: construction geometry, per-shape labels, colors, and other new serialized fields use defaults when absent.
  • Legacy projects without the new settings continue to use their previous behavior.

Included work

TheJoeFin and others added 30 commits August 1, 2026 23:17
Issue #35 asks for accurate placement of the perspective bounding box.
Two things got in the way:

The loupe magnified the cursor rather than the handle. Since a handle can
be grabbed anywhere within its bounds, an off-centre grab pointed the
crosshair a few pixels away from where the corner would actually land,
and it kept moving after the handle had been clamped to the image edge.
It now tracks the constrained handle centre while still parking itself
next to the cursor.

The handle itself is an opaque dot sitting on the exact pixel being
aimed at. While dragging, it now becomes a hollow ring with a crosshair
that leaves the centre clear; idle handles keep the filled look. Both
stay a constant size on screen at any zoom.

Also make the loupe magnification adaptive instead of a fixed 6x, which
could be *less* magnified than the canvas on a small image at high zoom,
and render it with NearestNeighbor so magnified pixels stay crisp.

Arrow keys now nudge the last-grabbed handle (1px, Shift 10px,
Ctrl 0.25px) for placement finer than the mouse can manage.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The perspective transform handles already counter-scale against the
canvas zoom, but the crop and local-adjustment rectangles live on the
same canvas and still grew and shrank with it — the complaint issue #35
raises about the transform box applies equally here.

Re-centre each grab handle on the edge or corner it controls (the
margins were off by a pixel), which is what makes counter-scaling about
the handle centre leave it pinned in place at any zoom, then scale the
handles and the outline inversely from UpdateTransformVisualScale.

Resize math is unaffected: ResizableRectangle computes its drag deltas
in canvas coordinates, so only the hit-test area changes.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The canvas bar's busy indicator was a spinner and a hard-coded "Working",
which says nothing about what is being waited on. Issue #35 asks for
feedback on the stage of processing.

Add BusyMessage to the view model and give SetUiForLongTask an optional
message, defaulting to the old label so call sites with nothing more
specific to say need no argument. Pass real labels at the slow
operations: perspective correction, un-warp, tri-fold, grid straighten,
edge correction, crop, resize, object erase, edge detection, capture,
paste, and project open/save.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Middle-drag panning used the four-arrow SizeAll cursor; issue #35 asks
for the "grabbing" state instead.

WPF ships no grab cursor and the project carries no binary assets, so
draw a closed-hand glyph at runtime and pack it as an in-memory .cur.
Construction is wrapped so any failure falls back to SizeAll — a cursor
is not worth breaking panning over.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
"Allow outside" and "Show mini map" reset on every launch. Add a small
JSON-backed settings store next to the recent-project data in
%LocalAppData%\MagickCrop, following the same pattern as
RecentProjectsManager, and seed both toggles from it at startup.

Turning "Allow outside" off also now pulls handles that are already past
the image edge back inside, rather than only affecting the next drag.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Detected quadrilaterals are named "Quad: N" and described by their contour
confidence. A quadrilateral that did not come from contour detection has no
meaningful confidence, so add an optional Label that overrides both.

Also guard the preview scaling against a zero-width or zero-height quad, which
divided by zero and produced NaN preview points.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Geometry for a construction the user builds out of points rather than corners:
points along an object's edges, lines through those points, and circles through
triples of them. Corners are never stored — ConstructionSolver derives them by
intersecting the lines, which is what lets a corner sit outside the image.

Points are either free, or derived from the geometry that produced them: the
crossing of two lines, or the centre of a circle. A derived point re-fits from
its parents on every refresh, and is released into an ordinary point if they are
deleted, so keeping one never leaves a dangling reference.

Entities reference each other by id rather than index so removing one cannot
silently repoint another. The DTOs mirror this for project persistence, and the
new fields default such that projects saved before constructions existed still
load.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Puts the construction model on screen. One control owns the whole graph rather
than one per entity, because a derived corner is a function of all the lines and
the solve needs a single owner.

Interaction is selection-first: a point must be selected before it can be
dragged, so aiming at one to pick it no longer nudges it out of place. Two
selected points offer a faint line, three offer the circle through them, and
clicking the offer builds it. Line crossings and circle centres appear as faint
rings that follow their parents and vanish with them unless clicked to keep.
Selecting a line or circle and pressing Delete removes it without its points.

Every committed edit becomes one undo step, published by the overlay as
before/after snapshots of the whole graph — the graph is small and every corner
depends on all of it, so a snapshot is both cheaper to reason about and
impossible to desync. A drag is one step rather than one per mouse move, and the
gesture brackets are idempotent because this codebase ends drags on the next
mouse move, which may never arrive.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Added `BoundaryProbeAnalyzer` for sub-pixel, color-based edge detection along user probe lines using a 1D derivative-of-Gaussian algorithm. Introduced `ImageSampleBuffer` for fast, bilinear RGB sampling from images with robust file handling. Both classes are optimized for interactive measurement tools and have no WPF dependencies.
Introduced a "Boundary" construction tool for probing image edges by dragging a line; analyzes pixels to find boundaries and previews the landing point. Added a live preview marker in ConstructionOverlayControl, with visual cues for weak detections. MainWindow now manages the probe gesture lifecycle, including async image sampling via ImageSampleBuffer for efficient analysis. Updated UI state, undo/redo, and hint system to support the new tool. Extended enums and tool state sync for the Boundary tool and drag mode.
Centralize MagickImage temp file writing with extension/encoder logic, updating all usages to ensure correct format. Add ConstructionBoundaryToggle and ProgressRing controls for "Find Edge Point" tool in both tabs, with tooltips/icons. Sync tool toggle state across tabs, handling Unchecked events. Improve pixel zoom and coordinate conversion for edge probing. Refactor for clarity and update comments/tooltips.
The construction tool usage TextBlock and the "Construction (Parametric)" GroupBox are now hidden by default. The "Use for Transform" button style was changed from Primary to Secondary for visual consistency.
Each line and circle now has a ShowMeasurement property, persisted in DTOs and project files, allowing users to toggle measurement labels via context menu. Added global ShowShapeMeasurement toggle for derived shape readout, with UI and persistence. Updated rendering and event handlers to respect these toggles. Serialization logic ensures backward compatibility with older projects.
Introduced a "Face" selection tool allowing users to select and merge bounded regions formed by construction lines. Added `ConstructionFaceSolver` to compute and merge faces, and a `ConstructionFace` record to represent each cell. Updated `ConstructionOverlayControl` to manage face states, hit-testing, and visual feedback. Enhanced `MainWindow` with UI for selecting shapes and merging faces into polygons, including button state logic. Updated XAML to support the new tool and help text.
Added MagickCrop.Tests (.NET 10.0, MSTest, Moq, WPF) to solution with UndoRedo, GeometryMathHelper, and MeasurementFormattingHelper tests. Enabled parallel test execution. Updated solution and settings for test integration.
Added "Change Color" context menu to all measurement, markup, and construction controls, enabling per-instance color selection via a new ColorPickerDialog and ColorSwatchPicker control. Colors are now serialized in project DTOs and restored on load, with backward compatibility for older files. Refactored guide lines to use the new picker. Centralized swatch colors in ColorPalette helper. Visuals update immediately on color change.
Keep excluded UI layers Hidden during render and export each overlay individually relative to MainImage to prevent canvas-bound and margin-induced shifts.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Parametric Construction Points
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Redesign aspect ratio selection and smooth scrolling
@TheJoeFin TheJoeFin added the enhancement New feature or request label Nov 17, 2026
TheJoeFin and others added 5 commits November 16, 2026 19:43
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@TheJoeFin
TheJoeFin merged commit d16e4a9 into main Nov 17, 2026
1 of 2 checks passed
@TheJoeFin
TheJoeFin deleted the dev branch November 17, 2026 02:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant