Hi Cameron,

Cameron McCormack wrote:
Say I have a simple program that puts a JSVGComponent in a frame and
loads up the following document:

<svg xmlns="http://www.w3.org/2000/svg";>
<script>
function f() {
var svg = document.documentElement;
System.out.println('' + svg.width.baseVal.value ',' + svg.height.baseVal.value);
}
</script>
<rect width="100%" height="100%"
fill="yellow" stroke="black" stroke-width="10" onclick="f()"/>
</svg>


Since there is no viewBox, the dimensions of the viewport will be used
as the area of interest for display in the component.  When the frame is
resized, and the mouse is clicked on the rect, the correct (updated)
dimensions are printed, but the displayed image does not change.

Uhh, yah. So you can know about the resize with a componentResized listener (there is already one in the JGVTComponent). The problem is that the way we handle changes in SVG element's size is extremely expensive. The whole tree under the SVG element is rebuilt so that percentage units are recalculated. This is just one place where we could really use a good dependency tracking system, so we would only rebuild the elements that really needed rebuilding...

Should the rect (whose width and height are 100%) be repainted to fit
the new size of the component?  If so, I'm not sure exactly where I
would need to make a change to effect this.

The answer is probably, I don't think the spec really talks about this. However my concern is that every time the window is resized the entire document's GVT tree will be rebuilt even though I think a small number of documents actually have percentage units.

   At the very least it might be nice to have a boolean that is
set by the unitParser so you at least know that someone used
percentage units before you rebuild the entire document.

   Anyway the place to make the change would be in the ComponentListener
in JGVTComponent (I would add a new method that is called in response
to resize events that the JSVGCanvas can override to do it's extra
stuff).  If you look at the SVGSVGElementBridge class you can
see where the code that handles changes in Width/Height are.


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



Reply via email to