Commit Graph
24 Commits
Author SHA1 Message Date
bflatastic b5e38e6d71 Merge remote-tracking branch 'origin/main' into HEAD
# Conflicts:
#	docs/ui-parity.md
2026-11-27 14:44:25 +07:00
bflatastic bb02b6ff09 Merge remote-tracking branch 'origin/main' into HEAD
# Conflicts:
#	docs/ui-parity.md
2026-11-27 14:38:04 +07:00
Denis Gomes a69319e8bd Frames resized together or dropped into a frame land on whole pixels too
Resizing several frames at once rounded only the pointer, and each frame
took its share of the scale as is: two 100 wide frames resized from 300
to 400 became 133.33 wide, one at 266.67. Each one now has its edges on
the nearest whole pixel of its parent, so the box still follows the
drag, at most half a pixel off per edge, and is never less than a pixel.

A frame moved into another frame was settled on whole pixels of the
parent it was dragged in, then reparented on the drop with its place on
the page kept, so in a frame off the grid it sat at .5 in it. It is
settled again in the frame it is dropped into.
2026-11-24 18:46:30 -05:00
Denis Gomes 5a875417e7 M8: frames, sections and components land on whole pixels
Figma's help says they "always snap to the pixel grid, even if Snap to
pixel grid is disabled". In FigCraft they followed the setting like any
layer, and since #2031 a snap to a layer off the grid wins over the
grid, so a frame dragged next to a neighbour at 100.4 landed at 100.4
and the whole numbers inside it sat between pixels.

A move, resize or draw of frames, sections, components, component sets
and instances now rounds to whole pixels before and after object
snapping, whatever Snap to pixel grid says. A moved one also lands on
whole pixels of its parent (`snap::settle_on_pixels`), so a frame
already off the grid comes back onto it. Other layers keep #2031's
order: the pixel grid first, then the snap to a layer wins.

The move rounds the drag itself rather than each layer afterwards, so
the preview keeps its shifted-layers fast path for frames already on
the grid.
2026-11-24 14:22:35 -05:00
FueryS cfef5763f4 picker: remove picker-side crop init and compute placement per node (#2499)
Remove picker-side crop initialization when selecting Crop mode in the
color picker, and instead let the engine compute the initial placement
crop per node using each selected layer's own dimensions. This avoids
stretching images when multiple differently sized layers are selected
at once.
2026-11-21 22:21:14 +05:30
Denis Gomes 435d85b8a4 M1: Crop mode crops by the layer's sides in auto layout, up to the image, and never runs with vector edit
In crop mode (Object > Crop image) the layer's sides and corners crop its
image through the Cmd/Ctrl resize: the canvas sends Cmd/Ctrl while crop
mode is on. Several things went wrong around that.

Auto layout. The Cmd/Ctrl crop left out any layer with auto layout on it
or an ancestor (#703), because the layout could recompute the box after
the drag and a crop worked out for the dragged size would stretch. An
image in an auto layout column was resized and squashed instead. The
exclusion is gone: the crop is worked out for the dragged box in the
preview and, once the layout has run, again from the snapshot for the
size it left (crop_to_the_laid_out_box). A resize already makes the
dragged axes Fixed; the layout may still move the layer, and the picture
moves with it, unstretched. Where the layout makes the layer longer than
it was dragged (a minimum width after the left side was dragged in), the
crop slides back along the image rather than past its edge.

Past the image. A side could be dragged beyond the image's edge, leaving
an empty strip inside the layer. While the box isn't flipped, its sides
now stop at the image's box (or where they started, if that was further
out: a Fit image is smaller than its layer). The box is drawn back towards
where it started, both ends of an axis by the same fraction, so an Alt
resize stays centred, and with Shift both axes by the same fraction, so
the ratio holds. A drag past the opposite side still flips as any resize
does (command_crop_keeps_image_placement_in_the_layers_axes pins that).

Ratio. A layer whose proportions are locked kept its ratio in crop mode
too, so dragging a side moved the opposite axis; the crop window now
ignores the lock and Shift keeps the ratio. The image's own corner
handles were the other way round from a resize: in proportion by
default, free with Shift. They now scale freely, in proportion with
Shift.

Vector edit. A double-click on the image enters vector edit mode, and
Object > Crop image could be chosen while vector edit was on, so both ran
at once. The injected Cmd/Ctrl then turned a drag of the layer's side
into the Bend tool (a curved edge), and a dragged top segment showed the
selected points' box, "804 x 0". Now image.crop ends vector edit, crop
mode ends when vector edit starts, the canvas injects Cmd/Ctrl only while
no points are being edited, and a double- or triple-click in crop mode
stays in crop mode. When the second press of that double-click began a
resize on a side of the layer, its release ends the resize.

command_resize_leaves_fills_when_text_or_auto_layout_recomputes_the_box
pinned the auto layout exclusion; its text case stays as
command_resize_leaves_a_texts_fills.
2026-11-19 16:41:09 -05:00
FueryS a0539b4c3e M1: image fill in Crop mode morphs and squishes on normal resize (#2499)
Choosing Crop in the color picker's scale mode dropdown initializes the image's placement crop without closing the picker or entering interactive crop mode on the canvas.

Resizing the layer normally without Cmd keeps the stored crop transform unchanged, stretching/squishing the image fill to fit the layer (Figma parity). Holding Cmd while resizing continues to crop the image without moving pixels.

Tests: transform_behaviour_tests::crop_mode_image_resizing_without_cmd_morphs_and_with_cmd_crops, crop_image_tests.
2026-11-20 02:21:45 +05:30
Trevor BrownandClaude Opus 5.5 44a761e783 Merge upstream/main into fix/snap-threshold-measured
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 04:59:25 -05:00
bflatastic 8cb527bd21 Merge main into #2200 2026-11-12 12:25:09 +07:00
Trevor BrownandClaude Opus 5.5 cc36771713 M8: absoluteRotation turns a selected parent before the layers in it (#2196)
A page angle depends on the parents', so a frame and a layer inside it set together both land on the typed page angle whatever the order of the ids (the layer went to 80 for 45 when it came first).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Model-Effort: Opus 5.5 drove and wrote (review fix, no brief)
2026-11-10 03:06:32 -05:00
Trevor BrownandClaude Sonnet 5.5 d0379dc70d M8: Rotation field shows and sets the rotation on the page (node.set absoluteRotation)
The Design panel's Rotation field now reads and writes the layer's rotation on the page (its own angle plus its parents'), as measured in Figma's web app, 2026-11-10. A new additive node.set key, absoluteRotation, does the work (one call for every selected layer, so one undo step and the moved rotation origin still apply); rotation stays the angle to the parent for scripts, inspect, codegen and the formats. Closes #2196.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Model-Effort: Opus 5.5 drove; Fable 5.1 briefed; Sonnet 5.5 wrote at medium
2026-11-10 03:02:09 -05:00
Trevor BrownandClaude Opus 5.5 da81d55a64 Transform: Shift-rotating inside a rotated frame lands the page rotation on multiples of 15
Measured in Figma: a layer's rotation field shows its rotation on the page, also inside a rotated frame or group, and Shift snaps that value. A test pins it; the doc comment on shared_rotation_degrees says so. Review item on #2096.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Model-Effort: Opus 5.5 drove and wrote; Sonnet 5.5 measured in Figma
2026-11-10 02:14:17 -05:00
Trevor BrownandClaude Sonnet 5.5 a1ac22f12f Transform: Shift while rotating lands on multiples of 15°, not 15° steps from the start
Measured in Figma: a layer at 7° (or -4.27°) Shift-rotated by its corner ends at 15°; FigCraft rounded the turn since the drag began, so a layer at 7° landed on 7 + k*15. The rotate gesture keeps the selection's shared rotation and Shift rounds base + turn; a selection with different rotations keeps rounding the turn. Test: a layer at 7° Shift-turned by 37° ends at 45°, by 3° at 15°, and a free turn is unchanged.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Model-Effort: Opus 5.5 drove; Opus 5.5 briefed; Sonnet 5.5 wrote at medium
2026-11-07 21:23:25 -05:00
Trevor BrownandClaude Sonnet 5.5 a198046384 Smart guides: objects snap within 4.5 screen pixels, as measured in Figma
Figma snaps a dragged object's edge to another's at a gap of 4.4 screen pixels and not at 4.6, at 100% and at 200% zoom, so the threshold is about 4.5 screen pixels; FigCraft used 5. The object snap (move, resize, draw, vector points) now uses 4.5, and the equal-spacing snap in a move shares that threshold so it follows. Ruler-guide and rotation-origin snapping keep 5, unmeasured.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Model-Effort: Opus 5.5 drove and briefed; Sonnet 5.5 measured and wrote at medium
2026-11-07 19:57:05 -05:00
NetterSilverandClaude Opus 5.5 39c5833818 Keep object snapping when Snap to Pixel Grid is on
Fixes #2029

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-06 04:10:50 +01:00
bflatastic a44bba56a0 #703: Cmd/Ctrl-resize crops a layer whose size was bound to a variable as well: the resize detaches the binding (#809), so the new size sticks 2026-10-24 10:09:28 +07:00
timrrrr 8a77ef6759 M1: preserve image fills with variable-bound resize dimensions 2026-10-17 01:18:07 +03:00
timrrrr 9397d2ca03 M1: crop image fills during Command/Ctrl resize (#702) 2026-10-16 23:16:26 +03:00
bflatastic 92d00ca04a Merge #388: Keep corner resize cursors diagonal on wide and tall layers (@Silvertree2010) 2026-10-15 15:08:52 +07:00
NetterSilverandClaude Haiku 5.5 fc6f52e852 Keep corner resize cursors diagonal on wide and tall layers
Fixes #370

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 03:50:00 +02:00
Marco Arnulfo e92792e3e8 M1: a press on a corner handle resizes instead of picking the corner-radius handle (fixes #292)
The corner-radius handle sits 10 px in from each corner and answers within 6 px, so a press on the inner half of the 8 px corner square picked it: the drag rounded the corners or, dragged outward, did nothing. Inside the drawn square the corner now resizes both sides (in ratio with Shift or the constrain-proportions link); further in the radius handle still answers.
2026-10-14 14:36:39 +02:00
fede9234 db55720c93 fix(engine): keep proportions when a linked width or height is typed (#222)
With a layer's proportions locked, setting only its width or only its height through node.set (the W and H fields) scales the other side by the layer's own ratio; setting both in one edit leaves them as typed, an unlinked layer is unchanged, and a zero side has no ratio to keep. Fixes #220.
2026-10-14 07:31:19 +07:00
bflatastic 485715f11e M1: cursors per tool and modifier, panel widths, outline options, dark pages
- Cursors: the engine names a cursor for every tool, modifier and hover
  target (rotate turned to its corner, pen states, eyedropper, comment,
  copy on Alt, not-allowed while an instance refuses the edit); the UI shows
  the system's or draws its own; guides and handles keep their cursors;
  ui.inspect reports it.
- Panels: each edge drags its panel within limits, a double-click resets,
  widths are per window and kept in the preferences (view.panelWidths); a
  small window keeps its canvas.
- Outline mode: Include hidden layers and Include object bounds
  (view.outlinesHiddenLayers, view.outlinesObjectBounds), drawn and
  clickable; light lines on a dark page; check marks in the View menu.
- A file or page made in the dark theme has a #1E1E1E page (sessions
  without an interface keep #F5F5F5); text drawn on a dark page is white.
- Tests for Enter and Escape on a selected text.
2026-10-13 00:29:41 +07:00
BFlat 894f25c4c4 M1: selection and transform behaviour suite and fixes (#133)
A selection and transform behaviour suite derived from public documentation, with fixes: Alt-resizing shrinks as well as grows; groups, Scale-constrained frames and multiple selections resize each layer along its own axes keeping rotation and flip; several layers flip together past an edge; a flipped layer reads back the typed rotation; resizes land on whole pixels with the pixel grid; presses inside tiny layers move them; locked layers get no handles; a marquee can start on a top-level frame's background; select inverse skips hidden layers. Adds equal-spacing snapping with labelled gaps and Cmd/Ctrl to ignore constraints while resizing a frame.
2026-10-11 20:30:38 +07:00