Hi Colin,
zhan hai <[email protected]> wrote on 05/26/2010 05:40:40 AM:
> I debugged batik's source code and found there existed a 'render
> rect' used to clip . Initially the 'render rect' will be set the
> same as viewport if no 'viewbox' attribute were set.
Right, unless you set overflow="visible" all SVG elements
establish a clipping rectangle that corresponds to the view port.
The fact that you didn't include a viewBox simply means that there is
no transform created to fit your viewBox to the available view port.
> When scroll bar is moved/dragged, the scroll pane will call
> 'setRenderingTransform' to show other parts of svg image, but since
> the 'render rect' is not changed and remained as the original viewport
> position(0,0) , so new content won't be showed since it will be
> clipped by the 'rendering rect'.
Right, that is the purpose of a clip rect. To keep you from
seeing things that are outside of the clipping rectangle.
> Then I adjusted 'render rect' each time scroll bar is moved, it works.
> 'Render rect' including 'bounds' of document's root node, 'bounds'
> and 'clip' of canvas node.
> This way maybe somewhat of 'hacker' since people have to fall into
> batik implementation deeply. Any other normal solutions?
The normal solution would be to disable the clipping if you don't
want it, by adding 'overflow="visible"' to the SVG element...
> 2010/5/25 <[email protected]>
> Hi Colin,
>
> zhan hai <[email protected]> wrote on 05/23/2010 02:03:57 AM:
>
>
> > If new elements are added to position out of the initial bbox, the
> > canvas won't show these elements. So I want to change viewbox again
> > to make viewbox contains the newly added element and i expect scroll
> > pane can resize it's scroll bar to map the extended viewbox.
>
>
> Well the simplest thing is to set 'overflow="visible"' on
> the root SVG element.
>
> > But after calling 'setAttributeNS
> > (null,SVGConstants.SVG_VIEW_BOX_ATTRIBUTE,'xxxx'), all things in
> > canvas disappeard .
> > Any suggestions?
> I've tested this before and it has worked. Are you sure your
> 'xxxx' is a valid viewBox specification? I should also say that
> setting the viewBox is a very expensive operation as we have to
> rebuild the entire graphics tree because any attributes that use
> percentages are likely to have changed.