Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix image bounds when browser window resizes #89

Open
hannahker opened this issue Aug 21, 2023 · 5 comments
Open

Fix image bounds when browser window resizes #89

hannahker opened this issue Aug 21, 2023 · 5 comments
Assignees
Labels
enhancement New feature or request UI/UX
Milestone

Comments

@hannahker
Copy link
Collaborator

hannahker commented Aug 21, 2023

Resizing the browser window results in the image not fully able to occupy the available space on zooming: see the white space on the right in the screenshot below.

My guess is that this is because the get_container_size() clientside callback only triggers on initial page load, and should also be triggered when the user resizes the window.

@hannahker hannahker added the bug Something isn't working label Aug 21, 2023
@hannahker hannahker added this to the MVP App milestone Aug 21, 2023
@hannahker hannahker added the good first issue Good for newcomers label Aug 21, 2023
@cleaaum
Copy link
Collaborator

cleaaum commented Aug 28, 2023

Putting this issue on hold for now as we could not find an elegant solution yet. Approaches/ideas we tried:

  • Dash Breakpoints: Not ideal as you set certain breakpoints, and the callback only gets triggered when a width/height threshold is crossed. For our use case, we would need a breakpoint for every pixel I believe, which is not very elegant
  • Dash Extension (eventListener) : buggy and doesn't actually trigger the callback. This is because of the bubbling phenomenon of certain events
  • RelayoutData Property: tried using this prop as a callback input. This only triggers a callback if the data inside a plot changes, but not the figure canvas itself. ie: callback is fired on image zoom, but not on window resizing
  • Hidden Div: tried to add a hidden div to the app and see if I could capture the styling change when it gets resized with the browser resizing but didn't work.
  • dcc.interval: version currently implemented, which periodically checks the width and height of the browser window, and triggers a callback if this window size changed. Problem: a few milliseconds delay between the resizing of the browser and the updated figure canvas parameters.

@cleaaum cleaaum added enhancement New feature or request UI/UX and removed good first issue Good for newcomers bug Something isn't working labels Aug 28, 2023
@hannahker
Copy link
Collaborator Author

Moving this back to "Needs refinement" for now.

@hannahker hannahker assigned danton267 and unassigned cleaaum Sep 15, 2023
@hannahker
Copy link
Collaborator Author

@danton267 assigning this over to you to implement the solution you've scoped using the dash_breakpoints component.

@cleaaum
Copy link
Collaborator

cleaaum commented Sep 15, 2023

I can go over the formula to adjust the browser window if you'd like @danton267 as it took me awhile to figure out.

@danton267 danton267 linked a pull request Sep 21, 2023 that will close this issue
@hannahker
Copy link
Collaborator Author

After discussing internally, we're de-prioritizing this ticket for the time being. @danton267 was able to get the dash_breakpoints components to fire without manually setting breakpoints, but this results in poor performance as the callback is triggered far too many times on browser resize as the event fires continually throughout the resizing action (not just on mouse up). Further investigation is needed here to determine if there's some way to resolve this elegantly.

See these (now closed) PRs for relevant WIP:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request UI/UX
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants