Thanks, Marcelo. The problem with switching to the moveend event is that, while moving, the user could drag the image past its boundaries and it would correct its position only after they stopped dragging. I wanted to avoid this since I felt it would not be a smooth experience.
Your tip on the recursion pointed me in the right direction though although the final answer was not where I expected to find the problem. Ultimately, the recursion was caused by floating-point "dither". When I constrain the movement, I get the current latitude of the center and calculate the new latitude of the center. If these are not equal, I move the image with map.setCenter. Looking closer at values that occurred during the endless recursion, I found new and old latitude values like this: old: 9.00000071 new: 9.00000074 and then on the recursed call to checkBounds() it then did those two in reverse: old: 9.00000074 new: 9.00000071 and so on back and forth forever. The fix is easy. When checking if I should recenter the image, instead of checking those two values for simple equality, I check to see if the difference is greater than, say, 0.0001 since for my purposes, that's "equal enough" to avoid moving the map. With that in place, no endless recursion. Thanks for taking a look! Dave --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Maps API" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/Google-Maps-API?hl=en -~----------~----~----~----~------~----~------~--~---
