fix: Improve navigation and movement looping behavior#9732
fix: Improve navigation and movement looping behavior#9732
Conversation
…ed to the workspace
maribethb
left a comment
There was a problem hiding this comment.
I think it is worth thinking through if there is a possible better approach to handle adding the workspace as a "stop" in constrained move, since it has added complexity here. But if you think about it and don't have any better ideas, this LGTM.
| // we're in keyboard-driven constrained mode. | ||
| if (this.moveMode === MoveMode.CONSTRAINED) { | ||
| showUnconstrainedMoveHint(this.workspace, true); | ||
| showUnconstrainedMoveHint(this.workspace); |
There was a problem hiding this comment.
Is it possible to differentiate this case from the case where a block was already on the workspace? There are two scenarios in this else clause:
- You are doing constrained move of a block that has multiple positions to go to, and the current position happens to be the workspace stop, but if you keep moving the block in constrained mode (with looping on, or move back the way you came), the block would in fact move somewhere else.
- You are doing constrained move of a block that has nowhere else to go, so constrained move does not do anything because there are no other connection points.
You've improved the behavior by only showing the hint once, but I think that ideally scenario 1 would not show the hint at all. If this is too complicated to do in this PR, I would be fine submitting this as an improvement and filing a bug to follow up with this.
Edit: kept reading the rest of the PR and you are doing some work related to differentiating these, so maybe you can reuse that work here
| case Direction.UP: | ||
| destination = new Coordinate( | ||
| bounds.getOrigin().x, | ||
| bounds.getOrigin().y - 20 - draggingBlock.getHeightWidth().height, |
There was a problem hiding this comment.
this magic number should probably be a constant, don't we already have one for the amount a block moves in unconstrained mode? i would use that
| * @returns True if the block is at the start or end of its possible positions | ||
| * on the workspace. | ||
| */ | ||
| private isInTerminalPosition( |
There was a problem hiding this comment.
The amount of work you're doing to figure this out does make me wonder if it means there's a better approach than including the workspace in the list of possible places to go, but you'd have to talk to Mike about how he implemented that to see if y'all can work out something better.
The basics
The details
Resolves
Proposed Changes
This PR makes several improvements around keyboard-driven movement and navigation: