OK, so I have the JSVGCanvas zooming in and zooming out.  Since I have a whiteboard application, users can draw objects to the canvas.  Much like typical art programs, you get an “outline” of what you’re going to draw before it’s placed.  For a box, you click, drag the mouse to the desired size and release.  I guess they call it “rubber-banding” or whatever.

 

On to my question.  When the canvas is zoomed in/zoomed out, how can I get the translation correct on the glass pane?  The glass pane is currently drawing based on the coordinates of the JSVGCanvas, but it draws as if the JSVGCanvas isn’t zoomed in or out.  In short, what the glass pane is rendering is not zoomed, but what the JSVGCanvas is rendering is.  So what you see isn’t what you get when you let go of the mouse.  How can I translate my shapes based on the zoom?  If I draw something on a canvas that is zoomed in 20%, I’d like to scale the outline 20%...etc.  That degree of scaling is what I don’t know how to get.

 

Michael Bishop

Reply via email to