Merge pull request #11724 from MoonE/tilesources-add-transition-option

Add transition option to OSM and CartoDB sources, document default
This commit is contained in:
Tim Schaub
2020-11-08 11:19:14 -07:00
committed by GitHub
4 changed files with 10 additions and 4 deletions
+3
View File
@@ -27,6 +27,8 @@ import {assign} from '../obj.js';
* See http://docs.cartodb.com/cartodb-platform/maps-api/named-maps/ * See http://docs.cartodb.com/cartodb-platform/maps-api/named-maps/
* for more detail. * for more detail.
* @property {string} account If using named maps, this will be the name of the template to load. * @property {string} account If using named maps, this will be the name of the template to load.
* @property {number} [transition=250] Duration of the opacity transition for rendering.
* To disable the opacity transition, pass `transition: 0`.
*/ */
/** /**
@@ -52,6 +54,7 @@ class CartoDB extends XYZ {
maxZoom: options.maxZoom !== undefined ? options.maxZoom : 18, maxZoom: options.maxZoom !== undefined ? options.maxZoom : 18,
minZoom: options.minZoom, minZoom: options.minZoom,
projection: options.projection, projection: options.projection,
transition: options.transition,
wrapX: options.wrapX, wrapX: options.wrapX,
}); });
+5 -2
View File
@@ -34,6 +34,8 @@ export const ATTRIBUTION =
* imageTile.getImage().src = src; * imageTile.getImage().src = src;
* }; * };
* ``` * ```
* @property {number} [transition=250] Duration of the opacity transition for rendering.
* To disable the opacity transition, pass `transition: 0`.
* @property {string} [url='https://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png'] URL template. * @property {string} [url='https://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png'] URL template.
* Must include `{x}`, `{y}` or `{-y}`, and `{z}` placeholders. * Must include `{x}`, `{y}` or `{-y}`, and `{z}` placeholders.
* @property {boolean} [wrapX=true] Whether to wrap the world horizontally. * @property {boolean} [wrapX=true] Whether to wrap the world horizontally.
@@ -68,16 +70,17 @@ class OSM extends XYZ {
super({ super({
attributions: attributions, attributions: attributions,
attributionsCollapsible: false,
cacheSize: options.cacheSize, cacheSize: options.cacheSize,
crossOrigin: crossOrigin, crossOrigin: crossOrigin,
imageSmoothing: options.imageSmoothing, imageSmoothing: options.imageSmoothing,
opaque: options.opaque !== undefined ? options.opaque : true,
maxZoom: options.maxZoom !== undefined ? options.maxZoom : 19, maxZoom: options.maxZoom !== undefined ? options.maxZoom : 19,
opaque: options.opaque !== undefined ? options.opaque : true,
reprojectionErrorThreshold: options.reprojectionErrorThreshold, reprojectionErrorThreshold: options.reprojectionErrorThreshold,
tileLoadFunction: options.tileLoadFunction, tileLoadFunction: options.tileLoadFunction,
transition: options.transition,
url: url, url: url,
wrapX: options.wrapX, wrapX: options.wrapX,
attributionsCollapsible: false,
}); });
} }
} }
+1 -1
View File
@@ -100,7 +100,7 @@ const ProviderConfig = {
* imageTile.getImage().src = src; * imageTile.getImage().src = src;
* }; * };
* ``` * ```
* @property {number} [transition] Duration of the opacity transition for rendering. * @property {number} [transition=250] Duration of the opacity transition for rendering.
* To disable the opacity transition, pass `transition: 0`. * To disable the opacity transition, pass `transition: 0`.
* @property {string} [url] URL template. Must include `{x}`, `{y}` or `{-y}`, and `{z}` placeholders. * @property {string} [url] URL template. Must include `{x}`, `{y}` or `{-y}`, and `{z}` placeholders.
* @property {boolean} [wrapX=true] Whether to wrap the world horizontally. * @property {boolean} [wrapX=true] Whether to wrap the world horizontally.
+1 -1
View File
@@ -42,7 +42,7 @@ import {createXYZ, extentFromProjection} from '../tilegrid.js';
* may be used instead of defining each one separately in the `urls` option. * may be used instead of defining each one separately in the `urls` option.
* @property {Array<string>} [urls] An array of URL templates. * @property {Array<string>} [urls] An array of URL templates.
* @property {boolean} [wrapX=true] Whether to wrap the world horizontally. * @property {boolean} [wrapX=true] Whether to wrap the world horizontally.
* @property {number} [transition] Duration of the opacity transition for rendering. * @property {number} [transition=250] Duration of the opacity transition for rendering.
* To disable the opacity transition, pass `transition: 0`. * To disable the opacity transition, pass `transition: 0`.
* @property {number} [zDirection=0] Indicate which resolution should be used * @property {number} [zDirection=0] Indicate which resolution should be used
* by a renderer if the view resolution does not match any resolution of the tile source. * by a renderer if the view resolution does not match any resolution of the tile source.