Hi Stephan, "Stephan Zuiderwijk" <[EMAIL PROTECTED]> wrote on 12/05/2005 02:04:16 AM:
> thank you for your fast reply. I've been playing around with your > sugestions. It works fine. Because of the large amount of items (app. 5500) > I cached the circle elements when my JSVGCanvas is first opened. If the update is slow (and I suspect it might be as our CSS engine has some O(N^2) behavior when modifying all the children of a group), and you are not afraid of a small 'hack' you might consider using the stroke to adjust the 'size' of the circles: <g stroke-width="2" fill="red" stroke="red"> <circle r="0.0000001" cx="..." .../> <circle r="0.0000001" ..../> </g> To update the 'radius' of the circles you now only need to update the 'stroke-width' on the surrounding 'g' element. The CSS engine will quickly cascade this to all of the children in one step. The other advantage is that I think this will only update the shape painter instead of essentially rebuilding the circle from scratch. But it is a hack (in the best sense of the word) and will basically only work for circles. > > Kind regards, > > Stephan Zuiderwijk > > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: Friday, December 02, 2005 11:46 AM > To: batik-users@xmlgraphics.apache.org > Subject: Re: Scaling in batik extension > > Hi Stephan, > > "Stephan Zuiderwijk" <[EMAIL PROTECTED]> wrote on > 12/01/2005 09:03:49 AM: > > > I'm quite new to batik, I've got a question about scaling in batik. In > > a > Java > > application I am showing map of europe in a JSVGCanvas. The cities are > shown > > as little red circles. [...] what I want to achieve is the following. > When a > > user zooms in at the map, the circles should resize so that they stay > > at > the > > same size for the user's point of view. Can anybody help me out with > this? > > You want to capture 'onzoom' events. You can then query the > currentScale on > the root SVG element. You can then use this to update the 'r' attribute > on > your circle elements (this is mostly easily done if all the circles are > the > child of a 'cities' layer or something, then you can just iterate through > all the element children of the group and update the 'r' attribute). > > All of this can be done in either script or Java. > > > --------------------------------------------------------------------- > 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] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]