@deck.gl-community/infovis-layers 9.3.5 → 9.3.7
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/index.cjs +2998 -114
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +11 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -1
- package/dist/index.js.map +1 -1
- package/dist/layers/animation-layer/animation-layer.d.ts +30 -0
- package/dist/layers/animation-layer/animation-layer.d.ts.map +1 -0
- package/dist/layers/animation-layer/animation-layer.js +53 -0
- package/dist/layers/animation-layer/animation-layer.js.map +1 -0
- package/dist/layers/animation-layer/animation.d.ts +86 -0
- package/dist/layers/animation-layer/animation.d.ts.map +1 -0
- package/dist/layers/animation-layer/animation.js +214 -0
- package/dist/layers/animation-layer/animation.js.map +1 -0
- package/dist/layers/block-layer/block-layer-fragment.glsl.d.ts +3 -0
- package/dist/layers/block-layer/block-layer-fragment.glsl.d.ts.map +1 -0
- package/dist/layers/block-layer/block-layer-fragment.glsl.js +41 -0
- package/dist/layers/block-layer/block-layer-fragment.glsl.js.map +1 -0
- package/dist/layers/block-layer/block-layer-uniforms.d.ts +27 -0
- package/dist/layers/block-layer/block-layer-uniforms.d.ts.map +1 -0
- package/dist/layers/block-layer/block-layer-uniforms.js +26 -0
- package/dist/layers/block-layer/block-layer-uniforms.js.map +1 -0
- package/dist/layers/block-layer/block-layer-vertex.glsl.d.ts +3 -0
- package/dist/layers/block-layer/block-layer-vertex.glsl.d.ts.map +1 -0
- package/dist/layers/block-layer/block-layer-vertex.glsl.js +67 -0
- package/dist/layers/block-layer/block-layer-vertex.glsl.js.map +1 -0
- package/dist/layers/block-layer/block-layer.d.ts +71 -0
- package/dist/layers/block-layer/block-layer.d.ts.map +1 -0
- package/dist/layers/block-layer/block-layer.js +108 -0
- package/dist/layers/block-layer/block-layer.js.map +1 -0
- package/dist/layers/fast-text-layer/fast-text-layer.d.ts +148 -0
- package/dist/layers/fast-text-layer/fast-text-layer.d.ts.map +1 -0
- package/dist/layers/fast-text-layer/fast-text-layer.js +862 -0
- package/dist/layers/fast-text-layer/fast-text-layer.js.map +1 -0
- package/dist/layers/fast-text-layer/fast-text-layer.test.d.ts +2 -0
- package/dist/layers/fast-text-layer/fast-text-layer.test.d.ts.map +1 -0
- package/dist/layers/fast-text-layer/fast-text-layer.test.js +300 -0
- package/dist/layers/fast-text-layer/fast-text-layer.test.js.map +1 -0
- package/dist/layers/fast-text-layer/fast-text-layout.d.ts +179 -0
- package/dist/layers/fast-text-layer/fast-text-layout.d.ts.map +1 -0
- package/dist/layers/fast-text-layer/fast-text-layout.js +665 -0
- package/dist/layers/fast-text-layer/fast-text-layout.js.map +1 -0
- package/dist/layers/fast-text-layer/font-atlas.d.ts +98 -0
- package/dist/layers/fast-text-layer/font-atlas.d.ts.map +1 -0
- package/dist/layers/fast-text-layer/font-atlas.js +337 -0
- package/dist/layers/fast-text-layer/font-atlas.js.map +1 -0
- package/dist/layers/fast-text-layer/index.d.ts +4 -0
- package/dist/layers/fast-text-layer/index.d.ts.map +1 -0
- package/dist/layers/fast-text-layer/index.js +4 -0
- package/dist/layers/fast-text-layer/index.js.map +1 -0
- package/dist/layers/time-delta-layer.d.ts +22 -60
- package/dist/layers/time-delta-layer.d.ts.map +1 -1
- package/dist/layers/time-delta-layer.js +23 -45
- package/dist/layers/time-delta-layer.js.map +1 -1
- package/dist/synchronized-views/synchronized-views.js +1 -1
- package/dist/synchronized-views/synchronized-views.js.map +1 -1
- package/dist/utils/format-utils.d.ts +27 -3
- package/dist/utils/format-utils.d.ts.map +1 -1
- package/dist/utils/format-utils.js +72 -40
- package/dist/utils/format-utils.js.map +1 -1
- package/dist/utils/utf8-string-view.d.ts +53 -0
- package/dist/utils/utf8-string-view.d.ts.map +1 -0
- package/dist/utils/utf8-string-view.js +169 -0
- package/dist/utils/utf8-string-view.js.map +1 -0
- package/dist/utils/utf8-string-view.test.d.ts +2 -0
- package/dist/utils/utf8-string-view.test.d.ts.map +1 -0
- package/dist/utils/utf8-string-view.test.js +88 -0
- package/dist/utils/utf8-string-view.test.js.map +1 -0
- package/dist/views/bounds-utils.d.ts +23 -0
- package/dist/views/bounds-utils.d.ts.map +1 -0
- package/dist/views/bounds-utils.js +65 -0
- package/dist/views/bounds-utils.js.map +1 -0
- package/dist/views/layer-bounds-filter.d.ts +48 -0
- package/dist/views/layer-bounds-filter.d.ts.map +1 -0
- package/dist/views/layer-bounds-filter.js +99 -0
- package/dist/views/layer-bounds-filter.js.map +1 -0
- package/dist/views/orthographic-utils.d.ts +30 -2
- package/dist/views/orthographic-utils.d.ts.map +1 -1
- package/dist/views/orthographic-utils.js +33 -14
- package/dist/views/orthographic-utils.js.map +1 -1
- package/dist/views/view-layout/build-views-from-view-layout.d.ts +37 -0
- package/dist/views/view-layout/build-views-from-view-layout.d.ts.map +1 -0
- package/dist/views/view-layout/build-views-from-view-layout.js +413 -0
- package/dist/views/view-layout/build-views-from-view-layout.js.map +1 -0
- package/dist/views/view-layout/index.d.ts +3 -0
- package/dist/views/view-layout/index.d.ts.map +1 -0
- package/dist/views/view-layout/index.js +3 -0
- package/dist/views/view-layout/index.js.map +1 -0
- package/dist/views/view-layout/view-layout-item.d.ts +74 -0
- package/dist/views/view-layout/view-layout-item.d.ts.map +1 -0
- package/dist/views/view-layout/view-layout-item.js +48 -0
- package/dist/views/view-layout/view-layout-item.js.map +1 -0
- package/dist/views/view-layout/view-layout.test.d.ts +2 -0
- package/dist/views/view-layout/view-layout.test.d.ts.map +1 -0
- package/dist/views/view-layout/view-layout.test.js +112 -0
- package/dist/views/view-layout/view-layout.test.js.map +1 -0
- package/dist/views/viewport-bounds-utils.d.ts +55 -0
- package/dist/views/viewport-bounds-utils.d.ts.map +1 -0
- package/dist/views/viewport-bounds-utils.js +70 -0
- package/dist/views/viewport-bounds-utils.js.map +1 -0
- package/package.json +11 -4
- package/src/index.ts +91 -2
- package/src/layers/animation-layer/animation-layer.ts +92 -0
- package/src/layers/animation-layer/animation.ts +328 -0
- package/src/layers/block-layer/block-layer-fragment.glsl.ts +41 -0
- package/src/layers/block-layer/block-layer-uniforms.ts +43 -0
- package/src/layers/block-layer/block-layer-vertex.glsl.ts +67 -0
- package/src/layers/block-layer/block-layer.ts +199 -0
- package/src/layers/fast-text-layer/fast-text-layer.test.ts +359 -0
- package/src/layers/fast-text-layer/fast-text-layer.ts +1208 -0
- package/src/layers/fast-text-layer/fast-text-layout.ts +1124 -0
- package/src/layers/fast-text-layer/font-atlas.ts +574 -0
- package/src/layers/fast-text-layer/index.ts +37 -0
- package/src/layers/time-delta-layer.ts +47 -62
- package/src/synchronized-views/synchronized-views.ts +1 -1
- package/src/utils/format-utils.ts +90 -40
- package/src/utils/utf8-string-view.test.ts +119 -0
- package/src/utils/utf8-string-view.ts +273 -0
- package/src/views/bounds-utils.ts +88 -0
- package/src/views/layer-bounds-filter.ts +160 -0
- package/src/views/orthographic-utils.ts +65 -18
- package/src/views/view-layout/build-views-from-view-layout.ts +547 -0
- package/src/views/view-layout/index.ts +18 -0
- package/src/views/view-layout/view-layout-item.ts +125 -0
- package/src/views/view-layout/view-layout.test.ts +129 -0
- package/src/views/viewport-bounds-utils.ts +104 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { OrthographicView } from '@deck.gl/core';
|
|
2
|
+
import { describe, expect, it } from 'vitest';
|
|
3
|
+
import { buildViewsFromViewLayout, ViewLayoutItem } from '.';
|
|
4
|
+
describe('buildViewsFromViewLayout', () => {
|
|
5
|
+
it('splits remaining row width evenly across children without explicit widths', () => {
|
|
6
|
+
const layout = new ViewLayoutItem({
|
|
7
|
+
type: 'row',
|
|
8
|
+
children: [
|
|
9
|
+
new OrthographicView({ id: 'fixed', width: 100 }),
|
|
10
|
+
new OrthographicView({ id: 'flex-a' }),
|
|
11
|
+
new OrthographicView({ id: 'flex-b' })
|
|
12
|
+
]
|
|
13
|
+
});
|
|
14
|
+
const compiled = buildViewsFromViewLayout({
|
|
15
|
+
layout,
|
|
16
|
+
width: 400,
|
|
17
|
+
height: 120
|
|
18
|
+
});
|
|
19
|
+
expect(compiled.rectsById.fixed).toEqual({ x: 0, y: 0, width: 100, height: 120 });
|
|
20
|
+
expect(compiled.rectsById['flex-a']).toEqual({ x: 100, y: 0, width: 150, height: 120 });
|
|
21
|
+
expect(compiled.rectsById['flex-b']).toEqual({ x: 250, y: 0, width: 150, height: 120 });
|
|
22
|
+
});
|
|
23
|
+
it('splits remaining column height evenly across children without explicit heights', () => {
|
|
24
|
+
const layout = new ViewLayoutItem({
|
|
25
|
+
type: 'column',
|
|
26
|
+
children: [
|
|
27
|
+
new OrthographicView({ id: 'header', height: 40 }),
|
|
28
|
+
new OrthographicView({ id: 'body-a' }),
|
|
29
|
+
new OrthographicView({ id: 'body-b' })
|
|
30
|
+
]
|
|
31
|
+
});
|
|
32
|
+
const compiled = buildViewsFromViewLayout({
|
|
33
|
+
layout,
|
|
34
|
+
width: 200,
|
|
35
|
+
height: 200
|
|
36
|
+
});
|
|
37
|
+
expect(compiled.rectsById.header).toEqual({ x: 0, y: 0, width: 200, height: 40 });
|
|
38
|
+
expect(compiled.rectsById['body-a']).toEqual({ x: 0, y: 40, width: 200, height: 80 });
|
|
39
|
+
expect(compiled.rectsById['body-b']).toEqual({ x: 0, y: 120, width: 200, height: 80 });
|
|
40
|
+
});
|
|
41
|
+
it('resolves overlay children against the same parent bounds', () => {
|
|
42
|
+
const layout = new ViewLayoutItem({
|
|
43
|
+
type: 'overlay',
|
|
44
|
+
children: [new OrthographicView({ id: 'base' }), new OrthographicView({ id: 'top' })]
|
|
45
|
+
});
|
|
46
|
+
const compiled = buildViewsFromViewLayout({
|
|
47
|
+
layout,
|
|
48
|
+
width: 320,
|
|
49
|
+
height: 180
|
|
50
|
+
});
|
|
51
|
+
expect(compiled.rectsById.base).toEqual({ x: 0, y: 0, width: 320, height: 180 });
|
|
52
|
+
expect(compiled.rectsById.top).toEqual({ x: 0, y: 0, width: 320, height: 180 });
|
|
53
|
+
});
|
|
54
|
+
it('resolves raw view expressions against the current parent bounds', () => {
|
|
55
|
+
const layout = new ViewLayoutItem({
|
|
56
|
+
type: 'overlay',
|
|
57
|
+
children: [
|
|
58
|
+
new OrthographicView({
|
|
59
|
+
id: 'calc-view',
|
|
60
|
+
x: 10,
|
|
61
|
+
y: '10%',
|
|
62
|
+
width: 'calc(50% - 20px)',
|
|
63
|
+
height: '50%'
|
|
64
|
+
})
|
|
65
|
+
]
|
|
66
|
+
});
|
|
67
|
+
const compiled = buildViewsFromViewLayout({
|
|
68
|
+
layout,
|
|
69
|
+
width: 300,
|
|
70
|
+
height: 200
|
|
71
|
+
});
|
|
72
|
+
expect(compiled.rectsById['calc-view']).toEqual({ x: 10, y: 20, width: 130, height: 100 });
|
|
73
|
+
});
|
|
74
|
+
it('supports nested items and reuses unchanged compiled views by id', () => {
|
|
75
|
+
const layout = new ViewLayoutItem({
|
|
76
|
+
type: 'column',
|
|
77
|
+
children: [
|
|
78
|
+
new ViewLayoutItem({
|
|
79
|
+
type: 'row',
|
|
80
|
+
height: 50,
|
|
81
|
+
children: [
|
|
82
|
+
new ViewLayoutItem({ type: 'spacer', width: 80 }),
|
|
83
|
+
new OrthographicView({ id: 'header' })
|
|
84
|
+
]
|
|
85
|
+
}),
|
|
86
|
+
new ViewLayoutItem({
|
|
87
|
+
type: 'row',
|
|
88
|
+
children: [
|
|
89
|
+
new OrthographicView({ id: 'legend', width: 80 }),
|
|
90
|
+
new OrthographicView({ id: 'main' })
|
|
91
|
+
]
|
|
92
|
+
})
|
|
93
|
+
]
|
|
94
|
+
});
|
|
95
|
+
const first = buildViewsFromViewLayout({
|
|
96
|
+
layout,
|
|
97
|
+
width: 300,
|
|
98
|
+
height: 200
|
|
99
|
+
});
|
|
100
|
+
const second = buildViewsFromViewLayout({
|
|
101
|
+
layout,
|
|
102
|
+
width: 300,
|
|
103
|
+
height: 200,
|
|
104
|
+
previous: first
|
|
105
|
+
});
|
|
106
|
+
expect(second.rectsById.header).toEqual({ x: 80, y: 0, width: 220, height: 50 });
|
|
107
|
+
expect(second.rectsById.legend).toEqual({ x: 0, y: 50, width: 80, height: 150 });
|
|
108
|
+
expect(second.rectsById.main).toEqual({ x: 80, y: 50, width: 220, height: 150 });
|
|
109
|
+
expect(second.views.find(view => view.props.id === 'main')).toBe(first.views.find(view => view.props.id === 'main'));
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
//# sourceMappingURL=view-layout.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"view-layout.test.js","sourceRoot":"","sources":["../../../src/views/view-layout/view-layout.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAC,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAC,MAAM,QAAQ,CAAC;AAE5C,OAAO,EAAC,wBAAwB,EAAE,cAAc,EAAC,MAAM,GAAG,CAAC;AAE3D,QAAQ,CAAC,0BAA0B,EAAE,GAAG,EAAE;IACxC,EAAE,CAAC,2EAA2E,EAAE,GAAG,EAAE;QACnF,MAAM,MAAM,GAAG,IAAI,cAAc,CAAC;YAChC,IAAI,EAAE,KAAK;YACX,QAAQ,EAAE;gBACR,IAAI,gBAAgB,CAAC,EAAC,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,EAAC,CAAC;gBAC/C,IAAI,gBAAgB,CAAC,EAAC,EAAE,EAAE,QAAQ,EAAC,CAAC;gBACpC,IAAI,gBAAgB,CAAC,EAAC,EAAE,EAAE,QAAQ,EAAC,CAAC;aACrC;SACF,CAAC,CAAC;QAEH,MAAM,QAAQ,GAAG,wBAAwB,CAAC;YACxC,MAAM;YACN,KAAK,EAAE,GAAG;YACV,MAAM,EAAE,GAAG;SACZ,CAAC,CAAC;QAEH,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,EAAC,CAAC,EAAE,CAAC,EA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|
|
3
|
+
/** Default floating-point tolerance used when comparing bounds values. @defaultValue 1e-6 */
|
|
4
|
+
export declare const DEFAULT_BOUNDS_EPSILON = 0.000001;
|
|
5
|
+
/**
|
|
6
|
+
* Axis-aligned bounding box describing the area that is currently visible in a Deck.gl viewport.
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
export type ViewportBounds = {
|
|
10
|
+
/** Inclusive minimum world-space X coordinate within the viewport. */
|
|
11
|
+
minX: number;
|
|
12
|
+
/** Inclusive maximum world-space X coordinate within the viewport. */
|
|
13
|
+
maxX: number;
|
|
14
|
+
/** Inclusive minimum world-space Y coordinate within the viewport. */
|
|
15
|
+
minY: number;
|
|
16
|
+
/** Inclusive maximum world-space Y coordinate within the viewport. */
|
|
17
|
+
maxY: number;
|
|
18
|
+
};
|
|
19
|
+
/** Floating-point comparison configuration for {@link boundsAreEqual}. */
|
|
20
|
+
export type BoundsEqualityOptions = {
|
|
21
|
+
/** Maximum allowed coordinate delta before bounds differ. @defaultValue DEFAULT_BOUNDS_EPSILON */
|
|
22
|
+
epsilon?: number;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Returns `true` when two bounds tuples are identical within a configurable floating-point
|
|
26
|
+
* tolerance.
|
|
27
|
+
*
|
|
28
|
+
* @param a - First bounds tuple to compare.
|
|
29
|
+
* @param b - Second bounds tuple to compare.
|
|
30
|
+
* @param options - Comparison configuration.
|
|
31
|
+
* @param options.epsilon - Maximum allowed absolute difference between coordinate values before
|
|
32
|
+
* the bounds are considered distinct. Defaults to {@link DEFAULT_BOUNDS_EPSILON}.
|
|
33
|
+
*/
|
|
34
|
+
export declare function boundsAreEqual(a: Bounds, b: Bounds, options?: BoundsEqualityOptions): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Computes the world-space bounds of an orthographic viewport given its view state and Deck.gl
|
|
37
|
+
* dimensions.
|
|
38
|
+
*
|
|
39
|
+
* @param view - The orthographic view state describing the viewport target and zoom level.
|
|
40
|
+
* @param deckDimensions - The pixel dimensions of the Deck.gl canvas hosting the view.
|
|
41
|
+
* @returns The minimum and maximum X/Y world-space coordinates visible within the viewport.
|
|
42
|
+
*/
|
|
43
|
+
export declare function getViewportBoundsForViewState(view: OrthographicViewState, deckDimensions: {
|
|
44
|
+
width: number;
|
|
45
|
+
height: number;
|
|
46
|
+
}): ViewportBounds;
|
|
47
|
+
/**
|
|
48
|
+
* Determines whether a bounds tuple lies entirely outside the supplied viewport bounds.
|
|
49
|
+
*
|
|
50
|
+
* @param bounds - The bounds tuple that may or may not intersect with the viewport.
|
|
51
|
+
* @param viewport - The viewport bounds to test against.
|
|
52
|
+
* @returns `true` when the bounds are completely outside of the viewport; otherwise `false`.
|
|
53
|
+
*/
|
|
54
|
+
export declare function isBoundsCompletelyOutside(bounds: Bounds, viewport: ViewportBounds): boolean;
|
|
55
|
+
//# sourceMappingURL=viewport-bounds-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"viewport-bounds-utils.d.ts","sourceRoot":"","sources":["../../src/views/viewport-bounds-utils.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,MAAM,EAAC,0BAAuB;AAC3C,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,eAAe,CAAC;AAEzD,6FAA6F;AAC7F,eAAO,MAAM,sBAAsB,WAAO,CAAC;AAE3C;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,sEAAsE;IACtE,IAAI,EAAE,MAAM,CAAC;IACb,sEAAsE;IACtE,IAAI,EAAE,MAAM,CAAC;IACb,sEAAsE;IACtE,IAAI,EAAE,MAAM,CAAC;IACb,sEAAsE;IACtE,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,0EAA0E;AAC1E,MAAM,MAAM,qBAAqB,GAAG;IAClC,kGAAkG;IAClG,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,qBAAqB,GAAG,OAAO,CAa7F;AAED;;;;;;;GAOG;AACH,wBAAgB,6BAA6B,CAC3C,IAAI,EAAE,qBAAqB,EAC3B,cAAc,EAAE;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAC,GAC9C,cAAc,CAsBhB;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,cAAc,GAAG,OAAO,CAK3F"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// deck.gl-community
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
/** Default floating-point tolerance used when comparing bounds values. @defaultValue 1e-6 */
|
|
5
|
+
export const DEFAULT_BOUNDS_EPSILON = 1e-6;
|
|
6
|
+
/**
|
|
7
|
+
* Returns `true` when two bounds tuples are identical within a configurable floating-point
|
|
8
|
+
* tolerance.
|
|
9
|
+
*
|
|
10
|
+
* @param a - First bounds tuple to compare.
|
|
11
|
+
* @param b - Second bounds tuple to compare.
|
|
12
|
+
* @param options - Comparison configuration.
|
|
13
|
+
* @param options.epsilon - Maximum allowed absolute difference between coordinate values before
|
|
14
|
+
* the bounds are considered distinct. Defaults to {@link DEFAULT_BOUNDS_EPSILON}.
|
|
15
|
+
*/
|
|
16
|
+
export function boundsAreEqual(a, b, options) {
|
|
17
|
+
const epsilon = options?.epsilon ?? DEFAULT_BOUNDS_EPSILON;
|
|
18
|
+
let [ax, ay] = a[0];
|
|
19
|
+
let [bx, by] = b[0];
|
|
20
|
+
if (Math.abs(ax - bx) > epsilon || Math.abs(ay - by) > epsilon) {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
[ax, ay] = a[1];
|
|
24
|
+
[bx, by] = b[1];
|
|
25
|
+
if (Math.abs(ax - bx) > epsilon || Math.abs(ay - by) > epsilon) {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Computes the world-space bounds of an orthographic viewport given its view state and Deck.gl
|
|
32
|
+
* dimensions.
|
|
33
|
+
*
|
|
34
|
+
* @param view - The orthographic view state describing the viewport target and zoom level.
|
|
35
|
+
* @param deckDimensions - The pixel dimensions of the Deck.gl canvas hosting the view.
|
|
36
|
+
* @returns The minimum and maximum X/Y world-space coordinates visible within the viewport.
|
|
37
|
+
*/
|
|
38
|
+
export function getViewportBoundsForViewState(view, deckDimensions) {
|
|
39
|
+
const target = view.target ?? [0, 0];
|
|
40
|
+
const zoomValue = view.zoom;
|
|
41
|
+
const zoomArray = Array.isArray(zoomValue)
|
|
42
|
+
? zoomValue
|
|
43
|
+
: typeof zoomValue === 'number'
|
|
44
|
+
? [zoomValue, zoomValue]
|
|
45
|
+
: [0, 0];
|
|
46
|
+
const zoomX = zoomArray[0] ?? 0;
|
|
47
|
+
const zoomY = zoomArray[1] ?? zoomArray[0] ?? 0;
|
|
48
|
+
const scaleX = 2 ** zoomX || 1;
|
|
49
|
+
const scaleY = 2 ** zoomY || 1;
|
|
50
|
+
const halfWidth = deckDimensions.width / scaleX / 2;
|
|
51
|
+
const halfHeight = deckDimensions.height / scaleY / 2;
|
|
52
|
+
return {
|
|
53
|
+
minX: target[0] - halfWidth,
|
|
54
|
+
maxX: target[0] + halfWidth,
|
|
55
|
+
minY: target[1] - halfHeight,
|
|
56
|
+
maxY: target[1] + halfHeight
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Determines whether a bounds tuple lies entirely outside the supplied viewport bounds.
|
|
61
|
+
*
|
|
62
|
+
* @param bounds - The bounds tuple that may or may not intersect with the viewport.
|
|
63
|
+
* @param viewport - The viewport bounds to test against.
|
|
64
|
+
* @returns `true` when the bounds are completely outside of the viewport; otherwise `false`.
|
|
65
|
+
*/
|
|
66
|
+
export function isBoundsCompletelyOutside(bounds, viewport) {
|
|
67
|
+
const [[minX, minY], [maxX, maxY]] = bounds;
|
|
68
|
+
return (maxX < viewport.minX || minX > viewport.maxX || maxY < viewport.minY || minY > viewport.maxY);
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=viewport-bounds-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"viewport-bounds-utils.js","sourceRoot":"","sources":["../../src/views/viewport-bounds-utils.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,+BAA+B;AAC/B,oCAAoC;AAKpC,6FAA6F;AAC7F,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,CAAC;AAuB3C;;;;;;;;;GASG;AACH,MAAM,UAAU,cAAc,CAAC,CAAS,EAAE,CAAS,EAAE,OAA+B;IAClF,MAAM,OAAO,GAAG,OAAO,EAAE,OAAO,IAAI,sBAAsB,CAAC;IAC3D,IAAI,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IACpB,IAAI,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IACpB,IAAI,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,OAAO,IAAI,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,OAAO,EAAE,CAAC;QAC/D,OAAO,KAAK,CAAC;IACf,CAAC;IACD,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAChB,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAChB,IAAI,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,OAAO,IAAI,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,OAAO,EAAE,CAA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AAyB,CAAC,MAAc,EAAE,QAAwB;IAChF,MAAM,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,GAAG,MAAM,CAAC;IAC5C,OAAO,CACL,IAAI,GAAG,QAAQ,CAAC,IAAI,IAAI,IAAI,GAAG,QAAQ,CAAC,IAAI,IAAI,IAAI,GAAG,QAAQ,CAAC,IAAI,IAAI,IAAI,GAAG,QAAQ,CAAC,IAAI,CAC7F,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deck.gl-community/infovis-layers",
|
|
3
|
-
"version": "9.3.
|
|
3
|
+
"version": "9.3.7",
|
|
4
4
|
"description": "Infovis layers (non-geospatial) for deck.gl",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -33,13 +33,20 @@
|
|
|
33
33
|
"test-watch": "vitest"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@luma.gl/shadertools": "~9.3.2"
|
|
36
|
+
"@luma.gl/shadertools": "~9.3.2",
|
|
37
|
+
"@probe.gl/log": "^4.1.1"
|
|
37
38
|
},
|
|
38
39
|
"peerDependencies": {
|
|
39
40
|
"@deck.gl/core": "~9.3.0",
|
|
40
41
|
"@deck.gl/layers": "~9.3.0",
|
|
41
42
|
"@luma.gl/core": "~9.3.2",
|
|
42
|
-
"@luma.gl/engine": "~9.3.2"
|
|
43
|
+
"@luma.gl/engine": "~9.3.2",
|
|
44
|
+
"apache-arrow": ">=17"
|
|
45
|
+
},
|
|
46
|
+
"peerDependenciesMeta": {
|
|
47
|
+
"apache-arrow": {
|
|
48
|
+
"optional": true
|
|
49
|
+
}
|
|
43
50
|
},
|
|
44
51
|
"devDependencies": {
|
|
45
52
|
"@deck.gl/core": "~9.3.0",
|
|
@@ -49,5 +56,5 @@
|
|
|
49
56
|
"@luma.gl/webgpu": "~9.3.2",
|
|
50
57
|
"@probe.gl/test-utils": "^4.1.1"
|
|
51
58
|
},
|
|
52
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "ede78777382aaf1c821a9c427cdb48eb4e77e20e"
|
|
53
60
|
}
|
package/src/index.ts
CHANGED
|
@@ -3,11 +3,100 @@
|
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
5
|
export {TimeDeltaLayer, type TimeDeltaLayerProps} from './layers/time-delta-layer';
|
|
6
|
+
export {
|
|
7
|
+
AnimationLayer,
|
|
8
|
+
type AnimationLayerProps
|
|
9
|
+
} from './layers/animation-layer/animation-layer';
|
|
10
|
+
export type {
|
|
11
|
+
AnimationFrame,
|
|
12
|
+
AnimationFramesGroup
|
|
13
|
+
} from './layers/animation-layer/animation';
|
|
14
|
+
export {BlockLayer, type BlockLayerProps} from './layers/block-layer/block-layer';
|
|
15
|
+
export {
|
|
16
|
+
FastTextLayer,
|
|
17
|
+
type FastTextLayerProps,
|
|
18
|
+
type _FastTextLayerProps,
|
|
19
|
+
buildFastTextUtf8ColumnSource,
|
|
20
|
+
buildFastTextGlyphData,
|
|
21
|
+
buildMultiLineGlyphData,
|
|
22
|
+
buildSingleLineGlyphData,
|
|
23
|
+
collectFastTextCharacterSet,
|
|
24
|
+
updateFastTextDynamicGlyphAttributes,
|
|
25
|
+
type BuildFastTextGlyphDataProps,
|
|
26
|
+
type CollectFastTextCharacterSetProps,
|
|
27
|
+
type FastTextAlignmentBaseline,
|
|
28
|
+
type FastTextAnchor,
|
|
29
|
+
type FastTextClipRect,
|
|
30
|
+
type FastTextContentAlign,
|
|
31
|
+
type FastTextDynamicGlyphUpdateStats,
|
|
32
|
+
type FastTextGlyphBuildStats,
|
|
33
|
+
type FastTextGlyphAttributes,
|
|
34
|
+
type FastTextGlyphData,
|
|
35
|
+
type FastTextUtf8Column,
|
|
36
|
+
type FastTextUtf8ColumnSource,
|
|
37
|
+
type FastTextUtf8ViewAccessor,
|
|
38
|
+
type UpdateFastTextDynamicGlyphAttributesProps,
|
|
39
|
+
buildFastTextCharacterMapping,
|
|
40
|
+
createFastTextFontAtlas,
|
|
41
|
+
DEFAULT_FAST_TEXT_FONT_SETTINGS,
|
|
42
|
+
FastTextFontAtlasManager,
|
|
43
|
+
type FastTextCharacter,
|
|
44
|
+
type FastTextCharacterMapping,
|
|
45
|
+
type FastTextFontAtlas,
|
|
46
|
+
type FastTextFontSettings
|
|
47
|
+
} from './layers/fast-text-layer/index';
|
|
6
48
|
|
|
7
|
-
export {fitBoundsOrthographic} from './views/orthographic-utils';
|
|
8
|
-
export {
|
|
49
|
+
export {fitBoundsOrthographic, getBoundsOrthographic} from './views/orthographic-utils';
|
|
50
|
+
export {
|
|
51
|
+
buildViewsFromViewLayout,
|
|
52
|
+
type CompiledDeckViews,
|
|
53
|
+
type ViewLayoutRect,
|
|
54
|
+
ViewLayoutItem,
|
|
55
|
+
type ViewLayoutBaseProps,
|
|
56
|
+
type ViewLayoutChild,
|
|
57
|
+
type ViewLayoutColumnProps,
|
|
58
|
+
type ViewLayoutInsets,
|
|
59
|
+
type ViewLayoutItemProps,
|
|
60
|
+
type ViewLayoutLength,
|
|
61
|
+
type ViewLayoutOverlayProps,
|
|
62
|
+
type ViewLayoutRowProps,
|
|
63
|
+
type ViewLayoutSpacerProps,
|
|
64
|
+
type ViewLayoutViewProps
|
|
65
|
+
} from './views/view-layout/index';
|
|
66
|
+
export {
|
|
67
|
+
getPaddedBlockBounds,
|
|
68
|
+
type Bounds,
|
|
69
|
+
type Geometry,
|
|
70
|
+
type PaddedBlockBoundsOptions
|
|
71
|
+
} from './views/bounds-utils';
|
|
72
|
+
export {formatTimeMs, formatTimeRangeMs, type FormatTimeMsOptions} from './utils/format-utils';
|
|
73
|
+
export {
|
|
74
|
+
arrowFindUtf8,
|
|
75
|
+
getArrowUtf8ColumnSource,
|
|
76
|
+
getArrowUtf8RowView,
|
|
77
|
+
getUtf8ColumnSourceRowView,
|
|
78
|
+
makeUtf8StringView,
|
|
79
|
+
type Utf8ColumnSource,
|
|
80
|
+
type Utf8ColumnSourceChunk,
|
|
81
|
+
type Utf8StringView
|
|
82
|
+
} from './utils/utf8-string-view';
|
|
9
83
|
export {validateViewState, mergeViewStates, type OptionalViewState} from './views/view-state-utils';
|
|
10
84
|
export {makeLayerFilter} from './views/layer-filter';
|
|
85
|
+
export {
|
|
86
|
+
DEFAULT_BOUNDS_EPSILON,
|
|
87
|
+
boundsAreEqual,
|
|
88
|
+
getViewportBoundsForViewState,
|
|
89
|
+
isBoundsCompletelyOutside,
|
|
90
|
+
type BoundsEqualityOptions,
|
|
91
|
+
type ViewportBounds
|
|
92
|
+
} from './views/viewport-bounds-utils';
|
|
93
|
+
export {
|
|
94
|
+
type LayerFilter,
|
|
95
|
+
type LayerBoundsFilterDecision,
|
|
96
|
+
type LayerBoundsFilterOptions,
|
|
97
|
+
combineLayerFilters,
|
|
98
|
+
createViewportBoundsFilter
|
|
99
|
+
} from './views/layer-bounds-filter';
|
|
11
100
|
|
|
12
101
|
export {
|
|
13
102
|
HEADER_VIEW_HEIGHT,
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
// deck.gl-community
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import {CompositeLayer} from '@deck.gl/core';
|
|
6
|
+
|
|
7
|
+
import {
|
|
8
|
+
AnimationFramesGroup,
|
|
9
|
+
AnimationState,
|
|
10
|
+
resolveAnimationFrames,
|
|
11
|
+
resolveProps
|
|
12
|
+
} from './animation';
|
|
13
|
+
|
|
14
|
+
import type {CompositeLayerProps, Layer} from '@deck.gl/core';
|
|
15
|
+
|
|
16
|
+
/** Properties supported by {@link AnimationLayer}. */
|
|
17
|
+
export type AnimationLayerProps<LayerT extends Layer> = CompositeLayerProps &
|
|
18
|
+
_AnimationLayerProps<LayerT>;
|
|
19
|
+
|
|
20
|
+
type _AnimationLayerProps<LayerT extends Layer> = {
|
|
21
|
+
/** Base child layer cloned for each animation frame. */
|
|
22
|
+
layer: LayerT;
|
|
23
|
+
/** Frames that describe how child layer props change over time. */
|
|
24
|
+
frames: AnimationFramesGroup<LayerT>;
|
|
25
|
+
/** Number of additional animation iterations after the first pass. @defaultValue 0 */
|
|
26
|
+
repeat?: number;
|
|
27
|
+
/** Whether repeated frames restart or alternate in reverse. @defaultValue 'loop' */
|
|
28
|
+
repeatType?: 'loop' | 'reverse';
|
|
29
|
+
/** Delay in milliseconds before each repeated iteration. @defaultValue 0 */
|
|
30
|
+
repeatDelay?: number;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/** A composite layer that animates its child layer with composable frames. */
|
|
34
|
+
export class AnimationLayer<LayerT extends Layer> extends CompositeLayer<
|
|
35
|
+
_AnimationLayerProps<LayerT>
|
|
36
|
+
> {
|
|
37
|
+
static override layerName = 'AnimationLayer';
|
|
38
|
+
|
|
39
|
+
override state: {
|
|
40
|
+
layer?: LayerT;
|
|
41
|
+
animationState?: AnimationState<LayerT>;
|
|
42
|
+
} = {};
|
|
43
|
+
|
|
44
|
+
// Hack - hijacking another flag to force updates
|
|
45
|
+
override hasUniformTransition(): boolean {
|
|
46
|
+
if (!this.props.visible) return false;
|
|
47
|
+
const {animationState} = this.state;
|
|
48
|
+
return !animationState || animationState.inProgress;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
override updateState(): void {
|
|
52
|
+
if (!this.props.visible) {
|
|
53
|
+
// Disable animation when visible=false
|
|
54
|
+
this.state.animationState = undefined;
|
|
55
|
+
this.state.layer = undefined;
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const time = this.context.timeline.getTime();
|
|
60
|
+
const baseLayer = this.props.layer.clone({
|
|
61
|
+
parameters: {
|
|
62
|
+
...this.props.layer.props.parameters,
|
|
63
|
+
...this.props.parameters
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
let {animationState} = this.state;
|
|
67
|
+
let layer = baseLayer;
|
|
68
|
+
|
|
69
|
+
while (true) {
|
|
70
|
+
if (animationState?.inProgress) {
|
|
71
|
+
const nextProps = resolveProps(layer, animationState.frames, time - animationState.start);
|
|
72
|
+
nextProps['id'] = `${this.id}-animation-layer`;
|
|
73
|
+
layer = baseLayer.clone(nextProps);
|
|
74
|
+
animationState.inProgress = time < animationState.end;
|
|
75
|
+
this.setNeedsRedraw();
|
|
76
|
+
}
|
|
77
|
+
const nextState = resolveAnimationFrames(
|
|
78
|
+
time,
|
|
79
|
+
this.props as _AnimationLayerProps<LayerT>,
|
|
80
|
+
animationState
|
|
81
|
+
);
|
|
82
|
+
if (nextState === animationState) break;
|
|
83
|
+
animationState = nextState;
|
|
84
|
+
}
|
|
85
|
+
this.state.animationState = animationState;
|
|
86
|
+
this.state.layer = layer;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
override renderLayers() {
|
|
90
|
+
return this.state.layer!;
|
|
91
|
+
}
|
|
92
|
+
}
|