Merge remote-tracking branch 'openlayers/master' into vector-api
This commit is contained in:
@@ -320,7 +320,7 @@
|
||||
* modifier (i.e. Shift key) that determines if the interaction is active
|
||||
* or not, default is no modifiers.
|
||||
* @property {number|undefined} pixelDelta Pixel The amount to pan on each key
|
||||
* press
|
||||
* press. Default is `128` pixels.
|
||||
* @todo stability experimental
|
||||
*/
|
||||
|
||||
@@ -330,7 +330,7 @@
|
||||
* @property {ol.events.ConditionType|undefined} condition A conditional
|
||||
* modifier (i.e. Shift key) that determines if the interaction is active
|
||||
* or not, default is no modifiers.
|
||||
* @property {number|undefined} delta The amount to zoom on each key press.
|
||||
* @property {number|undefined} delta The amount to zoom on each key press. Default is `1`.
|
||||
* @todo stability experimental
|
||||
*/
|
||||
|
||||
@@ -349,7 +349,8 @@
|
||||
|
||||
/**
|
||||
* @typedef {Object} ol.interaction.TouchRotateOptions
|
||||
* @property {number|undefined} threshold Minimal angle to start a rotation.
|
||||
* @property {number|undefined} threshold Minimal angle in radians to start a rotation.
|
||||
* Default is `0.3`.
|
||||
* @todo stability experimental
|
||||
*/
|
||||
|
||||
@@ -361,12 +362,12 @@
|
||||
|
||||
/**
|
||||
* @typedef {Object} ol.layer.BaseOptions
|
||||
* @property {number|undefined} brightness Brightness.
|
||||
* @property {number|undefined} contrast Contrast.
|
||||
* @property {number|undefined} hue Hue.
|
||||
* @property {number|undefined} opacity Opacity.
|
||||
* @property {number|undefined} saturation Saturation.
|
||||
* @property {boolean|undefined} visible Visibility.
|
||||
* @property {number|undefined} brightness Brightness. Default is `0`.
|
||||
* @property {number|undefined} contrast Contrast. Default is `1`.
|
||||
* @property {number|undefined} hue Hue. Default is `0`.
|
||||
* @property {number|undefined} opacity Opacity (0, 1). Default is `1`.
|
||||
* @property {number|undefined} saturation Saturation. Default is `1`.
|
||||
* @property {boolean|undefined} visible Visibility. Default is `true`.
|
||||
* @property {number|undefined} minResolution The minimum resolution
|
||||
* (inclusive) at which this layer will be visible.
|
||||
* @property {number|undefined} maxResolution The maximum resolution
|
||||
@@ -376,11 +377,11 @@
|
||||
|
||||
/**
|
||||
* @typedef {Object} ol.layer.LayerOptions
|
||||
* @property {number|undefined} brightness Brightness.
|
||||
* @property {number|undefined} contrast Contrast.
|
||||
* @property {number|undefined} hue Hue.
|
||||
* @property {number|undefined} opacity Opacity. 0-1. Default is `1`.
|
||||
* @property {number|undefined} saturation Saturation.
|
||||
* @property {number|undefined} brightness Brightness. Default is `0`.
|
||||
* @property {number|undefined} contrast Contrast. Default is `1`.
|
||||
* @property {number|undefined} hue Hue. Default is `0`.
|
||||
* @property {number|undefined} opacity Opacity (0, 1). Default is `1`.
|
||||
* @property {number|undefined} saturation Saturation. Default is `1`.
|
||||
* @property {ol.source.Source} source Source for this layer.
|
||||
* @property {boolean|undefined} visible Visibility. Default is `true` (visible).
|
||||
* @property {number|undefined} minResolution The minimum resolution
|
||||
@@ -392,12 +393,12 @@
|
||||
|
||||
/**
|
||||
* @typedef {Object} ol.layer.GroupOptions
|
||||
* @property {number|undefined} brightness Brightness.
|
||||
* @property {number|undefined} contrast Contrast.
|
||||
* @property {number|undefined} hue Hue.
|
||||
* @property {number|undefined} opacity Opacity.
|
||||
* @property {number|undefined} saturation Saturation.
|
||||
* @property {boolean|undefined} visible Visibility.
|
||||
* @property {number|undefined} brightness Brightness. Default is `0`.
|
||||
* @property {number|undefined} contrast Contrast. Default is `1`.
|
||||
* @property {number|undefined} hue Hue. Default is `0`.
|
||||
* @property {number|undefined} opacity Opacity (0, 1). Default is `1`.
|
||||
* @property {number|undefined} saturation Saturation. Default is `1`.
|
||||
* @property {boolean|undefined} visible Visibility. Default is `true`.
|
||||
* @property {number|undefined} minResolution The minimum resolution
|
||||
* (inclusive) at which this layer will be visible.
|
||||
* @property {number|undefined} maxResolution The maximum resolution
|
||||
@@ -408,12 +409,12 @@
|
||||
|
||||
/**
|
||||
* @typedef {Object} ol.layer.TileOptions
|
||||
* @property {number|undefined} brightness Brightness.
|
||||
* @property {number|undefined} contrast Contrast.
|
||||
* @property {number|undefined} hue Hue.
|
||||
* @property {number|undefined} opacity Opacity. 0-1. Default is `1`.
|
||||
* @property {number|undefined} brightness Brightness. Default is `0`.
|
||||
* @property {number|undefined} contrast Contrast. Default is `1`.
|
||||
* @property {number|undefined} hue Hue. Default is `0`.
|
||||
* @property {number|undefined} opacity Opacity (0, 1). Default is `1`.
|
||||
* @property {number|undefined} preload Preload.
|
||||
* @property {number|undefined} saturation Saturation.
|
||||
* @property {number|undefined} saturation Saturation. Default is `1`.
|
||||
* @property {ol.source.Source} source Source for this layer.
|
||||
* @property {boolean|undefined} visible Visibility. Default is `true` (visible).
|
||||
* @property {number|undefined} minResolution The minimum resolution
|
||||
@@ -441,7 +442,7 @@
|
||||
|
||||
/**
|
||||
* @typedef {Object} ol.source.BingMapsOptions
|
||||
* @property {string|undefined} culture Culture.
|
||||
* @property {string|undefined} culture Culture code. Default is `en-us`.
|
||||
* @property {string} key Bing Maps API key. Get yours at
|
||||
* http://bingmapsportal.com/.
|
||||
* @property {string} imagerySet Type of imagery.
|
||||
@@ -481,7 +482,9 @@
|
||||
* @property {number|undefined} maxZoom Max zoom.
|
||||
* @property {ol.TileLoadFunctionType|undefined} tileLoadFunction Optional
|
||||
* function to load a tile given a URL.
|
||||
* @property {string|undefined} url URL.
|
||||
* @property {string|undefined} url URL template. Must include `{x}`, `{y}`,
|
||||
* and `{z}` placeholders. Default is
|
||||
* `http://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png`.
|
||||
* @todo stability experimental
|
||||
*/
|
||||
|
||||
@@ -513,7 +516,8 @@
|
||||
* @property {boolean|undefined} opaque Whether the layer is opaque.
|
||||
* @property {ol.TileLoadFunctionType|undefined} tileLoadFunction Optional
|
||||
* function to load a tile given a URL.
|
||||
* @property {string|undefined} url URL.
|
||||
* @property {string|undefined} url URL template. Must include `{x}`, `{y}`,
|
||||
* and `{z}` placeholders.
|
||||
* @todo stability experimental
|
||||
*/
|
||||
|
||||
@@ -536,7 +540,7 @@
|
||||
* requests.
|
||||
* @property {ol.TileLoadFunctionType|undefined} tileLoadFunction Optional
|
||||
* function to load a tile given a URL.
|
||||
* @property {string} url URL.
|
||||
* @property {string} url URL to the TileJSON file.
|
||||
* @todo stability experimental
|
||||
*/
|
||||
|
||||
@@ -604,7 +608,7 @@
|
||||
* requests.
|
||||
* @property {ol.Extent|undefined} extent Extent.
|
||||
* @property {string|undefined} logo Logo.
|
||||
* @property {ol.proj.ProjectionLike} projection Projection.
|
||||
* @property {ol.proj.ProjectionLike} projection Projection. Default is `EPSG:3857`.
|
||||
* @property {number|undefined} maxZoom Optional max zoom level. Default is `18`.
|
||||
* @property {number|undefined} minZoom Unsupported (TODO: remove this).
|
||||
* @property {ol.TileLoadFunctionType|undefined} tileLoadFunction Optional
|
||||
|
||||
@@ -40,8 +40,8 @@ ol.control.MousePositionProperty = {
|
||||
* @todo stability experimental
|
||||
* @todo observable projection {ol.proj.Projection} the projection to report
|
||||
* mouse position in
|
||||
* @todo observable coordinateFormat {string} the format to render the current
|
||||
* position in
|
||||
* @todo observable coordinateFormat {ol.CoordinateFormatType} the format to
|
||||
* render the current position in
|
||||
*/
|
||||
ol.control.MousePosition = function(opt_options) {
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// FIXME works for View2D only
|
||||
// FIXME should possibly show tooltip when dragging?
|
||||
// FIXME should possibly be adjustable by clicking on container
|
||||
|
||||
goog.provide('ol.control.ZoomSlider');
|
||||
|
||||
@@ -9,6 +8,7 @@ goog.require('goog.asserts');
|
||||
goog.require('goog.dom');
|
||||
goog.require('goog.dom.TagName');
|
||||
goog.require('goog.events');
|
||||
goog.require('goog.events.Event');
|
||||
goog.require('goog.events.EventType');
|
||||
goog.require('goog.fx.Dragger');
|
||||
goog.require('goog.fx.Dragger.EventType');
|
||||
@@ -68,29 +68,32 @@ ol.control.ZoomSlider = function(opt_options) {
|
||||
*/
|
||||
this.sliderInitialized_ = false;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {Array.<?number>}
|
||||
*/
|
||||
this.draggerListenerKeys_ = null;
|
||||
|
||||
var className = goog.isDef(options.className) ?
|
||||
options.className : 'ol-zoomslider';
|
||||
var sliderCssCls = className + ' ' + ol.css.CLASS_UNSELECTABLE;
|
||||
var thumbCssCls = className + '-thumb' + ' ' + ol.css.CLASS_UNSELECTABLE;
|
||||
var element = goog.dom.createDom(goog.dom.TagName.DIV, sliderCssCls,
|
||||
goog.dom.createDom(goog.dom.TagName.DIV, thumbCssCls));
|
||||
var thumbElement = goog.dom.createDom(goog.dom.TagName.DIV,
|
||||
[className + '-thumb', ol.css.CLASS_UNSELECTABLE]);
|
||||
var sliderElement = goog.dom.createDom(goog.dom.TagName.DIV,
|
||||
[className, ol.css.CLASS_UNSELECTABLE], thumbElement);
|
||||
|
||||
this.dragger_ = this.createDraggable_(element);
|
||||
/**
|
||||
* @type {goog.fx.Dragger}
|
||||
* @private
|
||||
*/
|
||||
this.dragger_ = new goog.fx.Dragger(thumbElement);
|
||||
this.registerDisposable(this.dragger_);
|
||||
|
||||
// FIXME currently only a do nothing function is bound.
|
||||
goog.events.listen(element, [
|
||||
goog.events.EventType.TOUCHEND,
|
||||
goog.events.EventType.CLICK
|
||||
], this.handleContainerClick_, false, this);
|
||||
goog.events.listen(this.dragger_, [
|
||||
goog.fx.Dragger.EventType.DRAG,
|
||||
goog.fx.Dragger.EventType.END
|
||||
], this.handleSliderChange_, undefined, this);
|
||||
|
||||
goog.events.listen(sliderElement, goog.events.EventType.CLICK,
|
||||
this.handleContainerClick_, false, this);
|
||||
goog.events.listen(thumbElement, goog.events.EventType.CLICK,
|
||||
goog.events.Event.stopPropagation);
|
||||
|
||||
goog.base(this, {
|
||||
element: element
|
||||
element: sliderElement
|
||||
});
|
||||
};
|
||||
goog.inherits(ol.control.ZoomSlider, ol.control.Control);
|
||||
@@ -178,7 +181,20 @@ ol.control.ZoomSlider.prototype.handleMapPostrender = function(mapEvent) {
|
||||
* @private
|
||||
*/
|
||||
ol.control.ZoomSlider.prototype.handleContainerClick_ = function(browserEvent) {
|
||||
// TODO implement proper resolution calculation according to browserEvent
|
||||
var map = this.getMap();
|
||||
var view = map.getView().getView2D();
|
||||
var resolution;
|
||||
var amountDragged = this.amountDragged_(browserEvent.offsetX,
|
||||
browserEvent.offsetY);
|
||||
resolution = this.resolutionForAmount_(amountDragged);
|
||||
goog.asserts.assert(goog.isDef(resolution));
|
||||
map.beforeRender(ol.animation.zoom({
|
||||
resolution: resolution,
|
||||
duration: ol.control.ZOOMSLIDER_ANIMATION_DURATION,
|
||||
easing: ol.easing.easeOut
|
||||
}));
|
||||
resolution = view.constrainResolution(resolution);
|
||||
view.setResolution(resolution);
|
||||
};
|
||||
|
||||
|
||||
@@ -207,17 +223,18 @@ ol.control.ZoomSlider.prototype.positionThumbForResolution_ = function(res) {
|
||||
* Calculates the amount the thumb has been dragged to allow for calculation
|
||||
* of the corresponding resolution.
|
||||
*
|
||||
* @param {goog.fx.DragDropEvent} e The dragdropevent.
|
||||
* @param {number} x Pixel position relative to the left of the slider.
|
||||
* @param {number} y Pixel position relative to the top of the slider.
|
||||
* @return {number} The amount the thumb has been dragged.
|
||||
* @private
|
||||
*/
|
||||
ol.control.ZoomSlider.prototype.amountDragged_ = function(e) {
|
||||
ol.control.ZoomSlider.prototype.amountDragged_ = function(x, y) {
|
||||
var draggerLimits = this.dragger_.limits,
|
||||
amount = 0;
|
||||
if (this.direction_ === ol.control.ZoomSlider.direction.HORIZONTAL) {
|
||||
amount = (e.left - draggerLimits.left) / draggerLimits.width;
|
||||
amount = (x - draggerLimits.left) / draggerLimits.width;
|
||||
} else {
|
||||
amount = (e.top - draggerLimits.top) / draggerLimits.height;
|
||||
amount = (y - draggerLimits.top) / draggerLimits.height;
|
||||
}
|
||||
return amount;
|
||||
};
|
||||
@@ -268,7 +285,7 @@ ol.control.ZoomSlider.prototype.handleSliderChange_ = function(e) {
|
||||
var view = map.getView().getView2D();
|
||||
var resolution;
|
||||
if (e.type === goog.fx.Dragger.EventType.DRAG) {
|
||||
var amountDragged = this.amountDragged_(e);
|
||||
var amountDragged = this.amountDragged_(e.left, e.top);
|
||||
resolution = this.resolutionForAmount_(amountDragged);
|
||||
if (resolution !== this.currentResolution_) {
|
||||
this.currentResolution_ = resolution;
|
||||
@@ -285,27 +302,3 @@ ol.control.ZoomSlider.prototype.handleSliderChange_ = function(e) {
|
||||
view.setResolution(resolution);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Actually enable draggable behaviour for the thumb of the zoomslider and bind
|
||||
* relvant event listeners.
|
||||
*
|
||||
* @param {Element} elem The element for the slider.
|
||||
* @return {goog.fx.Dragger} The actual goog.fx.Dragger instance.
|
||||
* @private
|
||||
*/
|
||||
ol.control.ZoomSlider.prototype.createDraggable_ = function(elem) {
|
||||
if (!goog.isNull(this.draggerListenerKeys_)) {
|
||||
goog.array.forEach(this.draggerListenerKeys_, goog.events.unlistenByKey);
|
||||
this.draggerListenerKeys_ = null;
|
||||
}
|
||||
var dragger = new goog.fx.Dragger(elem.childNodes[0]);
|
||||
this.draggerListenerKeys_ = [
|
||||
goog.events.listen(dragger, [
|
||||
goog.fx.Dragger.EventType.DRAG,
|
||||
goog.fx.Dragger.EventType.END
|
||||
], this.handleSliderChange_, undefined, this)
|
||||
];
|
||||
return dragger;
|
||||
};
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
@exportSymbol ol.extent.boundingExtent
|
||||
@exportSymbol ol.extent.buffer
|
||||
@exportSymbol ol.extent.containsCoordinate
|
||||
@exportSymbol ol.extent.containsExtent
|
||||
@exportSymbol ol.extent.createEmpty
|
||||
|
||||
@@ -62,8 +62,9 @@ ol.GeolocationProperty = {
|
||||
* @todo observable speed {number} readonly the instantaneous speed of the
|
||||
* device in meters per second
|
||||
* @todo observable tracking {number} track the device's position.
|
||||
* @todo observable trackingOptions {number} PositionOptions as defined by the
|
||||
* HTML5 Geolocation spec at http://dev.w3.org/geo/api/spec-source.html
|
||||
* @todo observable trackingOptions {GeolocationPositionOptions} PositionOptions
|
||||
* as defined by the HTML5 Geolocation spec at
|
||||
* http://dev.w3.org/geo/api/spec-source.html
|
||||
*/
|
||||
ol.Geolocation = function(opt_options) {
|
||||
|
||||
|
||||
@@ -245,11 +245,8 @@ ol.Map = function(options) {
|
||||
goog.events.EventType.CLICK,
|
||||
goog.events.EventType.DBLCLICK,
|
||||
goog.events.EventType.MOUSEDOWN,
|
||||
goog.events.EventType.MOUSEUP,
|
||||
goog.events.EventType.TOUCHSTART,
|
||||
goog.events.EventType.TOUCHEND,
|
||||
goog.events.EventType.MSPOINTERDOWN,
|
||||
goog.events.EventType.MSPOINTERUP
|
||||
goog.events.EventType.MSPOINTERDOWN
|
||||
], goog.events.Event.stopPropagation);
|
||||
goog.dom.appendChild(this.viewport_, this.overlayContainerStopEvent_);
|
||||
|
||||
|
||||
@@ -142,7 +142,7 @@ ol.Object.getAccessors = function(obj) {
|
||||
|
||||
|
||||
/**
|
||||
* @param {string} key Key.
|
||||
* @param {string} key Key name.
|
||||
* @return {string} Change name.
|
||||
*/
|
||||
ol.Object.getChangeEventType = function(key) {
|
||||
@@ -207,7 +207,7 @@ ol.Object.getSetterName = function(key) {
|
||||
* }
|
||||
* );
|
||||
*
|
||||
* @param {string} key Key.
|
||||
* @param {string} key Key name.
|
||||
* @param {ol.Object} target Target.
|
||||
* @param {string=} opt_targetKey Target key.
|
||||
* @return {ol.ObjectAccessor}
|
||||
@@ -231,7 +231,7 @@ ol.Object.prototype.bindTo = function(key, target, opt_targetKey) {
|
||||
|
||||
/**
|
||||
* Gets a value.
|
||||
* @param {string} key Key.
|
||||
* @param {string} key Key name.
|
||||
* @return {*} Value.
|
||||
* @todo stability experimental
|
||||
*/
|
||||
@@ -291,7 +291,7 @@ ol.Object.prototype.getKeys = function() {
|
||||
* Notify all observers of a change on this property. This notifies both
|
||||
* objects that are bound to the object's property as well as the object
|
||||
* that it is bound to.
|
||||
* @param {string} key Key.
|
||||
* @param {string} key Key name.
|
||||
* @todo stability experimental
|
||||
*/
|
||||
ol.Object.prototype.notify = function(key) {
|
||||
@@ -308,7 +308,7 @@ ol.Object.prototype.notify = function(key) {
|
||||
|
||||
|
||||
/**
|
||||
* @param {string} key Key.
|
||||
* @param {string} key Key name.
|
||||
* @private
|
||||
*/
|
||||
ol.Object.prototype.notifyInternal_ = function(key) {
|
||||
@@ -348,7 +348,7 @@ ol.Object.prototype.once = function(type, listener, opt_scope) {
|
||||
|
||||
/**
|
||||
* Sets a value.
|
||||
* @param {string} key Key.
|
||||
* @param {string} key Key name.
|
||||
* @param {*} value Value.
|
||||
* @todo stability experimental
|
||||
*/
|
||||
@@ -394,7 +394,7 @@ ol.Object.prototype.setValues = function(values) {
|
||||
/**
|
||||
* Removes a binding. Unbinding will set the unbound property to the current
|
||||
* value. The object will not be notified, as the value has not changed.
|
||||
* @param {string} key Key.
|
||||
* @param {string} key Key name.
|
||||
* @todo stability experimental
|
||||
*/
|
||||
ol.Object.prototype.unbind = function(key) {
|
||||
|
||||
@@ -192,8 +192,8 @@ ol.View2D.prototype.constrainCenter = function(center) {
|
||||
/**
|
||||
* Get the constrained the resolution of this view.
|
||||
* @param {number|undefined} resolution Resolution.
|
||||
* @param {number=} opt_delta Delta.
|
||||
* @param {number=} opt_direction Direction.
|
||||
* @param {number=} opt_delta Delta. Default is `0`.
|
||||
* @param {number=} opt_direction Direction. Default is `0`.
|
||||
* @return {number|undefined} Constrained resolution.
|
||||
* @todo stability experimental
|
||||
*/
|
||||
@@ -208,7 +208,7 @@ ol.View2D.prototype.constrainResolution = function(
|
||||
/**
|
||||
* Get the constrained rotation of this view.
|
||||
* @param {number|undefined} rotation Rotation.
|
||||
* @param {number=} opt_delta Delta.
|
||||
* @param {number=} opt_delta Delta. Default is `0`.
|
||||
* @return {number|undefined} Constrained rotation.
|
||||
* @todo stability experimental
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user