You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd like to limit how far the user can pan the camera with sigma. Right now, the user can drag with their mouse so that the graph goes off screen - I'd like to stop the user from panning any further once there are no more nodes for them to see.
I found the functionsigma.utils.getBoundaries that tells me the maximum size in the graph's reference frame. For my graph, these are the values:
I thought then to go edit the goTo method on the camera class, like this:
if (coordinates.x < bounds.minX) coordinates.x = bounds.minX;
if (coordinates.y < bounds.minY) coordinates.y = bounds.minY;
if (coordinates.x > bounds.maxX) coordinates.x = bounds.maxX;
if (coordinates.y > bounds.maxY) coordinates.y = bounds.maxY;
However, the coordinates here are from the coordinate space of the camera rather than of the graph, and I don't know how to change graph coordinates to camera coordinates. I expected to be able to find how to do this somewhere in the code, but after a few hours searching I can't seem to work it out. I tried using the cameraPosition and graphPosition methods, but they give unexpected results. How do I change graph coordinates to camera coordinates?
Do you have a suggestion on where I could look?
The text was updated successfully, but these errors were encountered:
Hi,
I'd like to limit how far the user can pan the camera with sigma. Right now, the user can drag with their mouse so that the graph goes off screen - I'd like to stop the user from panning any further once there are no more nodes for them to see.
I found the function
sigma.utils.getBoundaries
that tells me the maximum size in the graph's reference frame. For my graph, these are the values:I thought then to go edit the
goTo
method on thecamera
class, like this:However, the coordinates here are from the coordinate space of the camera rather than of the graph, and I don't know how to change graph coordinates to camera coordinates. I expected to be able to find how to do this somewhere in the code, but after a few hours searching I can't seem to work it out. I tried using the
cameraPosition
andgraphPosition
methods, but they give unexpected results. How do I change graph coordinates to camera coordinates?Do you have a suggestion on where I could look?
The text was updated successfully, but these errors were encountered: