Hi,
I have found a strange behaviour.
I create a <g> element with a <rect> subelement via DOM manipulation.
The result is something like this:
<g transform="translate(150, 0)">
<rect width="100" height="30" stroke="blue" fill="yellow" />
</g>
But if I am doing it this way, it fails:
final SVGGElement myGElement= (SVGGElement) doc.createElementNS(ns, "g");
doc.getRootElement().appendChild(myGElement);
final SVGRectElement myRectElement= (SVGRectElement)
doc.createElementNS(ns, "rect");
myRectElement.setAttributeNS(null, "stroke", "blue");
myRectElement.setAttributeNS(null, "fill", "yellow");
myRectElement.setAttributeNS(null, "width", "100");
myRectElement.setAttributeNS(null, "height", "30");
myGElement.appendChild(myRectElement);
myGElement.setAttributeNS(null, "transform", "translate(150, 0)");
The problem is: Train doesn't get painted. Not even after calling
canvas.repaint().
Of course I am doing this in the thread of the update manager. All other
things I am painting do appear correctly.
The interesing thing is, if I translate the <g> object so that the new
location intersects the original location (0, 0), the part of the train in
the intersection is correctly painted.
If I set the "transform" attribute _before_ adding myGElement to its
parent, everything works well. Only when doing this _after_ adding it to
its parent, it fails.
BUT: Another strange behaviour. Assume the above (failing) code snippet
and insert a
myRectElement.setAttributeNS(null, "fill", "red");
_after_ adding myRectElement to its parent (the <g> element)
the whole train is getting painted correctly (with the new fill color)!
What is the problem? Is it a bug? Am I doing something wrong?
Regards
Marco
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.