XML Elves

XML Elves

<community>of XML and SVG Developers</community>


how to tell whether zoom in or out?

This is a discussion on how to tell whether zoom in or out? within the SVG Questions forums, part of the SVG Forums category; Hey, I added an eventlistener: svgDoc.rootElement.addEventListener("SVGZoom", sync, false); sync is a function that keeps sizes of some shapes constant as ...


Go Back   XML Elves > SVG Forums > SVG Questions

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Notices


Click here to register

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-23-2004, 10:53 AM
Carlos
Guest
 
Posts: n/a
Default how to tell whether zoom in or out?

Hey,
I added an eventlistener:
svgDoc.rootElement.addEventListener("SVGZoom", sync, false);
sync is a function that keeps sizes of some shapes constant as the background map zooms.
In order to do that without hard-coding values in, I need to know whether the used clicked zoom-in or zoom-out.
Is there a way to retrieve that information?
Thanks in advance!
Carlos
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 06-23-2004, 11:30 AM
Anonymous
Guest
 
Posts: n/a
Default how to tell whether zoom in or out?

You can find zoom scale with
document.rootElement.currentScale

Also for pan, currentTranslate return SVGPoint

Michel
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 12-18-2004, 02:46 AM
wayhang
Guest
 
Posts: n/a
Default setting zoom scale

Hi,

By default, svg enable us to press "CTRL" + left click to zoom in
and each time we zoom in, the scale will b...
newScale = currentScale * 2...So what i'm trying to do is set it to
b...
newScale = currentScale * 1.5

Below is my code, when i try to zoom in, i get a "Stack overflow"
error. The way i do it is wrong? Can anyone show me the correct way
to do it?

Thanks in advance


<svg id="root" width="200" height="200" viewBox="0 0 200 200"
onload="Initialize(evt)">
<script language="javascript">
<![CDATA[
var currentScale;
var newScale;

function Initialize(evt)
{
var SVGDoc = evt.getTarget().getOwnerDocument
();
SVGRoot = SVGDoc.getElementById("root");
SVGDoc.rootElement.addEventListener
("SVGZoom", zoomScale, false);
}

function zoomScale()
{
currentScale = SVGRoot.currentScale;
newScale = currentScale * 1.5;
SVGRoot.setCurrentScale(newScale);
}
]]></script>
<circle cx="20" cy="20" r="15" style="fill: blue"/>
<rect x="100" y="100" width="10" height="20" style="fill:
green"/>
</svg>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Tags
zoom


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT -6. The time now is 02:09 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0

Compatible Inkjet Cartridges
At PRINK we offer Free UK Delivery on the highest quality guaranteed compatible inkjet cartridges. We stock over 50,000 inkjet cartridges.

ink cartridges
Ink cartridges for sale online! Don't miss out on some quality bargains… Great prices for top brand names. See for yourself!

hard disk drive data recovery cheshire
Do you urgently need data recovery from your hard disk drive done in Cheshire? We have an unrivalled success rate.

ink cartridges Free UK Delivery on ink cartridges such as Canon, Dell, Epson, hp & Lexmark.

1 2 3 4 5 6 7 8 9 10