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

David Badke dbadke at uvic.ca
Wed Apr 19 18:07:43 EDT 2006

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 Badke
Humanities Computing and Media Center
University of Victoria, BC, Canada

More information about the ka-Map-users mailing list