Add autoPan option to ol.Overlay

This commit is contained in:
tsauerwein
2015-02-19 17:41:09 +01:00
parent eb1a46cf7d
commit e46e0f85fb
4 changed files with 181 additions and 5 deletions

View File

@@ -29,9 +29,12 @@ closer.onclick = function() {
/**
* Create an overlay to anchor the popup to the map.
*/
var overlay = new ol.Overlay({
element: container
});
var overlay = new ol.Overlay(/** @type {olx.OverlayOptions} */ ({
element: container,
autoPanAnimation: {
duration: 250
}
}));
/**
@@ -60,7 +63,7 @@ var map = new ol.Map({
/**
* Add a click handler to the map to render the popup.
*/
map.on('click', function(evt) {
map.on('singleclick', function(evt) {
var coordinate = evt.coordinate;
var hdms = ol.coordinate.toStringHDMS(ol.proj.transform(
coordinate, 'EPSG:3857', 'EPSG:4326'));