-
Notifications
You must be signed in to change notification settings - Fork 170
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
No dom query in grid element resize strategy (#6373)
**Problem:** Another step to remove dom api dependency from grid strategies: the grid-resize-element strategy uses the new `getGlobalFramesOfGridCells` to detect the grid cell under the mouse. **Commit Details:** - Fixed `getGlobalFramesOfGridCells` problem: it calculated the local frame not the global frame.... - Fixed and improved `getGlobalFramesOfGridCells` test to include differend padding/row-padding/column-padding values - Memoized `getGlobalFramesOfGridCells`: this is a quite fast function so it wouldn't be important to memoize it, but in most cases we run it for the same grid cell (because we are doing an interaction in it), so it still makes sense to memoize. I just uses `memoize` with the default config (which allows memoization of 5 values) - Created a new `getGridCellUnderMouse` version called `getGridCellUnderMouseFromMetadata`, and call that from the strategy - I modified the strategy to use the canvas and not the window coordinate system. Unfortunately, `GridCustomStrategyState.targetCellData` uses the window coordinate system, and that is used in multiple strategies, so I postponed to change that too. I introduced a new type `TargetGridCellDataCanvas` (similar to `TargetGridCellData`), I plan to migrate to this new type everywhere. **TODO:** The strategy is still not the best. A downside of querying the grid cells under the mouse is that the strategy is broken when the mouse is not over the grid (even though the resize rectangle follows the mouse), see https://screenshot.click/16-30-s1avn-hgu83.mp4 Using the metadata it is possible to implement a much better strategy which can calculate where to resize to even when the mouse is not over the grid. That can come in a subsequent PR. **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
- Loading branch information
Showing
5 changed files
with
173 additions
and
111 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
Oops, something went wrong.