Hi Rob,

Wilkins, Rob wrote:

I spent the last two days re-working our code that overlays objects on the
SVG. Using your suggestion of overriding setRenderingTransform() method.

The good news is I have got almost all of the shape updates (in response to
changes in the SVG rendering transform) working. It also allowed me to
remove many lines of the existing code and utilise the features of the
JSVGCanvas component in the correct manner.

Great!


I should point out that I have also dispensed with the scrolled panel that I was using in favour of the panning support built in to the JSVGCanvas component.

This is fine if you like the 'built in' panning. However I strong suspect that the way you are doing things the JSVGScrollPane from the 1.5.1rc2 release will just work (all it does it set and listen to the rendering transform).

However I have hit the following problem. If I resize the window that holds
the JSVGCanvas component I do not get a call to setRenderingTransform(). So
I get no chance to scale the overlaid components.

This is handled in updateRenderingTransform, this is called when the canvas changes size. The reason this is 'different' is that when the canvas changes size the normal behavior is to 'refit' the SVG document's viewBox to the Canvas - thus it is not the Canvas's transform that changes but the SVG's 'viewing' transform that changes (this distinction is important to implement the SVG 'getCTM' method correctly).

    If you are working with the 1.5.1rc2 release you
can avoid this behavior by calling 'setRecenterOnResize(false)'.
In this case the viewing transform will never change once the
document is loaded.

The strange thing is that the SVG is clearly re-rendered as the
GVTTreeRendererAdapter::gvtRenderingStarted()/gvtRenderingCompleted() are
called. Calls to getRenderingTransform() in these methods return the
identity transform.

What method should I override in order to get hold of the transform that is
applied once the window has been resized thus allowing me to scale my
overlaid components and align them with the scaled SVG in the resized
window?

The combined rendering and viewbox transform is available from the JSVGCanvas.getViewBoxTransform(). It is my belief that this can only change in the updateRenderingTransform call so overriding that and using the getViewBoxTransform method should let you deal with this issue.




--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to