In pan&zoom mode, on resizing the window, the pile position doesn't update
flekschas opened this issue · 3 comments
flekschas commented
eeeeenchanted commented
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 commented
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 commented
- Use the old layout and old pile position to calculate the old ij position (xy pos to ij pos)
- Use the old layout to calculate the grid cell index (ij pos to index pos)
- 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