简体   繁体   中英

OpenLayers MouseUp Event - Mouse Still Drags Map

I register a mouse up event with an open layers map and the event gets fired when I do a mouse up, but the map keeps moving with the mouse. For some reason registering this event caused the map to keep panning after I do a mouse up.

Here is the function:

var refreshCities = function(evt) { 
                       console.log("refreshing cities list"); 
                    };

Here is the event registration:

CitiesDisplay.events.register("mouseup", null, refreshCities);

After I saw this problem I tested the other types of events ("mousedown", "click", ...) but they don't have the same problem. I haven't found anything else online in solving this problem. Thank you for any help.

I solved the problem. I needed to be registering this type of event: "moveend". Here is what would be changed in the registration:

CitiesDisplay.events.register("moveend", null, refreshCities);

Now everything seems to work as normal. This link is what helped me most: http://dev.openlayers.org/docs/files/OpenLayers/Layer-js.html#OpenLayers.Layer.events

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM