Hi Thomas,


Thomas Charbonnel wrote:
As views have their own units and coordinate
systems, my idea is to use the svg elements' viewBox to make the views
fit in their dedicated space on the sheet.

   Yes, this is the correct thing to do.

The thing is that to compute the viewBox, I need the document to
already have been rendered to take into account the space used by tick marks' labels. The problem is similar for text labels inside the rects and polygons. I need the text's bounding box to position and scale it in the rects and polygons.

I'm wondering where the best place would be to do this.

   The best thing to do is to register an 'onload' event handler
with the root SVG element (do this before passing the document to
the Canvas).  Your handler will be called after the document
has been loaded but before any display has taken place.  You will
have access to the full SVG DOM at this point so you can use
methods like 'getBBox()' to calculate the extent of your document.

I can think of a two passes rendering, registering an UpdateManager
listener and executing the remaining steps in the updateCompleted()
callback when needed, but it looks ugly and inefficient to me. My
feeling is that there must be a way to do this in one pass, but I
couldn't figure it out so far.
What's the recommended or commonly used way to do this ?

Regards,
Thomas



---------------------------------------------------------------------
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]

Reply via email to