[ka-Map-users] Bug in CVS kaMap zoomTo function?

Paul Spencer pspencer at dmsolutions.ca
Wed Apr 19 21:13:35 EDT 2006


Thanks David.  Obvious in hindsight :(  committed to cvs.

Cheers

Paul

On 19-Apr-06, at 6:07 PM, David Badke wrote:

> In the CVS version of kaMap.js, zoomTo(cgX,cgY) function, the new  
> behavior is to slide if the point being zoomed to is within the  
> current extent, otherwise jump to it as before. However, the  
> current code does not work properly - I was sometimes finding it  
> sliding all the way across a 10000 pixel wide image! The problem, I  
> think, is in the statement:
>
>          if (cgX >= extents[0] && cgX <= extents[2] ||
>              cgY >= extents[1] && cgY <= extents[3]) {
>
> which I think should be:
>
>          if (cgX >= extents[0] && cgX <= extents[2] &&
>              cgY >= extents[1] && cgY <= extents[3]) {
>
> In other words, the way it is now, if the new point is EITHER  
> within the x-extent OR within the y-extent it will slide, but it  
> should only slide if the point is within BOTH the x-extent and y- 
> extent (AND). The combination of && and || with no parentheses is  
> also odd. My brain is refusing to visualize this today, so I may be  
> wrong, but changing || to && in the statement seems to fix it...
>
> David
>
> -- 
>
> David Badke
> Humanities Computing and Media Center
> University of Victoria, BC, Canada
>
> _______________________________________________
> ka-Map-users mailing list
> ka-Map-users at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/ka-map-users

+-----------------------------------------------------------------+
|Paul Spencer                           pspencer at dmsolutions.ca   |
+-----------------------------------------------------------------+
|Applications & Software Development                              |
|DM Solutions Group Inc                 http://www.dmsolutions.ca/|
+-----------------------------------------------------------------+






More information about the ka-Map-users mailing list