Insert or append overlay based on insertFirst option
This is to fix z-index issues with overlays that pass above ol3 default controls.
This commit is contained in:
committed by
Éric Lemoine
parent
69cee6a410
commit
71097d9cfc
@@ -62,6 +62,13 @@ ol.Overlay = function(options) {
|
||||
|
||||
goog.base(this);
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.insertFirst_ = goog.isDef(options.insertFirst) ?
|
||||
options.insertFirst : false;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {boolean}
|
||||
@@ -214,10 +221,14 @@ ol.Overlay.prototype.handleMapChanged = function() {
|
||||
this.mapPostrenderListenerKey_ = goog.events.listen(map,
|
||||
ol.MapEventType.POSTRENDER, this.handleMapPostrender, false, this);
|
||||
this.updatePixelPosition_();
|
||||
goog.dom.append(/** @type {!Node} */ (
|
||||
this.stopEvent_ ? map.getOverlayContainerStopEvent() :
|
||||
map.getOverlayContainer()),
|
||||
this.element_);
|
||||
var container = this.stopEvent_ ?
|
||||
map.getOverlayContainerStopEvent() : map.getOverlayContainer();
|
||||
if (this.insertFirst_) {
|
||||
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