In an Indexed Color or a Bitmap document Photoshop keeps no type layer: the
Type tool still lets you click and type and shows the text while editing, but
committing it leaves a selection in the shape of the glyphs and no layer, as
one history state named "New Type Layer", and paints nothing.
commit_here already made that result for the Type Mask tools, with
type.createSelection and removeLayer in the typing session's one step, so the
commit now runs it for a new Type tool layer in those two modes as well, and
names the step back after type.create's own label. The mode check is the
engine's (type_cmds::commits_as_selection) and not the type.create command's:
that command is the primitive the tools make their working layer with, on the
first click already with text in it while the placeholder preference is on, so
a mode branch there would leave nothing to type into.
Tests: cmd::type_indexed_mode_tests pins the commit in both modes (no type
layer, the selection the Type Mask of the same text makes, one state named
"New Type Layer", every pixel unchanged, one undo back), RGB, Grayscale, CMYK
and Lab at 8, 16 and 32 bit, the command's own role, and a refused conversion;
editing.rs pins the tool's commit and its cancel through the canvas' own
pointer_up, insert and commit.
Fixes#12041
count.deleteGroup kept the same index current after deleting the
current group, so with three groups and the second current the third
became current. The first remaining group now becomes current, as the
reference application does. Deleting another group by index still keeps
the current one (#5654), and deleting the last group still leaves none.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The journal made `layer` portable for layer.layerMask.moveTo but kept `to` as
the document's layer id. Replayed on another document, that id names some
other layer or none: the mask silently went to an unrelated layer or the step
failed. Before the fix, recorded_mask_drop_replays_on_another_document
recorded `"to": 8` and replay moved the mask onto "Extra" instead of "Shadow".
Recording now keeps `to` as the layer's name (from the document before the
step, since a drop on the Background renames it "Layer 0"), plus
`toOccurrence` when several layers share the name. move_mask resolves a name
(requiring `toOccurrence` when it is ambiguous), and explicit calls still take
a numeric id. This matches how layer.moveTo records its drop target
(`target` + `targetOccurrence`).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
In Photoshop, dragging a layer mask's thumbnail onto another layer or group moves the mask
there, and ⌥-dragging copies it. PhotoCraft's mask thumbnails could only be dragged to the
trash, so dropping one on a group did nothing.
- engine: layer.layerMask.moveTo {layer, to, copy, replace}: one history step; a layer
that already has a mask keeps it unless `replace`; the Background becomes a layer first.
- Layers panel: a layer mask thumbnail dropped on another row (layer or group, without a
mask of its own) moves the mask there, ⌥ copies it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Type: a duplicated type layer is renamed after its new text (#9023)
A type layer's name follows its text until the layer is renamed (#483),
but only while the name is exactly the text. A duplicate is "Title copy"
(or "Title copy 2"), so editing its text kept the old name. A name that
is the text plus Duplicate Layer's " copy" or " copy N" now counts as
named after the text too, so the copy takes its new text's name; any
other name is still kept.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Type: a copy of a "… copy" type layer follows its text too (#9023)
Duplicate Layer names a copy of "Draft copy" "Draft copy 2", so the
check now compares the names' roots (the name before " copy" or
" copy N") rather than adding " copy" to the text's name.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Type: a copy keeps its "… copy" name until its text changes (#9023)
A type layer named after its text was renamed after every edit through
the type helpers, so with "Title copy" now counting as named after its
text, Change Type Size, a style-only or kerning edit, Convert to
Paragraph or Point Text, Area Type and Type on a Path renamed the copy
"Title". The name now follows the text only when the text changed; a
layer named exactly after its text gets the same name as before.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Type: a "… copy" name the user typed is kept when the text changes (#9023)
A type layer named "Title copy 2" by hand, with "Title" as its text,
counted as a Duplicate Layer copy and was renamed after its next text
edit. The document now remembers the names the user typed (Rename
Layer, a name Duplicate Layer's dialog didn't offer, type.edit's name)
for the session, and such a name is kept. A name Duplicate Layer made
still follows the text, and so does one an undone rename brings back.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Type: a name given in the Layers panel or by type.create is the user's (#9023)
The Layers panel renames in place with layer.setProps, and type.create
takes a name: neither recorded it in typed_names, so a copy-shaped name
typed there ("Title copy 2" on text "Title") was replaced by the next
text edit. Both now record it, as Rename Layer and type.edit's name do.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Type: a name typed for a duplicate into another document is the user's (#9023)
Duplicate Layer into a new document and Copy Layers to Document take a
name but returned without recording it, so a copy-shaped name typed there
was replaced by the next text edit. A name other than the copy's own is
now recorded in the destination document, as the in-document duplicate
does.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: FredApps <153173854+FredApps@users.noreply.github.com>
* fix(artboards): move a clipping group between boards as one (#10512 follow-up)
Dragging the base of a clipping mask onto another artboard left its
clipped layers on the old board, released, covering that whole board
(auto_nest moved the base alone and clip_group::settle released the
layers that lost it).
auto_nest now carries the layers clipped to a moving base along, in
order, directly above it on the new board (or at the top level), so
settle keeps them clipped. A clipped layer never changes board on its
own, moved or not: it shows only over its base, so it goes where the
base goes. When any layer of the group can't go (Prevent Auto-Nesting,
the group depth limit), the whole group stays. Still one history step.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(paste): keep a paste from off the boards visible (#10538 follow-up)
Copying a layer that isn't on any artboard and pasting with a layer on
board B selected put the paste inside B, beside that layer, outside B's
area, so B hid it. The clip has no source board, so board_shift doesn't
move it onto B, and layer_place::insertion_point only checked the
content centre when the anchor was the board itself.
insertion_point now applies the same centre rule beside a layer on a
board: a layer edited right after it is made (Place::AutoEditable:
Paste, Place, Type, Shape) whose content is centred off the anchor's
board goes above the board at the top level, as it already does with
the board itself selected. Content centred on the board (Paste at the
view centre there) still lands inside it. Place::Auto (New Layer, fill
and adjustment layers) is unchanged: those layers are empty or cover
the canvas.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(paste): shift a mask or channel paste between artboards (#10538 follow-up)
Pasting into a layer mask, alpha channel or Quick Mask (paste_to_target)
still placed the pixels with paste_offset alone, so with the target
layer on another artboard they no longer landed where a layer paste
does: at the old spot on the source board (in place) or the middle of
the view.
paste_to_target now applies board_shift first, as paste does, for Paste
and Paste in Place alike; Paste Into / Outside keep centring on the
selection (board_shift skips clampToCanvas: false).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(artboards): name the auto-nest plan entry type (clippy type_complexity)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Keep the board shift for a mask paste into a position-locked artboard; an off-board paste above an artboard lands unclipped
- board_shift skips the position-lock guard when the paste adds no layer (a mask paste), since mask edits don't check position locks.
- insert_new: a layer placed directly above an artboard is never clipped to it, and goes past the clipped layers above the slot.
- Tests for both; each fails without its fix.
* Paste into an alpha channel or the Quick Mask keeps document coordinates; only new content above an artboard is unclipped
An alpha channel or the Quick Mask covers the whole document and is on no
board, so the selected layer's board no longer shifts a paste into it. The
unclip-above-an-artboard rule in insert_new now applies only to
Place::AutoEditable (new content placed off a board), so a clipped layer
put Place::Above a board (the layers after a pasted board, a duplicate)
keeps its flag as before.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: FredApps <FredApps@users.noreply.github.com>
* Move tool: auto-nest layers into the artboard they're dropped on (#10218)
In Photoshop a layer dragged with the Move tool onto another artboard joins
that board, and one dragged onto the pasteboard leaves its board. PhotoCraft
had the Prevent Auto-Nesting lock but not the behaviour, so a layer dragged
onto another board stayed in its old board and was clipped away.
layer.translate takes an opt-in "nest" flag. With it, a moved layer whose
centre now lies on a different board joins that board on top of its stack,
and one moved off every board goes to the top level above the board it left,
in the same undo step. The Move tool's drag release sets it, which covers
Alt-drag copies; nudges, actions and scripts are unchanged. Boards,
the Background, empty layers, over-deep groups and layers locked with Prevent
Auto-Nesting stay where they are.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Auto-nesting: true, floored middle for the board under a layer
Review follow-up: board_under found the middle of a dropped layer by halving
each edge first, so a layer at 9..11 counted as centred at 9 and could join
(or stay in) the wrong one of two boards meeting at x = 10.
The middle now comes from one helper, layer_place::centre, shared with the
placement of new and pasted layers: the edges are added in i64 before halving
and the sum is floored, so -4..3 (middle -0.5) is left of a board starting at
x = 0, not on it. Adds regressions for both.
Co-Authored-By: Claude <noreply@anthropic.com>
* Document the auto-nesting rule and exclusions in layer.translate
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: FredApps <153173854+FredApps@users.noreply.github.com>
An adjustment layer's Make step now loads its `Nm `, `Md ` and `Grup`
keys as the command's `name`, `mode` and `clipToPrevious` params and saves
them back. An unreadable value keeps the step as an unsupported kept step;
`layer.newAdjustmentLayer.*` validates the new params like New Layer and
clips through the clip-group rules. Fixes the remainder of #8384.
Co-Authored-By: bommerts <44821497+bommerts@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Measured in the reference application: Duplicate and Layer via Copy of one
linked layer put the copy in the original's link group. Copies of several
layers of one group still get a group of their own, and a copy that is the
only one from its group among several copied layers is still unlinked.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Blend If in a recorded layer Set loads as layer.layerStyle.blendingOptions
and plays (it was dropped without a word). The Blending Options dialog's
Set (opacity, fill, mode, Blend If, Advanced) stays one step and saves back
as one Set; with other keys those go through layer.setProps.
Gradient Fill Make and Set load as layer.newFillLayer.gradient and
gradient.fill.set with stops, transparency, midpoints, scale, offset,
dither and align. Midpoint k is the Mdpn of stop k + 1, as the PSD reader
reads it. A loaded step saves back as its recorded descriptor until it is
edited; a Noise gradient, smoothness below 100 %, a non-classic
interpolation or a transparency midpoint stay Photoshop steps.
Fixes#10771
With our fix-up 8a0f959d29 on top of the author's head 072a87e7b0.
Conflicts with the batch resolved: Image Size keeps #10702's point sizes and
writes `scaleStyles` only when true (no key and false play the same in the
reference application, so recorded steps save back unchanged); Convert to
Profile takes #10704's options; new tests carry #10743's `encoding` field;
#10702's absolute-intent test expects the new Convert to Profile flags.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- FTcs reference points used a 3x3 grid (Qcs0..Qcs8). The reference application has
Qcsa centre, Qcs0..Qcs3 corners clockwise from top-left and Qcs4..Qcs7 the sides
top/right/bottom/left (measured: 50 % scale, Qcs6 keeps the bottom centre, Qcs1 the
top-right corner). Qcs8 and Qcsi stay kept steps; nothing writes Qcs8.
- file.close {"save": false} (used by ui-egui tests) became an error; it discards again
and saves as Svng N.
- Batch never performs the action's Save As, so the scratch document stayed dirty and the
recorded Close (no Svng -> "save":"ask") failed every file of "...; Save As; Close".
A Save / Save As save point now marks the document saved.
- Adjustment-layer opacity is quantised to 8 bits on load; a recorded 70 % saved back as
70.196 %. The whole percent that quantises to the same level is saved again.
- Cmd-clicking a group's thumbnail errored; it loads the whole canvas again as before.
A recorded Cmd-click on another layer's thumbnail kept the numeric id and failed strict
Save Actions; it records the layer by name (or as the Background).
Co-authored-by: yoriswind <164435053+yoriswind@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Retain bounded original SVG alongside its raster mirror. Explicit Pixels,
Path and Shape modes use real source data, validate destination and workload
limits before editing, and preserve legacy Paste when the mode is omitted.
Round-trip typed Photoshop Paste classes and keep unsupported descriptors.
Adapted-from: Skyfuller1303's PR #3409
Original-commit: 897f200727
Original-source: https://github.com/storytold/photocraft/pull/3409
Validation: engine check --tests; strict lib and vector target Clippy;
7 focused native/ATN tests; owned-file formatting and diff checks.
Conflicts resolved as unions of both sides: codecs re-exports (PngRows + TiffBands), smart_cmds source imports
(main's source_surface_from_buffer and cache API with #8571's svg_source_image_in/convert_svg_source; main's
duplicate rendering import dropped), io flat.rs test modules (#8536's banded TIFF tests and main's PNG ones),
menus/invoke.rs (#8571's smart SVG intercept and main's layer.selectUnderCursor), state.rs (#8311's
type_box_overflow and main's type_insertion_style), the canvas_geom test keeps the is_finite guard, docs
status lines keep both change lists, i18n catalogs keep both sides' rows (hi.tsv: main's wording where both
added the same string).
Conflicts: svg.rs (main's bufread inflate and shared render helper, kept
with the PR's bounded raster path), psd_import.rs (the PR's vector
preview moved into main's smart_content), menus/invoke.rs (the SVG
intercept moved into main's split invoke_unguarded), rendering.rs and
the ui-egui import lists (main's explicit imports), Cargo.lock, docs
status lines (unions).
Integrate main 69b8fd9c1, retaining multi-channel selection and editing through extracted channel-panel, Move-pointer and tone-editor helpers. Adapt explicit imports and preserve progress-document histories.