From 3d90a4587c6a3294a66186e88888ee2587edf374 Mon Sep 17 00:00:00 2001 From: Florent gravin Date: Wed, 28 Mar 2018 15:21:05 +0200 Subject: [PATCH] Move olx.source.ImageCanvasOptions to ol/source/ImageCanvasOptions --- externs/olx.js | 77 ------------------------------------ src/ol/source/ImageCanvas.js | 23 ++++++++++- 2 files changed, 22 insertions(+), 78 deletions(-) diff --git a/externs/olx.js b/externs/olx.js index 9f972d224d..c72e9765c0 100644 --- a/externs/olx.js +++ b/externs/olx.js @@ -704,83 +704,6 @@ olx.source.OSMOptions.prototype.tileLoadFunction; olx.source.OSMOptions.prototype.url; -/** - * Whether to wrap the world horizontally. Default is `true`. - * @type {boolean|undefined} - * @api - */ -olx.source.OSMOptions.prototype.wrapX; - - -/** - * @typedef {{attributions: (ol.AttributionLike|undefined), - * canvasFunction: ol.CanvasFunctionType, - * projection: ol.ProjectionLike, - * ratio: (number|undefined), - * resolutions: (Array.|undefined), - * state: (ol.source.State|undefined)}} - */ -olx.source.ImageCanvasOptions; - - -/** - * Attributions. - * @type {ol.AttributionLike|undefined} - * @api - */ -olx.source.ImageCanvasOptions.prototype.attributions; - - -/** - * Canvas function. The function returning the canvas element used by the source - * as an image. The arguments passed to the function are: `{ol.Extent}` the - * image extent, `{number}` the image resolution, `{number}` the device pixel - * ratio, `{ol.Size}` the image size, and `{module:ol/proj/Projection~Projection}` the image - * projection. The canvas returned by this function is cached by the source. If - * the value returned by the function is later changed then - * `changed` should be called on the source for the source to - * invalidate the current cached image. See @link: {@link module:ol/Observable~Observable#changed} - * @type {ol.CanvasFunctionType} - * @api - */ -olx.source.ImageCanvasOptions.prototype.canvasFunction; - - -/** - * Projection. - * @type {ol.ProjectionLike} - * @api - */ -olx.source.ImageCanvasOptions.prototype.projection; - - -/** - * Ratio. 1 means canvases are the size of the map viewport, 2 means twice the - * width and height of the map viewport, and so on. Must be `1` or higher. - * Default is `1.5`. - * @type {number|undefined} - * @api - */ -olx.source.ImageCanvasOptions.prototype.ratio; - - -/** - * Resolutions. If specified, new canvases will be created for these resolutions - * only. - * @type {Array.|undefined} - * @api - */ -olx.source.ImageCanvasOptions.prototype.resolutions; - - -/** - * Source state. - * @type {ol.source.State|undefined} - * @api - */ -olx.source.ImageCanvasOptions.prototype.state; - - /** * @typedef {{sources: Array., * operation: (ol.RasterOperation|undefined), diff --git a/src/ol/source/ImageCanvas.js b/src/ol/source/ImageCanvas.js index 7ef9dd4960..fa42120fb5 100644 --- a/src/ol/source/ImageCanvas.js +++ b/src/ol/source/ImageCanvas.js @@ -6,13 +6,34 @@ import ImageCanvas from '../ImageCanvas.js'; import {containsExtent, getHeight, getWidth, scaleFromCenter} from '../extent.js'; import ImageSource from '../source/Image.js'; +/** + * @typedef {Object} Options + * @property {ol.AttributionLike} [attributions] Attributions. + * @property {ol.CanvasFunctionType} [canvasFunction] Canvas function. + * The function returning the canvas element used by the source + * as an image. The arguments passed to the function are: `{ol.Extent}` the + * image extent, `{number}` the image resolution, `{number}` the device pixel + * ratio, `{ol.Size}` the image size, and `{module:ol/proj/Projection~Projection}` the image + * projection. The canvas returned by this function is cached by the source. If + * the value returned by the function is later changed then + * `dispatchChangeEvent` should be called on the source for the source to + * invalidate the current cached image. + * @property {ol.ProjectionLike} projection Projection. + * @property {number} [ratio=1.5] Ratio. 1 means canvases are the size of the map viewport, 2 means twice the + * width and height of the map viewport, and so on. Must be `1` or higher. + * @property {Array.} [resolutions] Resolutions. + * If specified, new canvases will be created for these resolutions + * @property {ol.source.State} [state] Source state. + */ + + /** * @classdesc * Base class for image sources where a canvas element is the image. * * @constructor * @extends {ol.source.Image} - * @param {olx.source.ImageCanvasOptions} options Constructor options. + * @param {module:ol/source/ImageCanvas~Options=} options ImageCanvas options. * @api */ const ImageCanvasSource = function(options) {