Arrange elements so we can get mouse events on controls while preventing the default (scroll) behavior on touch devices. r=elemoine (closes #3091)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@11365 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Tim Schaub
2011-02-23 17:59:37 +00:00
parent 0961132ab6
commit fa32a4a645
5 changed files with 44 additions and 32 deletions

View File

@@ -507,18 +507,27 @@ OpenLayers.Map = OpenLayers.Class({
this.viewPortDiv.className = "olMapViewport";
this.div.appendChild(this.viewPortDiv);
// the eventsDiv is where we listen for all map events
var eventsDiv = document.createElement("div");
eventsDiv.id = this.id + "_events";
eventsDiv.style.position = "absolute";
eventsDiv.style.width = "100%";
eventsDiv.style.height = "100%";
eventsDiv.style.zIndex = this.Z_INDEX_BASE.Control - 1;
this.viewPortDiv.appendChild(eventsDiv);
this.eventsDiv = eventsDiv;
this.events = new OpenLayers.Events(
this, this.eventsDiv, this.EVENT_TYPES, this.fallThrough,
{includeXY: true}
);
// the layerContainerDiv is the one that holds all the layers
id = this.id + "_OpenLayers_Container";
this.layerContainerDiv = OpenLayers.Util.createDiv(id);
this.layerContainerDiv.style.zIndex=this.Z_INDEX_BASE['Popup']-1;
this.viewPortDiv.appendChild(this.layerContainerDiv);
this.eventsDiv.appendChild(this.layerContainerDiv);
this.events = new OpenLayers.Events(this,
this.viewPortDiv,
this.EVENT_TYPES,
this.fallThrough,
{includeXY: true});
this.updateSize();
if(this.eventListeners instanceof Object) {
this.events.on(this.eventListeners);