Skip to content

fix: Preview did not draw correctly when dragging Grids#1183

Merged
mofojed merged 2 commits intodeephaven:mainfrom
mofojed:1112-drag-proxy
Mar 30, 2023
Merged

fix: Preview did not draw correctly when dragging Grids#1183
mofojed merged 2 commits intodeephaven:mainfrom
mofojed:1112-drag-proxy

Conversation

@mofojed
Copy link
Copy Markdown
Member

@mofojed mofojed commented Mar 29, 2023

  • When we drag something, there is a frame where the width/height is 0
  • We didn't update the metrics within the actual animation frame, so it was drawing the wrong thing
  • Fix so metrics are always updated in the animation frame, and also to only check the metrics with the previously checked metrics
  • Tested with ticking tables stuck to the bottom to ensure they stuck while ticking
  • Fixes drag proxy preview is broken #1112

- When we drag something, there is a frame where the width/height is 0
- We didn't update the metrics within the actual animation frame, so it was drawing the wrong thing
- Fix so metrics are always updated in the animation frame, and also to only check the metrics with the previously checked metrics
@mofojed mofojed requested a review from dsmmcken March 29, 2023 18:06
@mofojed mofojed self-assigned this Mar 29, 2023
@dsmmcken dsmmcken requested review from mattrunyon and removed request for dsmmcken March 29, 2023 18:11
@mattrunyon
Copy link
Copy Markdown
Collaborator

There's a bit of weirdness when the dragged table is narrower than the preview window. Same thing happens when the table is shorter than the preview window. I'm guessing the metrics are being calculated based on the container and not the drag preview.

If those dimensions are easy enough to get/pass into the metric calculation then let's do that. If not, I would be ok with the current fix

Screen.Recording.2023-03-29.at.1.53.34.PM.mov

Comment thread packages/grid/src/Grid.tsx Outdated
- When the drag was started, it was calling `contentItem.setSize()`, but that was having no effect as the item wasn't attached to the DOM when it was called
- Add the element to the DOM first and then set the size right away
@mofojed
Copy link
Copy Markdown
Member Author

mofojed commented Mar 30, 2023

Good catch. Now the dragging element resizes correctly! Looks much better when dragging, instead of just being cut off. Plots resize as well.

@mofojed mofojed requested a review from mattrunyon March 30, 2023 13:15
@mofojed mofojed merged commit 1a0ff8d into deephaven:main Mar 30, 2023
@mofojed mofojed deleted the 1112-drag-proxy branch March 30, 2023 17:01
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 30, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

drag proxy preview is broken

2 participants