--- In [email protected], "Marc Kelly" <[EMAIL PROTECTED]> wrote:
>
> I have a SVG with a viewBox of 600X800 that references an image file 
> (PNG) that is larger than that size. Only the top left portion of the 
> image is visible. 
> 
> I'd like to write some javascript that will allow clicking on the 
> image at any point in the viewBox, centering the image on that point, 
> and scaling it by 2. It would emulate a zoom-in by single clicking.
> 
> I'm doing this by translating the group around the image based on the 
> coordinates of the mouse click. The centering of the image is working, 
> but when I apply the scale transform, the centering is thrown off. The 
> previously centered part of the image is usually up and to the left. 
> I'm assuming this has to do with either different coordinate spaces, 
> the order of the transforms, or scaling performed at (0,0), but I'm 
> not sure which.

going from mouse coordinate to target coordinate in some viewers needs
some scripting, see Holger Will's script on http://wiki.svg.org/Starter

scaling works from the current (0,0) origin

transforms are read right to left, upwards, for example:
<g transform="scale(9)"><g transform="translate(7,8)scale(5,6)"
stroke="none" fill="red"><rect x="1" y="2" width="3" height="4" /></g></g>
renders as
<g transform="scale(9)"><g transform="translate(7,8)"><rect x="5"
y="12" width="15" height="24" stroke="none" fill="red" /></g></g>
renders as
<g transform="scale(9)"><rect x="12" y="20" width="15" height="24"
stroke="none" fill="red" /></g>
renders as
<rect x="108" y="180" width="135" height="216" stroke="none" fill="red" />

Good luck






-----
To unsubscribe send a message to: [EMAIL PROTECTED]
-or-
visit http://groups.yahoo.com/group/svg-developers and click "edit my 
membership"
---- 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/svg-developers/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to