PR #11848 built the full-area selection mask for every Subtract and
Intersect click, though the global match (Contiguous off) ignores it.
Build it only when the fill is contiguous.
Tests for the review: Contiguous off keeps the global match, Subtract and
Intersect without a selection select nothing, the row check fails on a hole
in the selected run, and the fill's half-selected threshold (0.49 vs 0.5)
at the seed and at the fill's edge.
Co-Authored-By: DuBearte <130190089+DuBearte@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Destination branch of the Patch command no longer clones the whole document: it takes only the selection before the target surface borrows the document, and computes the selection's content bounds once, passing them to `is_hard_rect` and reusing them for the translate. Behaviour is unchanged.
Tests are split and extended: Destination with a feathered, ellipse, lasso and holed-rectangle selection leaves the selection in place while the patch still lands; Destination with no selection fails, adds no history entry and a following undo reverts the previous step, not the setup; redo restores both the patched pixels and the moved selection; Source and Content-Aware are separate tests, the latter asserting a pixel change; the main test also asserts source pixels unchanged, the destination carrying the source texture, the moved selection still hard-edged, and the returned damage and offset. A rectangle larger than the patched area and a partly covering selection without a hole cannot be built, because the patched area is the selection's own content bounds; an inverted selection makes the area the whole canvas, which Patch refuses.
Verified: `cargo test -p photocraft-engine --lib patch` 18 passed; `--lib retouch` 119 passed; clippy `--all-targets -D warnings` clean; `cargo fmt -p photocraft-engine` clean.
Not changed: the coverage pass in `is_hard_rect` (one pass over the patched area per command, the same order of work as the patch itself).
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Model-Effort: Opus 5.5 drove and briefed; Sonnet 5.5 wrote at medium
- Render each shape cache clipped to its own bounds instead of the full
page clip.
- Copy embedded font bytes before locking the shared text engine and take
the lock per font, not for the whole registration loop.
- Track seen font content keys in a HashSet instead of scanning the font
list for every glyph; hash glyph text for fake-bold pairing instead of
cloning strings.
- Update the module and `pdf-editable` feature docs to describe text and
accepted no-op clips.
- Poll the cancellation watcher every 20 ms; Device callbacks only cover
paints, so a single long path still needs the watcher.
With the ends of two open subpaths both within the Pen's reach, the press
took the first subpath listed, even when the pointer was nearer the other
one's end, so the wrong subpath was carried on. It now compares every open
end in reach and takes the nearest.
Co-Authored-By: kavishkashehan726-sudo <kavishkashehan726-sudo@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Type options bar always showed Left / Center / Right. As in the
reference application, for vertical text it now shows "Top align text",
"Center text" and "Bottom align text" with vertical glyphs: when the
edited or selected text layer is vertical, or with no text targeted
when the Vertical Type tool is active. The buttons still set left /
center / right and the lit one follows the targeted paragraph. The Type
Mask tools keep today's buttons (not measured).
The orientation is read from the target's own document, as the
paragraph style is, so a text edit left in a background document is
not judged by a same-id layer of the active one.
The three glyphs (vertical-align-{top,middle,bottom}.svg) are original
work drawn on Lucide's grid and stroke, with their ATTRIBUTION.md row;
they are kept out of the Lucide row's wildcard.
Cause: while a Patch or Content-Aware Move drag was under way, the cursor badge read the current modifiers, but the release and the paint read the modifiers from the press (`drag.modifiers`). Pressing Shift or Alt mid-drag after a plain press inside the selection flipped the arrow to Add or Subtract although the drag still moved the patch, and a drag pressed with Shift showed no badge once the key was let go.
Fix: `badge` takes the modifiers of the Patch or Content-Aware Move drag in progress, as the Lasso line below it already does. The tests now pin the arrow glyph's exact geometry (3 strokes, horizontal shaft, both barbs from the tip, mirrored ends), a drag started outside showing no arrow inside, Content-Aware Move staying badge-free, the press modifiers winning mid-drag, Shift+Alt giving Intersect on hover, and the Curvature Pen's real Move badge over an anchor.
Verified: `cargo test -p photocraft-ui-egui --lib patch_cursor` 10 passed (9 in patch_cursor_badge_tests plus the retouch_ui one), `retouch` 58 passed, clippy --all-targets -D warnings clean, fmt clean.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Model-Effort: Opus 5.5 drove and briefed; Sonnet 5.5 wrote at medium
Committing a Type Mask took the selection mode from the modifiers held
at that moment, so Shift added the text outline to the selection and
Alt subtracted it. As in the reference application, a commit now always
replaces the selection with the outline: a click outside the text, the
Commit button and Cmd+Return, with or without Shift or Alt.
type.createSelection keeps its "operation" parameter for scripts.
commit_with keeps its modifiers parameter so its callers don't change.
The #3036 canvas test keeps its check that the working text has no
Layers panel row; its Shift and Alt assertions now expect a replace.
Escape while typing with the Horizontal or Vertical Type Mask tool threw
the session away. As in the reference application it now commits: the
text outline becomes the selection in one history state and no layer is
added, whatever Preferences > Type "Use ESC to commit" says. The options
bar's Cancel still throws the session away.
Escape on an empty mask text, or while an input method is composing,
was not measured and still cancels. A Command transform drag keeps its
own Escape, and the Type tool's Escape still follows the preference.
The #1055 canvas test that pinned the old Escape now goes through
Cancel, which keeps what it guarded: the selection and layers unchanged.
trim_name drops white space, ZWNJ/ZWJ and the blank characters (Braille blank, Hangul fillers,
invisible operators, tag and other default-ignorable blanks) from both ends. A variation or
Mongolian free variation selector or CGJ that belongs to a kept character stays, and so do Hangul
filler jamo that complete a syllable. History names use the same trim as plug-in names.
A Type tool click on a text layer under Lock All, its own or an
enclosing group's, started an edit the engine then refused at the
first keystroke, with a status-bar error. As in the reference
application, the click now makes the layer active and opens the
alert "Could not use the type tool because the layer is locked."
with OK; no edit starts and no history state is added.
The check is the engine's own (effective_locks(..).all, as in
check_text_unlocked). A position lock alone and a click on empty
canvas keep today's behaviour.
The font family menu showed no tooltip, the font style menu none,
and the font size icon and colour swatch other wording. They now
show the reference application's texts: "Search and select fonts",
"Set font style", "Set font size" (icon and field) and "Set text
color", through the catalogue with the English fallback. The
controls keep their accessible names.
The family tooltip is added by the options bar only: the Character,
style and Glyphs panels share the picker and keep their texts.
canvas_tests' T-icon tooltip probe took the tooltip to be the
widget's own name; it now takes the expected tooltip text.
Credit: own entry in contributors/people.toml.
- Accept explicitly closed page-sized clip rectangles (m l l l l h).
- Pair fake-bold strokes through a text/font/order index instead of a
full scan, keeping the comparison cap and cancellation checks.
- Tests: solid zero-length stroke stays editable, explicit clip
rectangle.
A manifest name such as "\nTone" was checked trimmed but shown as given, so a line break reached
the menu; padding also got past the 64-character limit. The name is now stored trimmed.
The blank Braille pattern and the unassigned default-ignorable ranges no longer count as visible,
in plug-in names and History names. Applying a patch no longer takes the selection icon, and the
History source column has its doc comment back.
- Count actual fake-bold comparisons toward the cap instead of the
product of glyph and stroke counts.
- Fall back for any dashed zero-length subpath (open or closed); test
covers a stroked line followed by a closed point.
- Handle invisible glyphs before the soft-mask check so hidden text
does not rasterise the page.
- Bound fake-bold glyph/stroke pairing by comparison count and check
cancellation during the scan.
- Keep both knots when a closing curve returns to its start; fall back
for a dashed single-point subpath.
- Skip inkless runs (zero-width/format characters) instead of treating
an empty cache as a render failure.
- Track soft masks and reject the page only when paint happens while one
is active.
- Tests: fake-bold mismatch across a path, closing curve loop.
A press that arrives while the same refusal alert is still open (ui.pointer
can send one) no longer stacks a second alert, as the Background Eraser's
range alert already does.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Escape while drawing a ruler or moving one of its ends now ends the drag and
keeps the ruler where it was at the Escape: the later moves and the release
change nothing, the ruler is neither removed nor put back, and no history
step is added. The next press drags normally again. The protractor's arm
(not measured) keeps today's behaviour.
A historyName of zero-width, filler or BOM characters showed an empty History
row, and a bidi control or line separator could make a row read differently
from its name. A history name now has no control or line-break character
anywhere, loses white space and ZWNJ/ZWJ at its ends, and is then held to the
plug-in menu-label rule, now shared as
photocraft_plugins::manifest::printable_name (1-64 characters with a visible
one, no hidden format characters; plug-in names also refuse U+2028/U+2029).
constrain now keeps the pointer's legs instead of its distance: on a
diagonal step both legs take min(|dx|, |dy|) with their signs, and on a 0
or 90 degree step the dominant component stays and the other becomes 0.
This applies to drawing, to moving either endpoint around the other, and to
a protractor's second arm.
A Mixer Brush stroke in an Indexed Color or Bitmap document now fails before
anything is painted, with the reference's alert texts (convert to RGB Color /
Grayscale mode to edit); paint.mixerBrush returns that error and leaves the
document and History unchanged. A press on the canvas shows it as an Error
alert instead of a status-bar message. RGB, CMYK, Lab and Grayscale still
paint.