Repository navigation
duplicate complex obstacle shapes - #1123
Open
Devin T. Currie (DTCurrie) wants to merge 2 commits into
Open
Devin T. Currie (DTCurrie) wants to merge 2 commits into
Devin T. Currie (DTCurrie) wants to merge 2 commits into
Conversation
🦋 Changeset detectedLatest commit: f858d68 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
|
Contributor
|
Hey Devin T. Currie (@DTCurrie) — CI is green and no reviewer is assigned yet. Could you request one when you have a chance? Auto-comment from overwatch. Will not re-nudge for 7 days. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Lets a user duplicate a shape while editing a Complex obstacle, from the shape's row in the obstacle editor, from the selected shape's details panel, or with
Shift+D. The copy is appended with a numbered label so the user can rename it, and the row path focuses that label right away.Library
duplicateObstacleGeometryappends a shallow copy of the entry atindex, labeled<name>-Nwhere the name is what rdk calls the entry (a→a-1, unlabeledgeometry_2→geometry_2-1) and N is the first free number. A capitalizedLabelkey on the source is dropped so the copy carries its label under one spelling. An out-of-range index returns the list unchanged and no label.addObstacleGeometryshares the free-number search with it through a privatefreeLabel.Plugins
ComplexObstacleEditoradds a Duplicate icon button to each shape row, between Select and Remove. After the write it holds the copy's label as pending, and an effect focuses and selects that row's label input once the row renders.commitnow returns whether it wrote.DuplicateObstacleShapeButtonis new: a "Duplicate shape" action for a selected Complex shape with aShift+Dchip. It registersediting.duplicateObstacleShapethroughuseHotkeyfor as long as it is mounted, and moves the selection to the copy's entity when its frame appears. A copy rdk would reject shows the error under the button and writes nothing.BuildDetailsrenders it aboveRemoveObstacleShapeButton.Why?
Why does the hotkey select the copy but not focus its label, when the row button does?
Focusing an input from a hotkey would swallow the next
Shift+D, since an unmodified press typed into a field belongs to the field. Repeated presses could not stack copies. The row button is a pointer action, so focusing the new label there costs nothing.Why append the copy at the end rather than after its source?
Inserting mid-list renumbers every unlabeled
geometry_Nafter it, which would need a new index move for the saved appearances to follow. Appending keeps every existing shape in place, the same as Add shape.Why a shallow copy?
Edits never mutate a geometry in place.
patchObstacleGeometryreplaces the whole entry, so a sharedtranslationobject is never written through. A deep clone also fails on the Svelte state proxy the component prop arrives as.Testing
Ran
pnpm check,pnpm lint, andpnpm testscoped tosrc/lib/plugins/BuildFrames/andsrc/lib/__tests__/obstacleGeometryList.spec.ts. Added specs forduplicateObstacleGeometry(labeling, free number,Labelkey, out-of-range), for the editor row (writes the copy, focuses the new label after rerender), and a newDuplicateObstacleShapeButton.svelte.spec.ts(click, hotkey match and run, chip, selection follows the copy, rejected copy).BuildDetails.svelte.spec.tsnow supplies a keybindings context and checks both actions.