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

In pan&zoom mode, on resizing the window, the pile position doesn't update #211

Open
flekschas opened this issue Apr 29, 2020 · 3 comments
Assignees
Labels
bug Coding: something isn't working

Comments

@flekschas
Copy link
Owner

flekschas commented Apr 29, 2020

I noticed that when we have the pan&zoom mode activated and resize the browser, the grid itself updates but not the pile position.

Note that in scroll mode, the position updates correctly.

Apr-29-2020 13-49-20

@flekschas flekschas added the bug Coding: something isn't working label Apr 29, 2020
@eeeeenchanted
Copy link
Collaborator

I'm wondering how to calculate the new position in pan&zoom mode? In scroll mode, I calculated the new position based on the grid. But in pan&zoom mode, does it requires the camera scaling or other camera properties?

@flekschas
Copy link
Owner Author

Mhhh good point. Yes, it requires the camera scaling and translation. Can you remind me of the steps that we take right now? I think all we need to get things working is a method that unprojects the item position.

@eeeeenchanted
Copy link
Collaborator

  1. Use the old layout and old pile position to calculate the old ij position (xy pos to ij pos)
  2. Use the old layout to calculate the grid cell index (ij pos to index pos)
  3. Use the new layout to calculate the new xy pos (index pos to xy pos)

You can look at https://github.com/flekschas/piling.js/blob/master/src/library.js#L909-L969

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Coding: something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants