Add nudge-scaling for path tool for ALT and ALT + CTRL keys #3465
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.
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 themove_selected_points_and_segmentsfunction to have additional parameters for whether it should only move the top left or only move the bottom right points, calledbot_rightandtop_leftrespectively. 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.rswe changed thePathToolMessageenum to accept booleansnudge_alt, nudge_ctrlforNudgeSelectedPointsmessage. Additionally, we changed the handler for the 'PathToolMessage::NudgeSelectedPoints' to callshape_editor.move_selected_points_and_segmentswith additional parameters passed for the booleans, as described in the changes toshape_editor.rs.Demo Video
path_tool_nudge_scaling.mov
Closes #2374