Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Goo::Canvas zoom correction

by deadpickle (Pilgrim)
on Apr 05, 2009 at 00:40 UTC ( [id://755494]=perlmeditation: print w/replies, xml ) Need Help??

Just an update and or interesting information for users of Goo::Canvas. I have been messing with an application were the user can click on a map to insert a waypoint. The problem I was having was that when you zoom in and add a waypoint, the point would be off a distance. This increased greatly as you zoom in. Well using excel and some testing I think I found a correction factor for this zoom error:
z = zoom in percent (ex 100) x0 = x pixel of real pixel y0 = y pixel of real pixel x = x pixel of fake pixel y = y pixel of fake pixel x0 = (100*(x+0.6105))/z y0 = (100*(y+0.2526))/z
I don't know if this is dependent on the starting canvas size or not. I do encourage users to test this correction and see if it works for other situations. If this needs to be moved somewhere else let me know, I just put it in the most familiar place.

Replies are listed 'Best First'.
Re: Goo::Canvas zoom correction
by zentara (Archbishop) on Apr 05, 2009 at 13:07 UTC
    I worked on that awhile back, and this is what I came up with for centering on waypoints ..... it may not be perfect, but it works, and also incorporates scale....which you really need to deal with.. I just came up with the algorithm by guessing. :-) .... so there may be a better way. HTH..... I'm fading out of this stuff...of course I was tempted to use my Goo Canvas and transparent images to simulate the flight of that typo dong 2 missle. Would work perfect. :-)

    See

    Also of interest to centering would be:


    I'm not really a human, but I play one on earth.
    Old Perl Programmer Haiku

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlmeditation [id://755494]
Approved by ww
Front-paged by ww
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (2)
As of 2024-04-25 05:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found