Repository navigation
Conversation
|
Adds a Mirror action to the stair properties panel so a staircase can flip handedness in place, which is what #901 asked for on Cut Back stairs. The handedness math lives in a new pure function in core: it swaps
Start with |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FX8vGAP5g43AHR1jixUeXr
- getStairMirrorUpdates also flips winder turns and one-sided handrail modes added in #1000; hasStairMirrorUpdates reports whether anything changes - Keep one Mirror button in Actions, disabled when there is nothing to mirror; the sound plays only when the mirror applies. Actions lay out as a two-column grid so the fourth button no longer clips Delete - Drop the dead `!stair.stairType` check (the schema defaults it) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FX8vGAP5g43AHR1jixUeXr
Aymericr
left a comment
There was a problem hiding this comment.
Thanks @ovurrsl, this is a really nice addition for #901, and sorry it waited so long.
The logic looks right to me: getStairMirrorUpdates covers attachment sides, winder turns, curved/spiral sweep sign and one-sided railing/handrail modes, it's a single undo step, and the tests include round-trips. Disabling the button when there's nothing to mirror is a nice touch.
The one thing blocking: the screenshots aren't actually attached. The description has an <!-- attach: 1002-cutback-before.png ... --> placeholder, but no images rendered. Since this is a visual feature, please drag the four before/after images (or a short screen recording of Mirror on a U-turn and an L-winder) into the PR description.
Once the images are up, the final merge call on visual features is Aymeric's. CI on fork PRs also needs a maintainer to approve the workflow run.
| className="disabled:cursor-not-allowed disabled:opacity-40" | ||
| disabled={!canMirror} | ||
| icon={<FlipHorizontal2 className="h-3.5 w-3.5" />} | ||
| label="Mirror" |
There was a problem hiding this comment.
Could you include a screenshot of the Actions row with the new Mirror button in the 2-column grid (enabled and disabled states)? That's the part reviewers can't see from the diff.
|
Thank you!! |
feat(stair): add Mirror action for stair handedness (Cut Back stairs)
Description
What does this PR do?
Adds a Mirror action to the stair panel. It flips a stair's handedness in place without moving it or changing its dimensions. Closes #901.
getStairMirrorUpdates(core,systems/stair/stair-mirror.ts) computes the patch:attachmentSideleft ↔ right, and winderturnleft ↔ right (StairSegmentNode.winderfrom Add stair winders, construction details and unified railing models #1000). Other winder settings (inner gap, walking-line offset, division) are kept.sweepAnglechanges sign. On these stairs Mirror does the same thing as switching the existing Clockwise / Counterclockwise control in Geometry. It is still offered so that Mirror behaves the same on every stair type.railingModeandhandrail.mode(Add stair winders, construction details and unified railing models #1000) flip left ↔ right.bothandnonestay as they are.hasStairMirrorUpdatesreports whether a mirror would change anything. The panel has a single Mirror button, in Actions next to Move / Duplicate / Delete. It is disabled when there is nothing to mirror (for example a single straight flight with symmetric or no railings). The rotate sound plays only when the mirror applies. The edit is one undo step (runAsSingleSceneHistoryStep). With four buttons, the Actions row uses a two-column grid, as the parametric inspector already does for extra actions, so Delete is no longer clipped.The branch is brought up to date by merging
main(no force-push). The conflicts were only inpackages/core/src/index.tsexports and thepanel.tsximports.How to test
bun dev, add a stair, apply Layout → U turn (Landing). In the stair panel, click Actions → Mirror. The second flight moves to the other side of the landing, and a Left guard becomes Right. Undo restores it in one step.bun test packages/core/src/systems/stair/stair-mirror.test.tsScreenshots / screen recording
Split view (2D plan + 3D), before and after clicking Mirror:
1002-cutback-before.png→1002-cutback-after.png. The second flight moves to the other side and the guard becomes Right.1002-winder-before.png→1002-winder-after.png. The winder and upper flight turn right.Checklist
bun devbun checkto verify)getStairMirrorUpdates; no schema change.mainbranchReplies to review threads
pascal Bot (winder/handrail and duplicate button feedback):
(If Cursor Bugbot left threads on this PR, the same commit covers them:
!stair.stairTypedead check removed, sound/no-op behaviour fixed, duplicate button removed.)