Rename ol.OverlayPositioning to ol.Overlay.Positioning

This commit is contained in:
Frederic Junod
2016-08-29 12:22:40 +02:00
committed by Tim Schaub
parent 556e443705
commit 7df8b2bb2b
4 changed files with 40 additions and 41 deletions

View File

@@ -16,6 +16,7 @@ A number of internal types have been renamed. This will not affect those who us
* rename `ol.DeviceOrientationProperty` to `ol.DeviceOrientation.Property`
* rename `ol.GeolocationProperty` to `ol.Geolocation.Property`
* rename `ol.OverlayProperty` to `ol.Overlay.Property`
* rename `ol.OverlayPositioning` to `ol.Overlay.Positioning`
### v3.18.0

View File

@@ -308,7 +308,7 @@ olx.MapOptions.prototype.view;
* element: (Element|undefined),
* offset: (Array.<number>|undefined),
* position: (ol.Coordinate|undefined),
* positioning: (ol.OverlayPositioning|string|undefined),
* positioning: (ol.Overlay.Positioning|string|undefined),
* stopEvent: (boolean|undefined),
* insertFirst: (boolean|undefined),
* autoPan: (boolean|undefined),
@@ -359,7 +359,7 @@ olx.OverlayOptions.prototype.position;
* property. Possible values are `'bottom-left'`, `'bottom-center'`,
* `'bottom-right'`, `'center-left'`, `'center-center'`, `'center-right'`,
* `'top-left'`, `'top-center'`, and `'top-right'`. Default is `'top-left'`.
* @type {ol.OverlayPositioning|string|undefined}
* @type {ol.Overlay.Positioning|string|undefined}
* @api stable
*/
olx.OverlayOptions.prototype.positioning;

View File

@@ -8,7 +8,6 @@ goog.require('ol.MapProperty');
goog.require('ol.Object');
goog.require('ol.ObjectEventType');
goog.require('ol.Overlay');
goog.require('ol.OverlayPositioning');
goog.require('ol.View');
goog.require('ol.control.Control');
goog.require('ol.coordinate');
@@ -124,7 +123,7 @@ ol.control.OverviewMap = function(opt_options) {
*/
this.boxOverlay_ = new ol.Overlay({
position: [0, 0],
positioning: ol.OverlayPositioning.BOTTOM_LEFT,
positioning: ol.Overlay.Positioning.BOTTOM_LEFT,
element: box
});
this.ovmap_.addOverlay(this.boxOverlay_);

View File

@@ -1,5 +1,4 @@
goog.provide('ol.Overlay');
goog.provide('ol.OverlayPositioning');
goog.require('ol');
goog.require('ol.events');
@@ -10,25 +9,6 @@ goog.require('ol.dom');
goog.require('ol.extent');
/**
* Overlay position: `'bottom-left'`, `'bottom-center'`, `'bottom-right'`,
* `'center-left'`, `'center-center'`, `'center-right'`, `'top-left'`,
* `'top-center'`, `'top-right'`
* @enum {string}
*/
ol.OverlayPositioning = {
BOTTOM_LEFT: 'bottom-left',
BOTTOM_CENTER: 'bottom-center',
BOTTOM_RIGHT: 'bottom-right',
CENTER_LEFT: 'center-left',
CENTER_CENTER: 'center-center',
CENTER_RIGHT: 'center-right',
TOP_LEFT: 'top-left',
TOP_CENTER: 'top-center',
TOP_RIGHT: 'top-right'
};
/**
* @classdesc
* An element to be displayed over the map and attached to a single map
@@ -150,8 +130,8 @@ ol.Overlay = function(options) {
this.setOffset(options.offset !== undefined ? options.offset : [0, 0]);
this.setPositioning(options.positioning !== undefined ?
/** @type {ol.OverlayPositioning} */ (options.positioning) :
ol.OverlayPositioning.TOP_LEFT);
/** @type {ol.Overlay.Positioning} */ (options.positioning) :
ol.Overlay.Positioning.TOP_LEFT);
if (options.position !== undefined) {
this.setPosition(options.position);
@@ -222,13 +202,13 @@ ol.Overlay.prototype.getPosition = function() {
/**
* Get the current positioning of this overlay.
* @return {ol.OverlayPositioning} How the overlay is positioned
* @return {ol.Overlay.Positioning} How the overlay is positioned
* relative to its point on the map.
* @observable
* @api stable
*/
ol.Overlay.prototype.getPositioning = function() {
return /** @type {ol.OverlayPositioning} */ (
return /** @type {ol.Overlay.Positioning} */ (
this.get(ol.Overlay.Property.POSITIONING));
};
@@ -432,7 +412,7 @@ ol.Overlay.prototype.getRect_ = function(element, size) {
/**
* Set the positioning for this overlay.
* @param {ol.OverlayPositioning} positioning how the overlay is
* @param {ol.Overlay.Positioning} positioning how the overlay is
* positioned relative to its point on the map.
* @observable
* @api stable
@@ -488,9 +468,9 @@ ol.Overlay.prototype.updateRenderedPosition = function(pixel, mapSize) {
var offsetX = offset[0];
var offsetY = offset[1];
if (positioning == ol.OverlayPositioning.BOTTOM_RIGHT ||
positioning == ol.OverlayPositioning.CENTER_RIGHT ||
positioning == ol.OverlayPositioning.TOP_RIGHT) {
if (positioning == ol.Overlay.Positioning.BOTTOM_RIGHT ||
positioning == ol.Overlay.Positioning.CENTER_RIGHT ||
positioning == ol.Overlay.Positioning.TOP_RIGHT) {
if (this.rendered_.left_ !== '') {
this.rendered_.left_ = style.left = '';
}
@@ -502,9 +482,9 @@ ol.Overlay.prototype.updateRenderedPosition = function(pixel, mapSize) {
if (this.rendered_.right_ !== '') {
this.rendered_.right_ = style.right = '';
}
if (positioning == ol.OverlayPositioning.BOTTOM_CENTER ||
positioning == ol.OverlayPositioning.CENTER_CENTER ||
positioning == ol.OverlayPositioning.TOP_CENTER) {
if (positioning == ol.Overlay.Positioning.BOTTOM_CENTER ||
positioning == ol.Overlay.Positioning.CENTER_CENTER ||
positioning == ol.Overlay.Positioning.TOP_CENTER) {
offsetX -= this.element_.offsetWidth / 2;
}
var left = Math.round(pixel[0] + offsetX) + 'px';
@@ -512,9 +492,9 @@ ol.Overlay.prototype.updateRenderedPosition = function(pixel, mapSize) {
this.rendered_.left_ = style.left = left;
}
}
if (positioning == ol.OverlayPositioning.BOTTOM_LEFT ||
positioning == ol.OverlayPositioning.BOTTOM_CENTER ||
positioning == ol.OverlayPositioning.BOTTOM_RIGHT) {
if (positioning == ol.Overlay.Positioning.BOTTOM_LEFT ||
positioning == ol.Overlay.Positioning.BOTTOM_CENTER ||
positioning == ol.Overlay.Positioning.BOTTOM_RIGHT) {
if (this.rendered_.top_ !== '') {
this.rendered_.top_ = style.top = '';
}
@@ -526,9 +506,9 @@ ol.Overlay.prototype.updateRenderedPosition = function(pixel, mapSize) {
if (this.rendered_.bottom_ !== '') {
this.rendered_.bottom_ = style.bottom = '';
}
if (positioning == ol.OverlayPositioning.CENTER_LEFT ||
positioning == ol.OverlayPositioning.CENTER_CENTER ||
positioning == ol.OverlayPositioning.CENTER_RIGHT) {
if (positioning == ol.Overlay.Positioning.CENTER_LEFT ||
positioning == ol.Overlay.Positioning.CENTER_CENTER ||
positioning == ol.Overlay.Positioning.CENTER_RIGHT) {
offsetY -= this.element_.offsetHeight / 2;
}
var top = Math.round(pixel[1] + offsetY) + 'px';
@@ -541,6 +521,25 @@ ol.Overlay.prototype.updateRenderedPosition = function(pixel, mapSize) {
};
/**
* Overlay position: `'bottom-left'`, `'bottom-center'`, `'bottom-right'`,
* `'center-left'`, `'center-center'`, `'center-right'`, `'top-left'`,
* `'top-center'`, `'top-right'`
* @enum {string}
*/
ol.Overlay.Positioning = {
BOTTOM_LEFT: 'bottom-left',
BOTTOM_CENTER: 'bottom-center',
BOTTOM_RIGHT: 'bottom-right',
CENTER_LEFT: 'center-left',
CENTER_CENTER: 'center-center',
CENTER_RIGHT: 'center-right',
TOP_LEFT: 'top-left',
TOP_CENTER: 'top-center',
TOP_RIGHT: 'top-right'
};
/**
* @enum {string}
*/