Add offsetX and offsetY config options for ol.Overlay
This commit is contained in:
@@ -81,6 +81,18 @@ ol.Overlay = function(options) {
|
||||
*/
|
||||
this.stopEvent_ = goog.isDef(options.stopEvent) ? options.stopEvent : true;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
this.offsetX_ = goog.isDef(options.offsetX) ? options.offsetX : 0;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
this.offsetY_ = goog.isDef(options.offsetY) ? options.offsetY : 0;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {Element}
|
||||
@@ -355,7 +367,7 @@ ol.Overlay.prototype.updatePixelPosition_ = function() {
|
||||
if (this.rendered_.right_ !== '') {
|
||||
this.rendered_.right_ = style.right = '';
|
||||
}
|
||||
var offsetX = 0;
|
||||
var offsetX = -this.offsetX_;
|
||||
if (positioning == ol.OverlayPositioning.BOTTOM_CENTER ||
|
||||
positioning == ol.OverlayPositioning.CENTER_CENTER ||
|
||||
positioning == ol.OverlayPositioning.TOP_CENTER) {
|
||||
@@ -380,7 +392,7 @@ ol.Overlay.prototype.updatePixelPosition_ = function() {
|
||||
if (this.rendered_.bottom_ !== '') {
|
||||
this.rendered_.bottom_ = style.bottom = '';
|
||||
}
|
||||
var offsetY = 0;
|
||||
var offsetY = -this.offsetY_;
|
||||
if (positioning == ol.OverlayPositioning.CENTER_LEFT ||
|
||||
positioning == ol.OverlayPositioning.CENTER_CENTER ||
|
||||
positioning == ol.OverlayPositioning.CENTER_RIGHT) {
|
||||
|
||||
Reference in New Issue
Block a user