Re: How to contol pan and zoom within a web page svg file

You can enable or disable panning and zooming via the
'enablePanAndZoomControls' attribute on the 'svg' element. The default
value is
'true'. If you set this attribute to 'false', the viewer should not allow the
user to zoom or pan.

This attribute works on the version of the Adobe SVG Viewer which I have. (But
I have access to internal builds. If it doesn't work for you, then maybe it is
feature that has been added recently. There should be a new public release
sometime in the next few weeks.)

If the simple boolean doesn't provide enough control, the next best thing is
the 'onzoom' event. For example:

<svg width="..." height="..." onzoom="alert(evt.type)"> ... </svg>

The 'onzoom' attribute in the Adobe SVG Viewer worked for me to pop up the
alert with the word 'zoom'. 

To actually do intelligent processing based on zoom level, however, may be
difficult with the current Adobe SVG Viewer as large sections of the SVG DOM
are not yet implemented. 

Unless other implementers are ahead of Adobe on these features, then for now,
you'll only be able to read the spec to see what will be available down the
road. The sections most relevant are the descriptions of the SVG DOM
(http://www.w3.org/TR/SVG/svgdom.html), Interface SVGZoomEvent
(http://www.w3.org/TR/SVG/script.html#InterfaceSVGZoomEvent), Interface
SVGSVGElement (http://www.w3.org/TR/SVG/struct.html#InterfaceSVGSVGElement)
[in
particularly, DOM attributes currentScale and currentTranslate], and the
events
chapter in the DOM2 spec (http://www.w3.org/TR/DOM-Level-2/events.html).

Jon Ferraiolo
SVG Editor
Adobe Systems Incorporated

At 02:08 PM 5/12/00 +0100, Andre wrote: 
>
> Could anyone please tell me how to control the pan and zoom (scale) within
> a svg file viewed through a web page.
> Thanks
> Andre

Received on Friday, 12 May 2000 11:32:25 UTC