Overlay stopEvent and insertFirst default to true

This commit is contained in:
Éric Lemoine
2013-10-30 09:49:38 +01:00
parent d7c696fc76
commit 16b817b830
6 changed files with 18 additions and 20 deletions

View File

@@ -39,7 +39,8 @@ geolocation.on('change', function() {
var marker = new ol.Overlay({
element: /** @type {Element} */ ($('<i/>').addClass('icon-flag').get(0)),
positioning: ol.OverlayPositioning.BOTTOM_LEFT
positioning: ol.OverlayPositioning.BOTTOM_LEFT,
stopEvent: false
});
map.addOverlay(marker);
// bind the marker position to the device location.

View File

@@ -65,7 +65,8 @@ var element = document.getElementById('popup');
var popup = new ol.Overlay({
element: element,
positioning: ol.OverlayPositioning.BOTTOM_CENTER
positioning: ol.OverlayPositioning.BOTTOM_CENTER,
stopEvent: false
});
map.addOverlay(popup);

View File

@@ -29,24 +29,21 @@ var pos = ol.proj.transform([16.3725, 48.208889], 'EPSG:4326', 'EPSG:3857');
var marker = new ol.Overlay({
position: pos,
positioning: ol.OverlayPositioning.CENTER_CENTER,
element: document.getElementById('marker')
element: document.getElementById('marker'),
stopEvent: false
});
map.addOverlay(marker);
// Vienna label
var vienna = new ol.Overlay({
position: pos,
element: document.getElementById('vienna'),
stopEvent: true,
insertFirst: true
element: document.getElementById('vienna')
});
map.addOverlay(vienna);
// Popup showing the position the user clicked
var popup = new ol.Overlay({
element: document.getElementById('popup'),
stopEvent: true,
insertFirst: true
element: document.getElementById('popup')
});
map.addOverlay(popup);

View File

@@ -31,9 +31,7 @@ closer.onclick = function() {
* Create an overlay to anchor the popup to the map.
*/
var overlay = new ol.Overlay({
element: container,
stopEvent: true,
insertFirst: true
element: container
});

View File

@@ -79,13 +79,14 @@
* projection.
* @property {ol.OverlayPositioning|undefined} positioning Positioning.
* @property {boolean|undefined} stopEvent Whether event propagation to the map
* should be stopped. Default is `false`.
* If `stopEvent` is `true`, the overlay is placed in the same container as
* that of the controls (`ol-overlaycontainer-stopevent`).
* 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 container div, or appended. Default is `false`.
* This is usually used in conjunction with `stopEvent: true` so the
* overlay is below controls.
* 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
*/

View File

@@ -67,13 +67,13 @@ ol.Overlay = function(options) {
* @type {boolean}
*/
this.insertFirst_ = goog.isDef(options.insertFirst) ?
options.insertFirst : false;
options.insertFirst : true;
/**
* @private
* @type {boolean}
*/
this.stopEvent_ = goog.isDef(options.stopEvent) ? options.stopEvent : false;
this.stopEvent_ = goog.isDef(options.stopEvent) ? options.stopEvent : true;
/**
* @private