-
Notifications
You must be signed in to change notification settings - Fork 172
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
**Problem:** 1. In a selected scene, dragging an element should drag the scene not the element 2. In a selected scene, clicking on an element should select the element 3. In a selected scene, dragging an element under the threshold not move anything, but select the element 4. In a selected scene, cmd-dragging an element should drag the element not the scene 5. In a selected scene, cmd-clicking an element should select the element 6. In a selected scene, cmd-dragging an element under the drag threshold should not move anything, but select the element **Fix:** To fix 1-2-3 we need to make sure that dragging below the threshold is handled as a "click", so the selection happens on mouse up. To fix 4-5-6 we need to make sure the cmd-mousedown already selects the element, which guarantees that the following dragging operates on the element (and not the scene) Meanwhile, the failing tests uncovered that we have an extra bug: you can deselect a selected item if you click on a non-visible (e.g. cropped) part of it. To fix it I modified the behavior of `findValidTarget` in `dont-prefer-selected` mode: it means we should change our selection to something different if possible, but we should still not deselect it. To make this clearer I renamed `don't-prefer-selected` to `prefer-more-specific-selection` As I fixed the tests I had to realize that our dragging helper functions are not good enough: we can specifiy modifier keys, but we can not specify separate modifier keys for the mouse down and for the mouse move events. Which is necessary because e.g. cmd changes the behavior differently in the two cases: cmd on mouse down changes how selection work, so it changes what will be dragged, while cmd on mouse move changes which strategy will be applied (cmd allows reparenting). **Manual Tests:** I hereby swear that: - [x] I opened a hydrogen project and it loaded - [x] I could navigate to various routes in Preview mode Fixes #6012
- Loading branch information
Showing
9 changed files
with
285 additions
and
58 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.