Reputation: 63
I have a use case where I would prefer to be able to constrain my nodes' rendered width/height to be static at every zoom level, i.e. zooming in does not rescale the rendered sizes of my nodes, but it still rescales and redraws everything else. Is there some way of doing this currently within Cytoscape.js?
Upvotes: 2
Views: 763
Reputation: 12250
Zoom is defined as a matrix transform on the entire scene. What you're describing sounds like a stretch rather than a zoom.
You can achieve the effect you're looking for by disabling zoom and applying your stretch effect: How you apply the stretch effect is up to you. If you want to mimic zoom, you can implement a pinch-to-stretch and wheel-to-stretch in your app by using the appropriate listeners on the container. Probably, it's easiest to centre your graph at (0, 0) so you can stretch by multiplying node positions by a scalar stretch factor. But if you have grabbable nodes, it's probably best to generalise your stretch code to use an arbitrary centre.
Upvotes: 0