xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thomas.dewe...@kodak.com
Subject RE: bbox on text node in onload javascript
Date Thu, 21 Aug 2008 09:45:36 GMT
Hi Nirmesh,

"Nirmesh Desai" <ndesai@autonomy.com> wrote on 08/20/2008 03:19:40 PM:

>  function updateVisualization(evt)
>  {
>         //some code for inits etc...
>         itemLabelTextView1 = templateText.cloneNode(true);
>         itemLabelTextPath1 = templateTextPath.cloneNode(true);
> itemLabelTextPath1.appendChild(document.createTextNode('someText'));
>         itemLabelTextView1.appendChild(itemLabelTextPath1);
> 
>      var bbox = itemLabelTextView1.getBBox();

[...]

> The bbox remained null with the timeout approach.

   The problem is that the element is not part of the
rendering tree. This can have many implications on the
calculation of the bounding box, so I'm not entirely
sure what other implementations are returning.  Batik
simply won't return a bbox unless the element is part
of the rendering tree (that includes not returning
a bbox for elements that have display='none' things
in the '<defs>' section, etc).

   If you append it to some element in the rendering
tree (even if it's just temporary) then getBBox will work.
Obviously depending on where you attach it the bbox might
vary (CSS property inheritance and selectors being one 
major variable, but also things like percentage units).

Mime
View raw message