Hello Andrew,

I was able to resolve the problem, check out the following example,
should work right?

<html>
        <head>
                <script type="text/javascript" src="http://www.google.com/maps?
oe=utf-8&file=api&v=2&key=<INSERT KEY>&client=<INSERT CLIENT>"></
script>
                <script type="text/javascript">
                        var map;
                        var prevCenter;
                        var blockMove = false;

                        function Load(){
                                map = new 
GMap2(document.getElementById('application'),
                                {
                                        size: new GSize(600, 400)
                                } );

                                map.addControl(new GLargeMapControl3D());

                                var copyright = new 
GCopyrightCollection('Demo');
                                var layer = new GTileLayer(copyright, 13, 18);

                                var type = new GMapType([ 
G_HYBRID_MAP.getTileLayers()[0],
layer ], new GMercatorProjection(20), 'Layer', {
                                        maxResolution: 18,
                                        minResolution: 13
                                } );

                                map.addMapType(type);
                                map.setMapType(type);

                                map.setCenter(new GLatLng(43.56, -79.97), 14);

                                map.addOverlay(new GMarker(new GLatLng(43.5018, 
-80.0169)));
                                map.addOverlay(new GMarker(new GLatLng(43.5905, 
-79.8939)));

                                GEvent.addListener(map, 'move', onMove);
                                GEvent.addListener(map, 'moveend', onMoveEnd);
                        }

                        function onMove() {
                                if (blockMove == false) {
                                        var bounds = map.getBounds();
                                        var southWest = bounds.getSouthWest();
                                        var northEast = bounds.getNorthEast();

                                        if (southWest.lat() < 43.5018 ||
                                                northEast.lat() > 43.5905 ||
                                                southWest.lng() < -80.0169 ||
                                                northEast.lng() > -79.8939) {
                                                blockMove = true;
                                        }
                                        else {
                                                map.savePosition();
                                        }
                                }
                        }

                        function onMoveEnd() {
                                if (blockMove == true) {
                                        map.returnToSavedPosition();
                                }
                                blockMove = false;
                        }
                </script>
        </head>
        <body onload="Load()" onunload="GUnload()">
                <div id="application"></div>
        </body>
</html>

On Jul 22, 7:58 am, Andrew Leach <[email protected]>
wrote:
> On Jul 22, 12:54 pm, netski <[email protected]> wrote:
>
> > seems like a good idea, but the move event actually moves the map as
> > well for each move event even if my condition is false (meaning don't
> > move). SO I would need to call setCenter 299 times more than I would
> > need to to cancel the event.
>
> Don't understand that. A link to your map would help.
>
> Andrew
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to