Merge pull request #1122 from bbinet/fix-zindex-issues
Fix overlay zindex issues
This commit is contained in:
@@ -39,7 +39,8 @@ geolocation.on('change', function() {
|
|||||||
|
|
||||||
var marker = new ol.Overlay({
|
var marker = new ol.Overlay({
|
||||||
element: /** @type {Element} */ ($('<i/>').addClass('icon-flag').get(0)),
|
element: /** @type {Element} */ ($('<i/>').addClass('icon-flag').get(0)),
|
||||||
positioning: ol.OverlayPositioning.BOTTOM_LEFT
|
positioning: ol.OverlayPositioning.BOTTOM_LEFT,
|
||||||
|
stopEvent: false
|
||||||
});
|
});
|
||||||
map.addOverlay(marker);
|
map.addOverlay(marker);
|
||||||
// bind the marker position to the device location.
|
// bind the marker position to the device location.
|
||||||
|
|||||||
@@ -65,7 +65,8 @@ var element = document.getElementById('popup');
|
|||||||
|
|
||||||
var popup = new ol.Overlay({
|
var popup = new ol.Overlay({
|
||||||
element: element,
|
element: element,
|
||||||
positioning: ol.OverlayPositioning.BOTTOM_CENTER
|
positioning: ol.OverlayPositioning.BOTTOM_CENTER,
|
||||||
|
stopEvent: false
|
||||||
});
|
});
|
||||||
map.addOverlay(popup);
|
map.addOverlay(popup);
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,9 @@
|
|||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
text-shadow: black 0.1em 0.1em 0.2em;
|
text-shadow: black 0.1em 0.1em 0.2em;
|
||||||
}
|
}
|
||||||
|
.popover {
|
||||||
|
z-index: auto;
|
||||||
|
}
|
||||||
.popover-content {
|
.popover-content {
|
||||||
min-width: 180px;
|
min-width: 180px;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,22 +29,21 @@ var pos = ol.proj.transform([16.3725, 48.208889], 'EPSG:4326', 'EPSG:3857');
|
|||||||
var marker = new ol.Overlay({
|
var marker = new ol.Overlay({
|
||||||
position: pos,
|
position: pos,
|
||||||
positioning: ol.OverlayPositioning.CENTER_CENTER,
|
positioning: ol.OverlayPositioning.CENTER_CENTER,
|
||||||
element: document.getElementById('marker')
|
element: document.getElementById('marker'),
|
||||||
|
stopEvent: false
|
||||||
});
|
});
|
||||||
map.addOverlay(marker);
|
map.addOverlay(marker);
|
||||||
|
|
||||||
// Vienna label
|
// Vienna label
|
||||||
var vienna = new ol.Overlay({
|
var vienna = new ol.Overlay({
|
||||||
position: pos,
|
position: pos,
|
||||||
element: document.getElementById('vienna'),
|
element: document.getElementById('vienna')
|
||||||
stopEvent: true
|
|
||||||
});
|
});
|
||||||
map.addOverlay(vienna);
|
map.addOverlay(vienna);
|
||||||
|
|
||||||
// Popup showing the position the user clicked
|
// Popup showing the position the user clicked
|
||||||
var popup = new ol.Overlay({
|
var popup = new ol.Overlay({
|
||||||
element: document.getElementById('popup'),
|
element: document.getElementById('popup')
|
||||||
stopEvent: true
|
|
||||||
});
|
});
|
||||||
map.addOverlay(popup);
|
map.addOverlay(popup);
|
||||||
|
|
||||||
|
|||||||
@@ -31,8 +31,7 @@ closer.onclick = function() {
|
|||||||
* Create an overlay to anchor the popup to the map.
|
* Create an overlay to anchor the popup to the map.
|
||||||
*/
|
*/
|
||||||
var overlay = new ol.Overlay({
|
var overlay = new ol.Overlay({
|
||||||
element: container,
|
element: container
|
||||||
stopEvent: true
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -79,7 +79,14 @@
|
|||||||
* projection.
|
* projection.
|
||||||
* @property {ol.OverlayPositioning|undefined} positioning Positioning.
|
* @property {ol.OverlayPositioning|undefined} positioning Positioning.
|
||||||
* @property {boolean|undefined} stopEvent Whether event propagation to the map
|
* @property {boolean|undefined} stopEvent Whether event propagation to the map
|
||||||
* should be stopped. Default is `false`.
|
* viewport should be stopped. Default is `true`. If `true` the overlay is
|
||||||
|
* placed in the same container as that of the controls
|
||||||
|
* (`ol-overlaycontainer-stopevent`).
|
||||||
|
* @property {boolean|undefined} insertFirst Whether the overlay is inserted
|
||||||
|
* first in the overlay container, or appended. Default is `true`. If the
|
||||||
|
* overlay is placed in the same container as that of the controls (see
|
||||||
|
* the `stopEvent` option) you will probably set `insertFirst` to `true`
|
||||||
|
* so the overlay is displayed below the controls.
|
||||||
* @todo stability experimental
|
* @todo stability experimental
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@@ -66,7 +66,14 @@ ol.Overlay = function(options) {
|
|||||||
* @private
|
* @private
|
||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
*/
|
*/
|
||||||
this.stopEvent_ = goog.isDef(options.stopEvent) ? options.stopEvent : false;
|
this.insertFirst_ = goog.isDef(options.insertFirst) ?
|
||||||
|
options.insertFirst : true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
* @type {boolean}
|
||||||
|
*/
|
||||||
|
this.stopEvent_ = goog.isDef(options.stopEvent) ? options.stopEvent : true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
@@ -214,10 +221,14 @@ ol.Overlay.prototype.handleMapChanged = function() {
|
|||||||
this.mapPostrenderListenerKey_ = goog.events.listen(map,
|
this.mapPostrenderListenerKey_ = goog.events.listen(map,
|
||||||
ol.MapEventType.POSTRENDER, this.handleMapPostrender, false, this);
|
ol.MapEventType.POSTRENDER, this.handleMapPostrender, false, this);
|
||||||
this.updatePixelPosition_();
|
this.updatePixelPosition_();
|
||||||
goog.dom.append(/** @type {!Node} */ (
|
var container = this.stopEvent_ ?
|
||||||
this.stopEvent_ ? map.getOverlayContainerStopEvent() :
|
map.getOverlayContainerStopEvent() : map.getOverlayContainer();
|
||||||
map.getOverlayContainer()),
|
if (this.insertFirst_) {
|
||||||
this.element_);
|
goog.dom.insertChildAt(/** @type {!Element} */ (
|
||||||
|
container), this.element_, 0);
|
||||||
|
} else {
|
||||||
|
goog.dom.append(/** @type {!Node} */ (container), this.element_);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user