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
+15
-4
@@ -62,6 +62,13 @@ ol.Overlay = function(options) {
|
|||||||
|
|
||||||
goog.base(this);
|
goog.base(this);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
* @type {boolean}
|
||||||
|
*/
|
||||||
|
this.insertFirst_ = goog.isDef(options.insertFirst) ?
|
||||||
|
options.insertFirst : false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
@@ -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