Re: DOM APIs - Accessing The viewBox Attribute

Hi Francis,

It is already possible to get the viewBox attributes (though it's very
verbose due to animation possibilities).  See the SVGFitToViewBox
interface in the DOM IDL: http://www.w3.org/TR/SVG11/idl.html from
which the <svg>, <symbol>, and <marker> elements all inherit:

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 300">
<script>
  var svgroot = document.documentElement;
  var vb = svgroot.viewBox.baseVal;
  alert([vb.x, vb.y, vb.width, vb.height]);
</script>
</svg>

Works in Firefox, Opera, Safari and Chrome.

Regards,
Jeff

On Fri, Jan 22, 2010 at 7:40 AM, Francis Hemsher <fhemsher@gmail.com> wrote:
> Hi Robert,
> I haven't used Batik, but I see the getViewBox listed in their classes:
> http://xmlgraphics.apache.org/batik/javadoc/org/apache/batik/dom/svg/SVGOMSVGElement.html
>
> Could we invite the Batik folks to participate in this thread? They
> have alot of methods that look very good.
>
> Francis
>
> On 1/22/10, Robert Longson <longsonr@gmail.com> wrote:
>> Francis,
>>
>> Doesn't symbolElement.GetViewBox or markerElement.GetViewBox etc meet your
>> needs?
>>
>> Robert
>>
>
>

Received on Friday, 22 January 2010 14:06:53 UTC