Make ol.Overlay always call setPositioning
This commit is contained in:
+9
-7
@@ -139,13 +139,13 @@ ol.Overlay = function(options) {
|
|||||||
|
|
||||||
this.setOffset(goog.isDef(options.offset) ? options.offset : [0, 0]);
|
this.setOffset(goog.isDef(options.offset) ? options.offset : [0, 0]);
|
||||||
|
|
||||||
|
this.setPositioning(goog.isDef(options.positioning) ?
|
||||||
|
/** @type {ol.OverlayPositioning} */ (options.positioning) :
|
||||||
|
ol.OverlayPositioning.TOP_LEFT);
|
||||||
|
|
||||||
if (goog.isDef(options.position)) {
|
if (goog.isDef(options.position)) {
|
||||||
this.setPosition(options.position);
|
this.setPosition(options.position);
|
||||||
}
|
}
|
||||||
if (goog.isDef(options.positioning)) {
|
|
||||||
this.setPositioning(
|
|
||||||
/** @type {ol.OverlayPositioning} */ (options.positioning));
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
};
|
||||||
goog.inherits(ol.Overlay, ol.Object);
|
goog.inherits(ol.Overlay, ol.Object);
|
||||||
@@ -218,13 +218,13 @@ goog.exportProperty(
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the current positioning of this overlay.
|
* Get the current positioning of this overlay.
|
||||||
* @return {ol.OverlayPositioning|undefined} How the overlay is positioned
|
* @return {ol.OverlayPositioning} How the overlay is positioned
|
||||||
* relative to its point on the map.
|
* relative to its point on the map.
|
||||||
* @todo observable
|
* @todo observable
|
||||||
* @todo api
|
* @todo api
|
||||||
*/
|
*/
|
||||||
ol.Overlay.prototype.getPositioning = function() {
|
ol.Overlay.prototype.getPositioning = function() {
|
||||||
return /** @type {ol.OverlayPositioning|undefined} */ (
|
return /** @type {ol.OverlayPositioning} */ (
|
||||||
this.get(ol.OverlayProperty.POSITIONING));
|
this.get(ol.OverlayProperty.POSITIONING));
|
||||||
};
|
};
|
||||||
goog.exportProperty(
|
goog.exportProperty(
|
||||||
@@ -366,7 +366,7 @@ goog.exportProperty(
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the positioning for this overlay.
|
* Set the positioning for this overlay.
|
||||||
* @param {ol.OverlayPositioning|undefined} positioning how the overlay is
|
* @param {ol.OverlayPositioning} positioning how the overlay is
|
||||||
* positioned relative to its point on the map.
|
* positioned relative to its point on the map.
|
||||||
* @todo observable
|
* @todo observable
|
||||||
* @todo api
|
* @todo api
|
||||||
@@ -403,6 +403,8 @@ ol.Overlay.prototype.updatePixelPosition_ = function() {
|
|||||||
var offset = this.getOffset();
|
var offset = this.getOffset();
|
||||||
goog.asserts.assert(goog.isArray(offset));
|
goog.asserts.assert(goog.isArray(offset));
|
||||||
var positioning = this.getPositioning();
|
var positioning = this.getPositioning();
|
||||||
|
goog.asserts.assert(goog.isDef(positioning));
|
||||||
|
|
||||||
if (positioning == ol.OverlayPositioning.BOTTOM_RIGHT ||
|
if (positioning == ol.OverlayPositioning.BOTTOM_RIGHT ||
|
||||||
positioning == ol.OverlayPositioning.CENTER_RIGHT ||
|
positioning == ol.OverlayPositioning.CENTER_RIGHT ||
|
||||||
positioning == ol.OverlayPositioning.TOP_RIGHT) {
|
positioning == ol.OverlayPositioning.TOP_RIGHT) {
|
||||||
|
|||||||
Reference in New Issue
Block a user