> If you want the canvas to change scale or pan position then > the rendering transform needs to change. The built in > updateRenderingTransform function does this in some cases but I > don't think you can all of what you want by adjusting component sizes.
OK, can we talk through the simplest case? Assume I have a JSVGCanvas WITHOUT a JSVGScrollPane. I'm going to eliminate the scroll bars so I can tackle one problem at a time. My JSVGCanvas is viewing an entire document and is sized at 400x400. I reduce the size of my window so it's now 75% of its original size. At this point, the JSVGCanvas should be 300x300, but should also be displaying the entire document. To me, that sounds like I need to: - Change the size of the component to 300x300. - Apply something like a JSVGCanvas.ZoomAction to make the document fit inside the JSVGCanvas. (This is how I would want it to work with a JSVGScrollPane if the scrollbars are NOT visible. I think when I reintroduce the JSVGScrollPane, I have to extend the class as you've said.) I'm going to do some experimenting, but I wanted to share my thoughts and get feedback from the list in case I get stuck. Michael Bishop -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, December 21, 2006 7:48 PM To: batik-users@xmlgraphics.apache.org Cc: batik-users@xmlgraphics.apache.org Subject: RE: Resizing a JSVGCanvas... Hi Michael, "Bishop, Michael W. CONTR J9C880" <[EMAIL PROTECTED]> wrote on 12/19/2006 10:24:32 AM: > Yeah, that's what I was afraid of. I was hoping for some guidance > on doing it fairly simply, if there is such a way: > > - If the scroll bars of the JSVGScrollPane aren't visible, then just > size the JSVGCanvas according to the resize. Is this the default > behavior of the JSVGCanvas? Even inside a JSVGScrollPane? Hmm, actually when it's inside a scrollPane the scroll pane sets 'recenterOnResize' to false. Which means that the canvas keeps the upper left the upper left and just changes size ( showing more content on the right/bottom for example). > - If the scroll bars of the JSVGScrollPane are visible, then just size > the JSVGScrollPane's viewable area. > > Any hints on where to start? You might consider subclassing/replacing/modifying the JSVGScrollPane so it only sets recenterOnResize to false when the scrollbars are showing... > Would I even need to touch rendering transforms or would setting > the size on these components be sufficient? If you want the canvas to change scale or pan position then the rendering transform needs to change. The built in updateRenderingTransform function does this in some cases but I don't think you can all of what you want by adjusting component sizes. > I know it needs experimentation; I'm just trying to narrow down the > variables I need to play with. > > Michael Bishop > > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: Friday, December 15, 2006 6:53 AM > To: batik-users@xmlgraphics.apache.org > Cc: batik-users@xmlgraphics.apache.org > Subject: Re: Resizing a JSVGCanvas... > > > Hi Michael, > > "Bishop, Michael W. CONTR J9C880" <[EMAIL PROTECTED]> wrote on > 12/14/2006 09:12:44 AM: > > > so there are a bunch of transforms associated with the > > JSVGCanvas. Plus you define a viewBox attribute in your SVG > > document. What I'd like to do is have the JSVGCanvas resize when I > > resize my main Window/Frame. If the user has zoomed in or out, I > > want to preserve that. Basically I want to take what the user > > currently sees and resize it accordingly. > > I was under the impression that this was more or less the > default behavior of the Canvas. Anyway the code that handles > this is the 'updateRenderingTransform' method on the JSVGCanvas > (the default implementation is in AbstractJSVGComponent). > > > If the user's looking at an entire document and they resize the window > > > smaller, I want the entire document shown (smaller) in the smaller > > JSVGCanvas. If the user is zoomed in and has scrolled to an area of > > the document (I have a JSVGScrollPane), I want that viewing area to > > be the same when they resize. In short, I want to preserve what the > > user sees, just size it according to the window size. Can I get some > > pointers on how to achieve this? > > You can override the default implementation and do what ever you > want, however I warn you it's tricker than it seems... ;) > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]