Skip to content

feat(flare): fake shapes: drafts, commit, box gestures, duplicate, copy and paste - #736

Closed
prakashUXtech wants to merge 1 commit into
devfrom
claude/flaremodel-shape-fakes-34x8ie
Closed

prakashUXtech wants to merge 1 commit into
devfrom
claude/flaremodel-shape-fakes-34x8ie

Conversation

@prakashUXtech

Copy link
Copy Markdown
Contributor

What

Adds FakeShapes, the ShapeBuilding fake from docs/blueprints/flare.md section 6.3 (LM-0a2b). FlareServices.fake() now holds it in place of NotBuilt.

  • Drafts: rectangle and ellipse drafts are polygons. Shift makes the sides equal and Option draws from the center. A zero-size drag, or the select tool, gives no draft. Pen drafts add one anchor per call. A drag marks its anchor smooth, and a click within 4 pt of the first anchor closes the path once there are at least two anchors.
  • Commit: adds the draft as a new layer named "Rectangle n", "Ellipse n" or "Path n", above aboveLayerID (or on top). It runs one AddLayer in one group, "Add Rectangle", "Add Ellipse" or "Add Path". It throws layerLocked above a locked layer.
  • Box gestures: boxResult gives move, scale and rotate values. A scale keeps the opposite handle fixed, and a middle handle leaves the other axis alone. A rotation turns about the box center. commitBox writes those values with SetKeyframe in one group, "Move", "Scale" or "Rotate", using section 2's not-animated rule: with one key or none and auto-key off, it edits that one key; otherwise it keys the playhead.
  • Duplicate, copy, paste: duplicate inserts above each original in one group, "Duplicate". Copy writes AddLayer envelopes. Paste reads them back only through CommandRegistry.builtIn, shifts x by offset, and runs in one group, "Paste". Names follow "Ball copy", then "Ball copy 2" and so on. Anything that isn't a list of AddLayer envelopes throws "Nothing to paste.".
  • The C4 description of flare-model-sources now lists FakeShapes.

Split

The whole of LM-0a2b went past the 400-line cap, so path edit, item move and delete are split out into #473 (LM-0a2c). Until that lands, setPath, translate and delete throw NotBuilt("Not built yet (LM-0a2c, #473)."). #473 touches only FakeShapes.swift and its test, so it does not block LM-0a3 (#318).

Proof

Tests/FlareModelTests/ShapeFakesTests.swift covers each line of the acceptance test:

  • aRectangleCommitIsOneEntryUndoAddRectangle: exactly one entry, "Undo Add Rectangle".
  • shiftGivesEqualSidesAndOptionDrawsFromTheCenter: equal sides with Shift.
  • aScaleGestureKeepsTheOppositeCornerFixed: the opposite corner stays within 1e-9.
  • copyThenPasteAddsBallCopyInOneEntry: "Ball copy" in one entry, "Undo Paste".
  • garbagePasteDataThrowsNothingToPaste: garbage data throws "Nothing to paste.".

Further tests cover the pen draft, the not-animated rule, the stubbed item edits and the unavailable fake. Model only: no SwiftUI and no snapshots.

Docs: I checked JSONDecoder.decode(_:from:) with the apple-docs MCP. The rest is FlareCore and the Swift stdlib.

make ci prints CI: PASS on this head.

Closes #317

Belt-Run: act-1a1363c7fd0-dmkc
Fast-Check: pass
Head: 3a9d82c


Generated by Claude Code

@prakashUXtech prakashUXtech added the fast-lane Merge automatically when small, green and outside protected paths label Oct 14, 2026 — with Claude
@github-actions

Copy link
Copy Markdown
Contributor

Fast lane: not merged, this PR conflicts with dev at head 3a9d82c. Rebase on origin/dev, rerun scripts/ci, and update the Fast-Check marker.

@github-actions github-actions Bot removed the fast-lane Merge automatically when small, green and outside protected paths label Oct 16, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Fast lane: not eligible. touches protected paths: docs/c4/model.json. This PR now needs normal captain review.

@prakashUXtech

Copy link
Copy Markdown
Contributor Author

Superseded by #508 (af8bbee on dev): FakeShapes there covers drafts, commit, box gestures, duplicate, copy and paste, plus path edit and delete; ShapeFakesTests has the same acceptance checks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flare LM-0a2b: Fake shapes: drafts, commit, box gestures, path edit, delete, duplicate, copy, paste

2 participants