Skip to content

Conversation

@nng98
Copy link

@nng98 nng98 commented Dec 12, 2025

Description

This PR implements nudge-scaling for the ALT and ALT + CTRL keys for the path tool with the arrow keys. When ALT is held, using the arrow keys nudges only the bottom right points of the selected points, and when ALT and CTRL are held , only the top left points of the selected points are nudged the full amount. In both cases, points outside of these regions are unaffected.

Code Changes

In editor/src/messages/input_mapper/input_mappings.rs, added input entries to send messages for the path tool whenever ALT or ALT + CTRL is held as a modifier to the 'PathToolMessage::NudgeSelectedPoints' message. Note that this also applies to when combinations of arrow keys are held (such as when ArrowRight and ArrowUp are held, it will produce a diagonal nudge to the top right).

In editor/src/messages/tool/common_functionality/shape_editor.rs, we changed the move_selected_points_and_segments function to have additional parameters for whether it should only move the top left or only move the bottom right points, called bot_right and top_left respectively. Additionally, we changed the function's implementation to, if one of these parameters is passed, only adjust points that are in the selected regions by continuing in the loop where points are moved if the point is outside the desired region.

In editor/src/messages/tool/tool_message/path_tool.rs we changed the PathToolMessage enum to accept booleans nudge_alt, nudge_ctrl for NudgeSelectedPoints message. Additionally, we changed the handler for the 'PathToolMessage::NudgeSelectedPoints' to call shape_editor.move_selected_points_and_segments with additional parameters passed for the booleans, as described in the changes to shape_editor.rs.

Demo Video

path_tool_nudge_scaling.mov

Closes #2374

@timon-schelling
Copy link
Member

timon-schelling commented Dec 12, 2025

Thanks for contributing. Did you use an LLM to help on this PR? If yes specific what parts are generated?

@nng98
Copy link
Author

nng98 commented Dec 12, 2025

Thanks for contributing. Did you use an LLM to help on this PR? If yes specific what parts are generated?

Thank you! I used an LLM to help with the change I made to editor/src/messages/tool/common_functionality/shape_editor.rs, specifically, I used it to help calculate the location of the center of the selected points. Otherwise, none of the other changes involved the use of LLMs.

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.

Nudge-scaling of points with the Path tool

3 participants