@guardian/interactive-component-library 0.7.5 → 0.7.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/molecules/canvas-map/lib/Map.d.ts +1 -0
- package/dist/components/molecules/canvas-map/lib/Map.js +2 -2
- package/dist/components/molecules/canvas-map/lib/layers/TextLayer.d.ts +2 -2
- package/dist/components/molecules/canvas-map/lib/layers/TextLayer.js +1 -1
- package/dist/components/molecules/canvas-map/lib/layers/VectorLayer.d.ts +1 -1
- package/dist/components/molecules/canvas-map/lib/renderers/VectorLayerRenderer.d.ts +1 -1
- package/dist/components/molecules/canvas-map/lib/renderers/VectorLayerRenderer.js +1 -1
- package/dist/components/molecules/canvas-map/lib/util/toRgba.js +1 -1
- package/package.json +1 -1
|
@@ -184,8 +184,8 @@ class Map {
|
|
|
184
184
|
changed() {
|
|
185
185
|
this._requestRender();
|
|
186
186
|
}
|
|
187
|
-
async transition(options = { duration: 500 }, callback) {
|
|
188
|
-
const ease = options.ease
|
|
187
|
+
async transition(options = { duration: 500, ease: (t) => t }, callback) {
|
|
188
|
+
const ease = options.ease;
|
|
189
189
|
return new Promise((resolve) => {
|
|
190
190
|
this._isTransitioning = true;
|
|
191
191
|
this.dispatcher.dispatch(MapEvent.TRANSITION_START);
|
|
@@ -14,7 +14,7 @@ export class TextLayer {
|
|
|
14
14
|
* @constructor
|
|
15
15
|
* @param {Object} params
|
|
16
16
|
* @param {VectorSource} params.source
|
|
17
|
-
* @param {Style | (() => Style)} [params.style=undefined]
|
|
17
|
+
* @param {Style | ((feature: import('../Feature').Feature, zoom: number, isHovering: boolean) => Style)} [params.style=undefined]
|
|
18
18
|
* @param {number} [params.minZoom=0]
|
|
19
19
|
* @param {number} [params.opacity=1]
|
|
20
20
|
* @param {boolean} [params.declutter=true]
|
|
@@ -35,7 +35,7 @@ export class TextLayer {
|
|
|
35
35
|
*/
|
|
36
36
|
constructor({ source, style, minZoom, opacity, declutter, declutterBoundingBoxPadding, drawCollisionBoxes, onClick, onHover, restyleOnHover, }: {
|
|
37
37
|
source: VectorSource;
|
|
38
|
-
style?: Style | (() => Style);
|
|
38
|
+
style?: Style | ((feature: import('../Feature').Feature, zoom: number, isHovering: boolean) => Style);
|
|
39
39
|
minZoom?: number;
|
|
40
40
|
opacity?: number;
|
|
41
41
|
declutter?: boolean;
|
|
@@ -77,7 +77,7 @@ class TextLayer {
|
|
|
77
77
|
* @constructor
|
|
78
78
|
* @param {Object} params
|
|
79
79
|
* @param {VectorSource} params.source
|
|
80
|
-
* @param {Style | (() => Style)} [params.style=undefined]
|
|
80
|
+
* @param {Style | ((feature: import('../Feature').Feature, zoom: number, isHovering: boolean) => Style)} [params.style=undefined]
|
|
81
81
|
* @param {number} [params.minZoom=0]
|
|
82
82
|
* @param {number} [params.opacity=1]
|
|
83
83
|
* @param {boolean} [params.declutter=true]
|
|
@@ -73,7 +73,7 @@ export class VectorLayer {
|
|
|
73
73
|
*/
|
|
74
74
|
getExtent(): import('../util').Extent | null;
|
|
75
75
|
findFeatures(coordinate: any): any;
|
|
76
|
-
renderFrame(frameState: any, canvas: any):
|
|
76
|
+
renderFrame(frameState: any, canvas: any): any;
|
|
77
77
|
}
|
|
78
78
|
export namespace VectorLayer {
|
|
79
79
|
/** @param {VectorLayerComponentProps} props */
|
|
@@ -12,7 +12,7 @@ class VectorLayerRenderer {
|
|
|
12
12
|
* @param {HTMLCanvasElement} canvas
|
|
13
13
|
*/
|
|
14
14
|
renderFrame(frameState, canvas) {
|
|
15
|
-
if (this.layer.opacity === 0) return
|
|
15
|
+
if (this.layer.opacity === 0) return null;
|
|
16
16
|
const { projection, visibleExtent, transform } = frameState.viewState;
|
|
17
17
|
const context = canvas.getContext("2d");
|
|
18
18
|
context.save();
|
|
@@ -18,7 +18,7 @@ function toRgba(color, opacity = 1) {
|
|
|
18
18
|
let a = rgbaMatch[4] !== void 0 ? parseFloat(rgbaMatch[4]) : opacity;
|
|
19
19
|
return `rgba(${r}, ${g}, ${b}, ${a})`;
|
|
20
20
|
}
|
|
21
|
-
throw new Error(
|
|
21
|
+
throw new Error(`Unsupported color format: ${color}`);
|
|
22
22
|
}
|
|
23
23
|
export {
|
|
24
24
|
toRgba
|