Store/Restore VisCanvas's zoom and pan
Closes daiquiri-tomo#117 (closed) !560 (closed)
This MR proposes a component to store/restore zoom and pan in VisCanvas (only linear scale supported!).
This is an alternative implementation of !560 (closed) and handling of store/restore zoom in !517 (closed). It is a more generic solution than !560 (closed) and can be applied to a single VisCanvas as well as multiple synced ones, either saved separetely or through a common config/model as here.
Compared to what's in !517 (closed), it stores the position of the center of the VisCanvas and the scale (data per pixel) in "data coordinates" rather than the parameters of the camera. This should be resilient to window being resized between storing the parameters and restoring them. it also combines store and restore in the same component.
One still possible flow is if the stored position/scale does not fit the new range of the axes of the VisCanvas. This still need to be done.
I had trouble with
useUserPreference
and couldn't understand what's going on.Here it is replaced by a zustand store in sessionStorage
.