-
Notifications
You must be signed in to change notification settings - Fork 423
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
How to apply the zoom level to text size (keep the text appropriate size while zooming) #17
Comments
Is there a way to turn off zooming? |
@arikan there is no build-in way to do this yet. The way I'm doing it in Amazon visualization is very cumbersome. I had to create a separate group layer I admit SVG support is purely designed part of the library. I putting myself a todo to make it better. Sorry about this. |
@henry74 there is no way to do this, if you are using renderer. I'm trying to understand your use case better. Do you need other interactive features of the renderer (e.g. panning, unified support of multiple graphics objects, graph change monitoring)? Or do you want to produce layout once and use it as a static structure? |
I found a simple work around. My use case was to just prevent zooming of the graph since it detracted from the user experience. I just captured the mousewheel event for the parent svg tag and return false. No mouse accidental mouse scroll zooming :-) |
@henry74 very nice :)! |
@henry74 I need to prevent the mouse wheel scroll as well, I tried many things, but no luck, can you share a snippet. For example this does NOT work:
|
Related to this, would there a way to set a max/min zoom level? Max zoom being something like 'fit all to screen' level. |
Old question, but I was able to prevent zooming and thought I'd share a snippet of my solution/workaround incase anyone has the same problem(solution in Coffeescript): renderer.run() # the SVG element is created when the renderer is run
svgElement = renderer.getGraphics().getGraphicsRoot() # Temporary var containing SVG element
$(svgElement.bind( 'mousewheel DOMMouseScroll', (e) ->
if e.shiftKey isnt true #Zoom only if shift key is being held down
e.preventDefault() # Prevent zooming
return false
) |
Thank you @joerodrig3! A small note about |
Is there a method that we can get the zoom level from Viva.Graph or something. I need to use it so that text size stay appropriate while zooming in and out. Thanks.
The text was updated successfully, but these errors were encountered: