@deck.gl-community/graph-layers 9.0.1 → 9.1.0-beta.2
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/LICENSE +1 -1
- package/dist/core/cache.d.ts +1 -0
- package/dist/core/cache.d.ts.map +1 -0
- package/dist/core/constants.d.ts +1 -0
- package/dist/core/constants.d.ts.map +1 -0
- package/dist/core/constants.js +1 -1
- package/dist/core/graph-engine.d.ts +17 -7
- package/dist/core/graph-engine.d.ts.map +1 -0
- package/dist/core/graph-engine.js +14 -5
- package/dist/core/graph-layout.d.ts +69 -0
- package/dist/core/graph-layout.d.ts.map +1 -0
- package/dist/core/{base-layout.js → graph-layout.js} +63 -80
- package/dist/core/interaction-manager.d.ts +3 -2
- package/dist/core/interaction-manager.d.ts.map +1 -0
- package/dist/core/interaction-manager.js +1 -1
- package/dist/{core → graph}/edge.d.ts +20 -18
- package/dist/graph/edge.d.ts.map +1 -0
- package/dist/{core → graph}/edge.js +12 -15
- package/dist/{core → graph}/graph.d.ts +37 -33
- package/dist/graph/graph.d.ts.map +1 -0
- package/dist/{core → graph}/graph.js +44 -37
- package/dist/{core → graph}/node.d.ts +22 -21
- package/dist/graph/node.d.ts.map +1 -0
- package/dist/{core → graph}/node.js +16 -18
- package/dist/index.cjs +1181 -434
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +22 -19
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +24 -23
- package/dist/layers/common-layers/flow-path-layer/flow-path-layer-fragment.glsl.d.ts +1 -0
- package/dist/layers/common-layers/flow-path-layer/flow-path-layer-fragment.glsl.d.ts.map +1 -0
- package/dist/layers/common-layers/flow-path-layer/flow-path-layer-vertex-tf.glsl.d.ts +1 -0
- package/dist/layers/common-layers/flow-path-layer/flow-path-layer-vertex-tf.glsl.d.ts.map +1 -0
- package/dist/layers/common-layers/flow-path-layer/flow-path-layer-vertex.glsl.d.ts +1 -0
- package/dist/layers/common-layers/flow-path-layer/flow-path-layer-vertex.glsl.d.ts.map +1 -0
- package/dist/layers/common-layers/flow-path-layer/flow-path-layer.d.ts +1 -0
- package/dist/layers/common-layers/flow-path-layer/flow-path-layer.d.ts.map +1 -0
- package/dist/layers/common-layers/marker-layer/atlas-data-url.d.ts +1 -0
- package/dist/layers/common-layers/marker-layer/atlas-data-url.d.ts.map +1 -0
- package/dist/layers/common-layers/marker-layer/marker-layer.d.ts +1 -0
- package/dist/layers/common-layers/marker-layer/marker-layer.d.ts.map +1 -0
- package/dist/layers/common-layers/marker-layer/marker-layer.js +2 -2
- package/dist/layers/common-layers/marker-layer/marker-list.d.ts +1 -0
- package/dist/layers/common-layers/marker-layer/marker-list.d.ts.map +1 -0
- package/dist/layers/common-layers/marker-layer/marker-mapping.d.ts +1 -0
- package/dist/layers/common-layers/marker-layer/marker-mapping.d.ts.map +1 -0
- package/dist/layers/common-layers/spline-layer/spline-layer.d.ts +1 -0
- package/dist/layers/common-layers/spline-layer/spline-layer.d.ts.map +1 -0
- package/dist/layers/common-layers/zoomable-text-layer/zoomable-text-layer.d.ts +1 -0
- package/dist/layers/common-layers/zoomable-text-layer/zoomable-text-layer.d.ts.map +1 -0
- package/dist/layers/edge-layer.d.ts +4 -3
- package/dist/layers/edge-layer.d.ts.map +1 -0
- package/dist/layers/edge-layer.js +4 -4
- package/dist/layers/edge-layers/curved-edge-layer.d.ts +2 -1
- package/dist/layers/edge-layers/curved-edge-layer.d.ts.map +1 -0
- package/dist/layers/edge-layers/curved-edge-layer.js +1 -1
- package/dist/layers/edge-layers/edge-label-layer.d.ts +2 -1
- package/dist/layers/edge-layers/edge-label-layer.d.ts.map +1 -0
- package/dist/layers/edge-layers/edge-label-layer.js +1 -1
- package/dist/layers/edge-layers/flow-layer.d.ts +2 -1
- package/dist/layers/edge-layers/flow-layer.d.ts.map +1 -0
- package/dist/layers/edge-layers/flow-layer.js +1 -1
- package/dist/layers/edge-layers/path-edge-layer.d.ts +1 -0
- package/dist/layers/edge-layers/path-edge-layer.d.ts.map +1 -0
- package/dist/layers/edge-layers/straight-line-edge-layer.d.ts +1 -0
- package/dist/layers/edge-layers/straight-line-edge-layer.d.ts.map +1 -0
- package/dist/layers/graph-layer.d.ts +54 -13
- package/dist/layers/graph-layer.d.ts.map +1 -0
- package/dist/layers/graph-layer.js +93 -51
- package/dist/layers/node-layers/circle-layer.d.ts +1 -0
- package/dist/layers/node-layers/circle-layer.d.ts.map +1 -0
- package/dist/layers/node-layers/image-layer.d.ts +1 -0
- package/dist/layers/node-layers/image-layer.d.ts.map +1 -0
- package/dist/layers/node-layers/label-layer.d.ts +2 -1
- package/dist/layers/node-layers/label-layer.d.ts.map +1 -0
- package/dist/layers/node-layers/label-layer.js +1 -1
- package/dist/layers/node-layers/{path-rounded-rectange-layer.d.ts → path-rounded-rectangle-layer.d.ts} +1 -0
- package/dist/layers/node-layers/path-rounded-rectangle-layer.d.ts.map +1 -0
- package/dist/layers/node-layers/{path-rounded-rectange-layer.js → path-rounded-rectangle-layer.js} +1 -1
- package/dist/layers/node-layers/rectangle-layer.d.ts +1 -0
- package/dist/layers/node-layers/rectangle-layer.d.ts.map +1 -0
- package/dist/layers/node-layers/rounded-rectangle-layer-fragment.d.ts +2 -1
- package/dist/layers/node-layers/rounded-rectangle-layer-fragment.d.ts.map +1 -0
- package/dist/layers/node-layers/rounded-rectangle-layer-fragment.js +1 -3
- package/dist/layers/node-layers/rounded-rectangle-layer.d.ts +14 -4
- package/dist/layers/node-layers/rounded-rectangle-layer.d.ts.map +1 -0
- package/dist/layers/node-layers/rounded-rectangle-layer.js +27 -13
- package/dist/layers/node-layers/zoomable-marker-layer.d.ts +2 -1
- package/dist/layers/node-layers/zoomable-marker-layer.d.ts.map +1 -0
- package/dist/layers/node-layers/zoomable-marker-layer.js +1 -1
- package/dist/layouts/d3-force/d3-force-layout.d.ts +13 -3
- package/dist/layouts/d3-force/d3-force-layout.d.ts.map +1 -0
- package/dist/layouts/d3-force/d3-force-layout.js +12 -12
- package/dist/layouts/d3-force/worker.d.ts +1 -0
- package/dist/layouts/d3-force/worker.d.ts.map +1 -0
- package/dist/layouts/experimental/force-multi-graph-layout.d.ts +43 -0
- package/dist/layouts/experimental/force-multi-graph-layout.d.ts.map +1 -0
- package/dist/layouts/experimental/force-multi-graph-layout.js +226 -0
- package/dist/layouts/experimental/hive-plot-layout.d.ts +34 -0
- package/dist/layouts/experimental/hive-plot-layout.d.ts.map +1 -0
- package/dist/layouts/experimental/hive-plot-layout.js +142 -0
- package/dist/layouts/experimental/radial-layout.d.ts +28 -0
- package/dist/layouts/experimental/radial-layout.d.ts.map +1 -0
- package/dist/layouts/experimental/radial-layout.js +164 -0
- package/dist/layouts/gpu-force/gpu-force-layout.d.ts +16 -3
- package/dist/layouts/gpu-force/gpu-force-layout.d.ts.map +1 -0
- package/dist/layouts/gpu-force/gpu-force-layout.js +21 -19
- package/dist/layouts/gpu-force/worker.d.ts +1 -0
- package/dist/layouts/gpu-force/worker.d.ts.map +1 -0
- package/dist/layouts/simple-layout.d.ts +42 -0
- package/dist/layouts/simple-layout.d.ts.map +1 -0
- package/dist/layouts/{simple-layout/simple-layout.js → simple-layout.js} +8 -7
- package/dist/loaders/create-graph.d.ts +13 -0
- package/dist/loaders/create-graph.d.ts.map +1 -0
- package/dist/{utils → loaders}/create-graph.js +9 -4
- package/dist/loaders/edge-parsers.d.ts +3 -6
- package/dist/loaders/edge-parsers.d.ts.map +1 -0
- package/dist/loaders/edge-parsers.js +1 -1
- package/dist/loaders/json-loader.d.ts +3 -2
- package/dist/loaders/json-loader.d.ts.map +1 -0
- package/dist/loaders/json-loader.js +4 -4
- package/dist/loaders/node-parsers.d.ts +3 -3
- package/dist/loaders/node-parsers.d.ts.map +1 -0
- package/dist/loaders/node-parsers.js +1 -1
- package/dist/loaders/simple-json-graph-loader.d.ts +12 -0
- package/dist/loaders/simple-json-graph-loader.d.ts.map +1 -0
- package/dist/loaders/simple-json-graph-loader.js +20 -0
- package/dist/loaders/table-graph-loader.d.ts +17 -0
- package/dist/loaders/table-graph-loader.d.ts.map +1 -0
- package/dist/loaders/table-graph-loader.js +91 -0
- package/dist/style/style-property.d.ts +1 -0
- package/dist/style/style-property.d.ts.map +1 -0
- package/dist/style/style-property.js +1 -1
- package/dist/style/style-sheet.d.ts +1 -0
- package/dist/style/style-sheet.d.ts.map +1 -0
- package/dist/style/style-sheet.js +3 -3
- package/dist/utils/layer-utils.d.ts +1 -0
- package/dist/utils/layer-utils.d.ts.map +1 -0
- package/dist/utils/log.d.ts +2 -1
- package/dist/utils/log.d.ts.map +1 -0
- package/dist/utils/log.js +3 -3
- package/dist/utils/polygon-calculations.d.ts +1 -0
- package/dist/utils/polygon-calculations.d.ts.map +1 -0
- package/dist/widgets/long-press-button.d.ts +13 -0
- package/dist/widgets/long-press-button.d.ts.map +1 -0
- package/dist/widgets/long-press-button.js +31 -0
- package/dist/widgets/view-control-widget.d.ts +78 -0
- package/dist/widgets/view-control-widget.d.ts.map +1 -0
- package/dist/widgets/view-control-widget.js +194 -0
- package/package.json +8 -7
- package/src/core/graph-engine.ts +30 -10
- package/src/core/graph-layout.ts +146 -0
- package/src/core/interaction-manager.ts +2 -2
- package/src/{core → graph}/edge.ts +19 -17
- package/src/{core → graph}/graph.ts +51 -36
- package/src/{core → graph}/node.ts +21 -20
- package/src/index.ts +28 -28
- package/src/layers/graph-layer.ts +133 -46
- package/src/layers/node-layers/rounded-rectangle-layer-fragment.ts +1 -3
- package/src/layers/node-layers/rounded-rectangle-layer.ts +34 -10
- package/src/layouts/d3-force/d3-force-layout.ts +21 -11
- package/src/layouts/experimental/force-multi-graph-layout.ts +268 -0
- package/src/layouts/experimental/hive-plot-layout.ts +182 -0
- package/src/layouts/experimental/radial-layout.ts +210 -0
- package/src/layouts/gpu-force/gpu-force-layout.ts +32 -17
- package/src/layouts/{simple-layout/simple-layout.ts → simple-layout.ts} +34 -19
- package/src/{utils → loaders}/create-graph.ts +9 -4
- package/src/loaders/edge-parsers.ts +2 -1
- package/src/loaders/json-loader.ts +1 -1
- package/src/loaders/node-parsers.ts +2 -1
- package/src/loaders/simple-json-graph-loader.ts +28 -0
- package/src/loaders/table-graph-loader.ts +124 -0
- package/src/utils/log.ts +3 -3
- package/src/widgets/long-press-button.tsx +50 -0
- package/src/widgets/view-control-widget.tsx +337 -0
- package/dist/core/base-layout.d.ts +0 -71
- package/dist/layouts/simple-layout/simple-layout.d.ts +0 -22
- package/dist/utils/create-graph.d.ts +0 -8
- package/src/core/base-layout.ts +0 -154
- /package/src/layers/node-layers/{path-rounded-rectange-layer.ts → path-rounded-rectangle-layer.ts} +0 -0
- /package/src/layouts/d3-force/{worker.ts → worker.js} +0 -0
- /package/src/layouts/gpu-force/{worker.ts → worker.js} +0 -0
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
// deck.gl-community
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
|
-
import {
|
|
5
|
-
import { EDGE_TYPE } from
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
4
|
+
import { GraphLayout } from "../../core/graph-layout.js";
|
|
5
|
+
import { EDGE_TYPE } from "../../core/constants.js";
|
|
6
|
+
/**
|
|
7
|
+
* @todo this layout should be updated with the organizational and logic improvements made in d3-force
|
|
8
|
+
*/
|
|
9
|
+
export class GPUForceLayout extends GraphLayout {
|
|
10
|
+
static defaultOptions = {
|
|
11
|
+
alpha: 0.3,
|
|
12
|
+
resumeAlpha: 0.1,
|
|
13
|
+
nBodyStrength: -900,
|
|
14
|
+
nBodyDistanceMin: 100,
|
|
15
|
+
nBodyDistanceMax: 400,
|
|
16
|
+
getCollisionRadius: 0
|
|
17
|
+
};
|
|
16
18
|
_name = 'GPU';
|
|
17
19
|
_d3Graph;
|
|
18
20
|
_nodeMap;
|
|
@@ -20,13 +22,14 @@ export class GPUForceLayout extends BaseLayout {
|
|
|
20
22
|
_graph;
|
|
21
23
|
_worker;
|
|
22
24
|
_callbacks;
|
|
23
|
-
constructor(options) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
this._options = {
|
|
27
|
-
...defaultOptions,
|
|
25
|
+
constructor(options = {}) {
|
|
26
|
+
const _options = {
|
|
27
|
+
...GPUForceLayout.defaultOptions,
|
|
28
28
|
...options
|
|
29
29
|
};
|
|
30
|
+
super(_options);
|
|
31
|
+
this._name = 'GPU';
|
|
32
|
+
this._options = _options;
|
|
30
33
|
// store graph and prepare internal data
|
|
31
34
|
this._d3Graph = { nodes: [], edges: [] };
|
|
32
35
|
this._nodeMap = {};
|
|
@@ -82,8 +85,7 @@ export class GPUForceLayout extends BaseLayout {
|
|
|
82
85
|
this._worker.terminate();
|
|
83
86
|
}
|
|
84
87
|
this._worker = new Worker(new URL('./worker.js', import.meta.url).href);
|
|
85
|
-
const { alpha, nBodyStrength, nBodyDistanceMin, nBodyDistanceMax, getCollisionRadius } = this
|
|
86
|
-
._options;
|
|
88
|
+
const { alpha, nBodyStrength, nBodyDistanceMin, nBodyDistanceMax, getCollisionRadius } = this._options;
|
|
87
89
|
this._worker.postMessage({
|
|
88
90
|
nodes: this._d3Graph.nodes,
|
|
89
91
|
edges: this._d3Graph.edges,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=worker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../../../src/layouts/gpu-force/worker.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { GraphLayout, GraphLayoutOptions } from "../core/graph-layout.js";
|
|
2
|
+
import { Node } from "../graph/node.js";
|
|
3
|
+
import { Graph } from "../graph/graph.js";
|
|
4
|
+
export type SimpleLayoutOptions = GraphLayoutOptions & {
|
|
5
|
+
/** The accessor lets the application supply the position ([x, y]) of each node.
|
|
6
|
+
* @example
|
|
7
|
+
```js
|
|
8
|
+
<GraphGL
|
|
9
|
+
{...otherProps}
|
|
10
|
+
layout={
|
|
11
|
+
new SimpleLayout({
|
|
12
|
+
nodePositionAccessor: node => [
|
|
13
|
+
node.getPropertyValue('x'),
|
|
14
|
+
node.getPropertyValue('y'),
|
|
15
|
+
]
|
|
16
|
+
})
|
|
17
|
+
}
|
|
18
|
+
/>
|
|
19
|
+
```
|
|
20
|
+
*/
|
|
21
|
+
nodePositionAccessor?: (node: Node) => [number, number];
|
|
22
|
+
};
|
|
23
|
+
/** A basic layout where the application controls positions of each node */
|
|
24
|
+
export declare class SimpleLayout extends GraphLayout<SimpleLayoutOptions> {
|
|
25
|
+
static defaultOptions: Required<SimpleLayoutOptions>;
|
|
26
|
+
protected readonly _name = "SimpleLayout";
|
|
27
|
+
protected _graph: Graph | null;
|
|
28
|
+
protected _nodeMap: Record<string, Node>;
|
|
29
|
+
protected _nodePositionMap: Record<string, (node: Node) => [number, number]>;
|
|
30
|
+
constructor(options?: SimpleLayoutOptions);
|
|
31
|
+
initializeGraph(graph: Graph): void;
|
|
32
|
+
_notifyLayoutComplete(): void;
|
|
33
|
+
start(): void;
|
|
34
|
+
update(): void;
|
|
35
|
+
resume(): void;
|
|
36
|
+
updateGraph(graph: Graph): void;
|
|
37
|
+
setNodePositionAccessor: (accessor: any) => void;
|
|
38
|
+
getNodePosition: (node: any) => any;
|
|
39
|
+
getEdgePosition: (edge: any) => any;
|
|
40
|
+
lockNodePosition: (node: any, x: any, y: any) => void;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=simple-layout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"simple-layout.d.ts","sourceRoot":"","sources":["../../src/layouts/simple-layout.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,WAAW,EAAE,kBAAkB,EAAC,gCAA6B;AACrE,OAAO,EAAC,IAAI,EAAC,yBAAsB;AAEnC,OAAO,EAAC,KAAK,EAAC,0BAAuB;AAErC,MAAM,MAAM,mBAAmB,GAAG,kBAAkB,GAAG;IACrD;;;;;;;;;;;;;;;MAeE;IACF,oBAAoB,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACzD,CAAC;AAEF,2EAA2E;AAC3E,qBAAa,YAAa,SAAQ,WAAW,CAAC,mBAAmB,CAAC;IAChE,MAAM,CAAC,cAAc,EAAE,QAAQ,CAAC,mBAAmB,CAAC,CAGlD;IAEF,SAAS,CAAC,QAAQ,CAAC,KAAK,kBAAkB;IAC1C,SAAS,CAAC,MAAM,EAAE,KAAK,GAAG,IAAI,CAAQ;IACtC,SAAS,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAM;IAC9C,SAAS,CAAC,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAM;gBAEtE,OAAO,GAAE,mBAAwB;IAI7C,eAAe,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;IAInC,qBAAqB,IAAI,IAAI;IAM7B,KAAK,IAAI,IAAI;IAIb,MAAM,IAAI,IAAI;IAId,MAAM,IAAI,IAAI;IAId,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;IAY/B,uBAAuB,0BAErB;IAEF,eAAe,iBAAoD,GAAG,CAAC;IAEvE,eAAe,iBAQR,GAAG,CACR;IAEF,gBAAgB,sCAId;CACH"}
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
// deck.gl-community
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
|
-
import {
|
|
5
|
-
import { EDGE_TYPE } from
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
import { GraphLayout } from "../core/graph-layout.js";
|
|
5
|
+
import { EDGE_TYPE } from "../core/constants.js";
|
|
6
|
+
/** A basic layout where the application controls positions of each node */
|
|
7
|
+
export class SimpleLayout extends GraphLayout {
|
|
8
|
+
static defaultOptions = {
|
|
9
|
+
nodePositionAccessor: (node) => [node.getPropertyValue('x'), node.getPropertyValue('y')]
|
|
10
|
+
};
|
|
10
11
|
_name = 'SimpleLayout';
|
|
11
12
|
_graph = null;
|
|
12
13
|
_nodeMap = {};
|
|
13
14
|
_nodePositionMap = {};
|
|
14
15
|
constructor(options = {}) {
|
|
15
|
-
super({ ...defaultOptions, ...options });
|
|
16
|
+
super({ ...SimpleLayout.defaultOptions, ...options });
|
|
16
17
|
}
|
|
17
18
|
initializeGraph(graph) {
|
|
18
19
|
this.updateGraph(graph);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Graph } from "../graph/graph.js";
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated Use `new Graph(name, nodes, edges)`
|
|
4
|
+
* Create a graph from a list of Nodes and edges
|
|
5
|
+
*/
|
|
6
|
+
export declare function createGraph(props: {
|
|
7
|
+
name: any;
|
|
8
|
+
nodes: any;
|
|
9
|
+
edges: any;
|
|
10
|
+
nodeParser: any;
|
|
11
|
+
edgeParser: any;
|
|
12
|
+
}): Graph;
|
|
13
|
+
//# sourceMappingURL=create-graph.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-graph.d.ts","sourceRoot":"","sources":["../../src/loaders/create-graph.ts"],"names":[],"mappings":"AAMA,OAAO,EAAC,KAAK,EAAC,0BAAuB;AAErC;;;GAGG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE;IAAC,IAAI,MAAC;IAAC,KAAK,MAAC;IAAC,KAAK,MAAC;IAAC,UAAU,MAAC;IAAC,UAAU,MAAA;CAAC,SA8B9E"}
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
// deck.gl-community
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
|
-
import { Edge } from
|
|
5
|
-
import { Node } from
|
|
6
|
-
import { Graph } from
|
|
7
|
-
|
|
4
|
+
import { Edge } from "../graph/edge.js";
|
|
5
|
+
import { Node } from "../graph/node.js";
|
|
6
|
+
import { Graph } from "../graph/graph.js";
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated Use `new Graph(name, nodes, edges)`
|
|
9
|
+
* Create a graph from a list of Nodes and edges
|
|
10
|
+
*/
|
|
11
|
+
export function createGraph(props) {
|
|
12
|
+
const { name, nodes, edges, nodeParser, edgeParser } = props;
|
|
8
13
|
// create a new empty graph
|
|
9
14
|
const graph = new Graph();
|
|
10
15
|
const graphName = name || Date.now();
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
sourceId: any;
|
|
5
|
-
targetId: any;
|
|
6
|
-
};
|
|
1
|
+
import type { EdgeOptions } from "../graph/edge.js";
|
|
2
|
+
export declare function basicEdgeParser(edge: any): Omit<EdgeOptions, 'data'>;
|
|
3
|
+
//# sourceMappingURL=edge-parsers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edge-parsers.d.ts","sourceRoot":"","sources":["../../src/loaders/edge-parsers.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,WAAW,EAAC,yBAAsB;AAG/C,wBAAgB,eAAe,CAAC,IAAI,EAAE,GAAG,GAAG,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,CAcpE"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// deck.gl-community
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
|
-
import { log } from
|
|
4
|
+
import { log } from "../utils/log.js";
|
|
5
5
|
export function basicEdgeParser(edge) {
|
|
6
6
|
const { id, directed, sourceId, targetId } = edge;
|
|
7
7
|
if (sourceId === undefined || targetId === undefined) {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { basicNodeParser } from
|
|
2
|
-
import { basicEdgeParser } from
|
|
1
|
+
import { basicNodeParser } from "./node-parsers.js";
|
|
2
|
+
import { basicEdgeParser } from "./edge-parsers.js";
|
|
3
3
|
export declare const JSONLoader: ({ json, nodeParser, edgeParser }: {
|
|
4
4
|
json: any;
|
|
5
5
|
nodeParser?: typeof basicNodeParser;
|
|
6
6
|
edgeParser?: typeof basicEdgeParser;
|
|
7
7
|
}) => import("..").Graph;
|
|
8
|
+
//# sourceMappingURL=json-loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-loader.d.ts","sourceRoot":"","sources":["../../src/loaders/json-loader.ts"],"names":[],"mappings":"AAKA,OAAO,EAAC,eAAe,EAAC,0BAAuB;AAC/C,OAAO,EAAC,eAAe,EAAC,0BAAuB;AAG/C,eAAO,MAAM,UAAU;;;;wBAStB,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// deck.gl-community
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
|
-
import { createGraph } from
|
|
5
|
-
import { basicNodeParser } from
|
|
6
|
-
import { basicEdgeParser } from
|
|
7
|
-
import { log } from
|
|
4
|
+
import { createGraph } from "./create-graph.js";
|
|
5
|
+
import { basicNodeParser } from "./node-parsers.js";
|
|
6
|
+
import { basicEdgeParser } from "./edge-parsers.js";
|
|
7
|
+
import { log } from "../utils/log.js";
|
|
8
8
|
export const JSONLoader = ({ json, nodeParser = basicNodeParser, edgeParser = basicEdgeParser }) => {
|
|
9
9
|
const { name = 'default', nodes, edges } = json;
|
|
10
10
|
if (!nodes) {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import type { NodeOptions } from "../graph/node.js";
|
|
2
|
+
export declare function basicNodeParser(node: any): Pick<NodeOptions, 'id'>;
|
|
3
|
+
//# sourceMappingURL=node-parsers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-parsers.d.ts","sourceRoot":"","sources":["../../src/loaders/node-parsers.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,WAAW,EAAC,yBAAsB;AAG/C,wBAAgB,eAAe,CAAC,IAAI,EAAE,GAAG,GAAG,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,CAMlE"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// deck.gl-community
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
|
-
import { log } from
|
|
4
|
+
import { log } from "../utils/log.js";
|
|
5
5
|
export function basicNodeParser(node) {
|
|
6
6
|
if (node.id === undefined) {
|
|
7
7
|
log.error('Invalid node: id is missing.')();
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** @deprecated Use loadSimpleJSONGraph */
|
|
2
|
+
export declare const JSONLoader: ({ json, nodeParser, edgeParser }: {
|
|
3
|
+
json: any;
|
|
4
|
+
nodeParser: any;
|
|
5
|
+
edgeParser: any;
|
|
6
|
+
}) => import("..").Graph;
|
|
7
|
+
/** A loader for a simple graph format */
|
|
8
|
+
export declare function loadSimpleJSONGraph(json: Record<string, unknown>, options?: {
|
|
9
|
+
nodeParser: any;
|
|
10
|
+
edgeParser: any;
|
|
11
|
+
}): import("..").Graph;
|
|
12
|
+
//# sourceMappingURL=simple-json-graph-loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"simple-json-graph-loader.d.ts","sourceRoot":"","sources":["../../src/loaders/simple-json-graph-loader.ts"],"names":[],"mappings":"AASA,0CAA0C;AAC1C,eAAO,MAAM,UAAU;;;;wBAC8B,CAAC;AAEtD,0CAA0C;AAC1C,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,OAAO,CAAC,EAAE;IAAC,UAAU,MAAC;IAAC,UAAU,MAAA;CAAC,sBAWnC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// deck.gl-community
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
import { createGraph } from "./create-graph.js";
|
|
5
|
+
import { log } from "../utils/log.js";
|
|
6
|
+
import { basicNodeParser } from "./node-parsers.js";
|
|
7
|
+
import { basicEdgeParser } from "./edge-parsers.js";
|
|
8
|
+
/** @deprecated Use loadSimpleJSONGraph */
|
|
9
|
+
export const JSONLoader = ({ json, nodeParser, edgeParser }) => loadSimpleJSONGraph(json, { nodeParser, edgeParser });
|
|
10
|
+
/** A loader for a simple graph format */
|
|
11
|
+
export function loadSimpleJSONGraph(json, options) {
|
|
12
|
+
const { nodeParser = basicNodeParser, edgeParser = basicEdgeParser } = options;
|
|
13
|
+
const { name = 'default', nodes, edges } = json;
|
|
14
|
+
if (!nodes) {
|
|
15
|
+
log.error('Invalid graph: nodes is missing.')();
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
const graph = createGraph({ name, nodes, edges, nodeParser, edgeParser });
|
|
19
|
+
return graph;
|
|
20
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { NodeOptions } from "../graph/node.js";
|
|
2
|
+
import type { EdgeOptions } from "../graph/edge.js";
|
|
3
|
+
import { Graph } from "../graph/graph.js";
|
|
4
|
+
export type ParseGraphOptions = {
|
|
5
|
+
nodeIdField?: string;
|
|
6
|
+
edgeSourceField?: string;
|
|
7
|
+
edgeTargetField?: string;
|
|
8
|
+
edgeDirectedField?: string;
|
|
9
|
+
edgeDirected?: boolean;
|
|
10
|
+
nodeParser?: (nodeRow: any) => NodeOptions;
|
|
11
|
+
edgeParser?: (edgeRow: any) => EdgeOptions;
|
|
12
|
+
};
|
|
13
|
+
export declare function tableGraphLoader(tables: {
|
|
14
|
+
nodes: any[];
|
|
15
|
+
edges: any[];
|
|
16
|
+
}, options?: ParseGraphOptions): Graph;
|
|
17
|
+
//# sourceMappingURL=table-graph-loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-graph-loader.d.ts","sourceRoot":"","sources":["../../src/loaders/table-graph-loader.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,WAAW,EAAC,yBAAsB;AAC/C,OAAO,KAAK,EAAC,WAAW,EAAC,yBAAsB;AAG/C,OAAO,EAAC,KAAK,EAAC,0BAAuB;AAIrC,MAAM,MAAM,iBAAiB,GAAG;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,WAAW,CAAC;IAC3C,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,WAAW,CAAC;CAC5C,CAAC;AAqBF,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE;IAAC,KAAK,EAAE,GAAG,EAAE,CAAC;IAAC,KAAK,EAAE,GAAG,EAAE,CAAA;CAAC,EACpC,OAAO,CAAC,EAAE,iBAAiB,GAC1B,KAAK,CAuDP"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
// deck.gl-community
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
import { Edge } from "../graph/edge.js";
|
|
5
|
+
import { Node } from "../graph/node.js";
|
|
6
|
+
import { Graph } from "../graph/graph.js";
|
|
7
|
+
import { log } from "../utils/log.js";
|
|
8
|
+
const defaultParseGraphOptions = {
|
|
9
|
+
nodeIdField: 'id',
|
|
10
|
+
edgeSourceField: 'sourceId',
|
|
11
|
+
edgeTargetField: 'targetId',
|
|
12
|
+
edgeDirectedField: undefined,
|
|
13
|
+
edgeDirected: false
|
|
14
|
+
// nodeParser: (nodeRow: any, options: ParseGraphOptions) => ({id: nodeRow.name, data: nodeRow}),
|
|
15
|
+
// edgeParser: (edgeRow: any, nodeIndexMap, options: ParseGraphOptions)=> {
|
|
16
|
+
// const sourceNodeId = edge[options.edgeSourceField];
|
|
17
|
+
// const targetNodeId = edge[options.edgeTargetField];
|
|
18
|
+
// return {
|
|
19
|
+
// id: `${sourceNodeId}-${targetNodeId}`,
|
|
20
|
+
// sourceId: nodeIndexMap[sourceNodeId],
|
|
21
|
+
// targetId: nodeIndexMap[targetNodeId],
|
|
22
|
+
// directed: true
|
|
23
|
+
// };
|
|
24
|
+
// };
|
|
25
|
+
};
|
|
26
|
+
export function tableGraphLoader(tables, options) {
|
|
27
|
+
options = { ...defaultParseGraphOptions, ...options };
|
|
28
|
+
const { nodes, edges } = tables;
|
|
29
|
+
// const nodeIndexMap = nodes.reduce((res, node, idx) => {
|
|
30
|
+
// res[idx] = node[options.nodeIdField];
|
|
31
|
+
// return res;
|
|
32
|
+
// }, {});
|
|
33
|
+
function defaultNodeParser(nodeRow) {
|
|
34
|
+
return { id: nodeRow[options.nodeIdField] };
|
|
35
|
+
}
|
|
36
|
+
function defaultEdgeParser(edgeRow) {
|
|
37
|
+
const sourceNodeId = edgeRow[options.edgeSourceField];
|
|
38
|
+
const targetNodeId = edgeRow[options.edgeTargetField];
|
|
39
|
+
return {
|
|
40
|
+
id: edgeRow.id || `${sourceNodeId}-${targetNodeId}`,
|
|
41
|
+
sourceId: sourceNodeId,
|
|
42
|
+
targetId: targetNodeId,
|
|
43
|
+
directed: options.edgeDirected
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
const nodeParser = options.nodeParser || defaultNodeParser;
|
|
47
|
+
const edgeParser = options.edgeParser || defaultEdgeParser;
|
|
48
|
+
// add nodes
|
|
49
|
+
if (!nodes) {
|
|
50
|
+
log.error('Invalid graph: nodes is missing.')();
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
const glNodes = nodes.map((node) => {
|
|
54
|
+
const { id } = nodeParser(node);
|
|
55
|
+
return new Node({ id, data: node });
|
|
56
|
+
});
|
|
57
|
+
const glEdges = edges.map((edge) => {
|
|
58
|
+
const { id, sourceId, targetId, directed } = edgeParser(edge);
|
|
59
|
+
return new Edge({
|
|
60
|
+
id,
|
|
61
|
+
sourceId,
|
|
62
|
+
targetId,
|
|
63
|
+
directed: directed || false,
|
|
64
|
+
data: edge
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
// create a new empty graph
|
|
68
|
+
const name = 'loaded';
|
|
69
|
+
const graph = new Graph({ name, nodes: glNodes, edges: glEdges });
|
|
70
|
+
return graph;
|
|
71
|
+
}
|
|
72
|
+
// export function basicNodeParser(node: any): Pick<NodeOptions, 'id'> {
|
|
73
|
+
// if (node.id === undefined) {
|
|
74
|
+
// log.error('Invalid node: id is missing.')();
|
|
75
|
+
// return null;
|
|
76
|
+
// }
|
|
77
|
+
// return {id: node.id};
|
|
78
|
+
// }
|
|
79
|
+
// export function basicEdgeParser(edge: any): Omit<EdgeOptions, 'data'> {
|
|
80
|
+
// const {id, directed, sourceId, targetId} = edge;
|
|
81
|
+
// if (sourceId === undefined || targetId === undefined) {
|
|
82
|
+
// log.error('Invalid edge: sourceId or targetId is missing.')();
|
|
83
|
+
// return null;
|
|
84
|
+
// }
|
|
85
|
+
// return {
|
|
86
|
+
// id,
|
|
87
|
+
// directed: directed || false,
|
|
88
|
+
// sourceId,
|
|
89
|
+
// targetId
|
|
90
|
+
// };
|
|
91
|
+
// }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style-property.d.ts","sourceRoot":"","sources":["../../src/style/style-property.ts"],"names":[],"mappings":"AAqKA,qBAAa,aAAa;IACxB,GAAG,EAAE,GAAG,CAAC;IACT,cAAc,EAAE,OAAO,CAAC;IACxB,MAAM,EAAE,GAAG,CAAC;IACZ,UAAU,EAAE,GAAG,CAAC;IAGhB,MAAM,CAAC,UAAU,CAAC,GAAG,KAAA;gBAMT,EAAC,GAAG,EAAE,KAAK,EAAE,aAAa,EAAC;;;;KAAA;IA2CvC,QAAQ;IAIR,gBAAgB;CAGjB"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
import Color from 'color';
|
|
5
|
-
import { log } from
|
|
5
|
+
import { log } from "../utils/log.js";
|
|
6
6
|
/* Utils for type check */
|
|
7
7
|
function getColor(value) {
|
|
8
8
|
if (typeof value === 'string') {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style-sheet.d.ts","sourceRoot":"","sources":["../../src/style/style-sheet.ts"],"names":[],"mappings":"AAsIA,qBAAa,UAAU;IACrB,IAAI,EAAE,GAAG,CAAC;IACV,UAAU,EAAE,GAAG,CAAC;gBACJ,KAAK,KAAA,EAAE,cAAc,KAAA;IA4FjC,YAAY,CAAC,cAAc,KAAA;IAa3B,iBAAiB,CAAC,cAAc,KAAA;IAWhC,8BAA8B,CAAC,cAAc,KAAA;IAS7C,kBAAkB;IAQlB,uBAAuB;CAMxB"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// deck.gl-community
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
|
-
import { StyleProperty } from
|
|
5
|
-
import { NODE_TYPE, EDGE_DECORATOR_TYPE } from
|
|
6
|
-
import { log } from
|
|
4
|
+
import { StyleProperty } from "./style-property.js";
|
|
5
|
+
import { NODE_TYPE, EDGE_DECORATOR_TYPE } from "../core/constants.js";
|
|
6
|
+
import { log } from "../utils/log.js";
|
|
7
7
|
const COMMON_DECKGL_PROPS = {
|
|
8
8
|
getOffset: 'offset',
|
|
9
9
|
opacity: 'opacity'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layer-utils.d.ts","sourceRoot":"","sources":["../../src/utils/layer-utils.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,gBAAgB,2CAkB5B,CAAC"}
|
package/dist/utils/log.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../src/utils/log.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,GAAG,EAAQ,MAAM,eAAe,CAAC;AAEzC,eAAO,MAAM,GAAG,KAAyC,CAAC"}
|
package/dist/utils/log.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// deck.gl-community
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
|
-
import { Log, COLOR } from 'probe.gl';
|
|
5
|
-
export const log = new Log({ id: '
|
|
6
|
-
log.log({ color: COLOR.CYAN }, 'Initialize
|
|
4
|
+
import { Log, COLOR } from '@probe.gl/log';
|
|
5
|
+
export const log = new Log({ id: 'graph-layers' }).enable();
|
|
6
|
+
log.log({ color: COLOR.CYAN }, 'Initialize graph-layers logger.')();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"polygon-calculations.d.ts","sourceRoot":"","sources":["../../src/utils/polygon-calculations.ts"],"names":[],"mappings":"AAIA,wBAAgB,sBAAsB,CAAC,GAAG,KAAA,EAAE,KAAK,KAAA,EAAE,MAAM,KAAA,EAAE,MAAM,KAAA,EAAE,MAAM,SAAK,SA6C7E"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Component } from 'preact';
|
|
2
|
+
export type LongPressButtonProps = {
|
|
3
|
+
onClick: () => void;
|
|
4
|
+
children: any;
|
|
5
|
+
};
|
|
6
|
+
export declare class LongPressButton extends Component<LongPressButtonProps> {
|
|
7
|
+
buttonPressTimer: ReturnType<typeof setTimeout> | null;
|
|
8
|
+
_repeat: () => void;
|
|
9
|
+
_handleButtonPress: () => void;
|
|
10
|
+
_handleButtonRelease: () => void;
|
|
11
|
+
render(): import("preact").JSX.Element;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=long-press-button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"long-press-button.d.ts","sourceRoot":"","sources":["../../src/widgets/long-press-button.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAC,SAAS,EAAC,MAAM,QAAQ,CAAC;AAEjC,MAAM,MAAM,oBAAoB,GAAG;IACjC,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,EAAE,GAAG,CAAC;CACf,CAAC;AAEF,qBAAa,eAAgB,SAAQ,SAAS,CAAC,oBAAoB,CAAC;IAClE,gBAAgB,EAAE,UAAU,CAAC,OAAO,UAAU,CAAC,GAAG,IAAI,CAAQ;IAE9D,OAAO,aAKL;IAEF,kBAAkB,aAEhB;IAEF,oBAAoB,aAKlB;IAEF,MAAM;CAiBP"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx as _jsx } from "preact/jsx-runtime";
|
|
2
|
+
// deck.gl-community
|
|
3
|
+
// SPDX-License-Identifier: MIT
|
|
4
|
+
// Copyright (c) vis.gl contributors
|
|
5
|
+
import { Component } from 'preact';
|
|
6
|
+
export class LongPressButton extends Component {
|
|
7
|
+
buttonPressTimer = null;
|
|
8
|
+
_repeat = () => {
|
|
9
|
+
if (this.buttonPressTimer) {
|
|
10
|
+
this.props.onClick();
|
|
11
|
+
this.buttonPressTimer = setTimeout(this._repeat, 100);
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
_handleButtonPress = () => {
|
|
15
|
+
this.buttonPressTimer = setTimeout(this._repeat, 100);
|
|
16
|
+
};
|
|
17
|
+
_handleButtonRelease = () => {
|
|
18
|
+
if (this.buttonPressTimer) {
|
|
19
|
+
clearTimeout(this.buttonPressTimer);
|
|
20
|
+
}
|
|
21
|
+
this.buttonPressTimer = null;
|
|
22
|
+
};
|
|
23
|
+
render() {
|
|
24
|
+
return (_jsx("div", { className: "deck-widget-button", children: _jsx("div", { style: {
|
|
25
|
+
pointerEvents: 'auto'
|
|
26
|
+
}, onMouseDown: (event) => {
|
|
27
|
+
this._handleButtonPress();
|
|
28
|
+
document.addEventListener('mouseup', this._handleButtonRelease, { once: true });
|
|
29
|
+
}, children: this.props.children }) }));
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { Component } from 'preact';
|
|
2
|
+
import type { Deck, Viewport, Widget, WidgetPlacement } from '@deck.gl/core';
|
|
3
|
+
export declare const ViewControlWrapper: ({ children }: {
|
|
4
|
+
children: any;
|
|
5
|
+
}) => import("preact").JSX.Element;
|
|
6
|
+
export declare const NavigationButtonContainer: ({ children }: {
|
|
7
|
+
children: any;
|
|
8
|
+
}) => import("preact").JSX.Element;
|
|
9
|
+
export type NavigationButtonProps = {
|
|
10
|
+
left: any;
|
|
11
|
+
top: any;
|
|
12
|
+
rotate?: number;
|
|
13
|
+
children?: any;
|
|
14
|
+
onClick?: () => void;
|
|
15
|
+
};
|
|
16
|
+
export declare const NavigationButton: (props: NavigationButtonProps) => import("preact").JSX.Element;
|
|
17
|
+
export declare const ZoomControlWrapper: ({ children }: {
|
|
18
|
+
children: any;
|
|
19
|
+
}) => import("preact").JSX.Element;
|
|
20
|
+
export declare const VerticalSlider: ({ children }: {
|
|
21
|
+
children: any;
|
|
22
|
+
}) => import("preact").JSX.Element;
|
|
23
|
+
export declare const ZoomControlButton: ({ children }: {
|
|
24
|
+
children: any;
|
|
25
|
+
}) => import("preact").JSX.Element;
|
|
26
|
+
export type ViewControlProps = {
|
|
27
|
+
id?: string;
|
|
28
|
+
viewId?: string;
|
|
29
|
+
placement?: WidgetPlacement;
|
|
30
|
+
fitBounds: () => void;
|
|
31
|
+
panBy?: (dx: number, dy: number) => void;
|
|
32
|
+
zoomBy?: (delta: number) => void;
|
|
33
|
+
zoomLevel: number;
|
|
34
|
+
minZoom: number;
|
|
35
|
+
maxZoom: number;
|
|
36
|
+
deltaPan: number;
|
|
37
|
+
deltaZoom: number;
|
|
38
|
+
/** CSS inline style overrides. */
|
|
39
|
+
style?: Partial<CSSStyleDeclaration>;
|
|
40
|
+
/** Additional CSS class. */
|
|
41
|
+
className?: string;
|
|
42
|
+
};
|
|
43
|
+
export declare class ViewControl extends Component<ViewControlProps> {
|
|
44
|
+
static displayName: string;
|
|
45
|
+
static defaultProps: Required<ViewControlProps>;
|
|
46
|
+
panUp: () => void;
|
|
47
|
+
panDown: () => void;
|
|
48
|
+
panLeft: () => void;
|
|
49
|
+
panRight: () => void;
|
|
50
|
+
zoomIn: () => void;
|
|
51
|
+
zoomOut: () => void;
|
|
52
|
+
onChangeZoomLevel: (evt: any) => void;
|
|
53
|
+
render(): import("preact").JSX.Element;
|
|
54
|
+
}
|
|
55
|
+
export declare class ViewControlWidget implements Widget<ViewControlProps> {
|
|
56
|
+
id: string;
|
|
57
|
+
props: ViewControlProps;
|
|
58
|
+
placement: WidgetPlacement;
|
|
59
|
+
orientation: 'vertical' | 'horizontal';
|
|
60
|
+
viewId?: string | null;
|
|
61
|
+
viewports: {
|
|
62
|
+
[id: string]: Viewport;
|
|
63
|
+
};
|
|
64
|
+
deck?: Deck<any>;
|
|
65
|
+
element?: HTMLDivElement;
|
|
66
|
+
constructor(props: ViewControlProps);
|
|
67
|
+
onAdd({ deck }: {
|
|
68
|
+
deck: Deck<any>;
|
|
69
|
+
}): HTMLDivElement;
|
|
70
|
+
onRemove(): void;
|
|
71
|
+
setProps(props: Partial<ViewControlProps>): void;
|
|
72
|
+
onViewportChange(viewport: Viewport): void;
|
|
73
|
+
handleDeltaZoom(deltaZoom: number): void;
|
|
74
|
+
handlePanBy(deltaX: number, deltaY: number): void;
|
|
75
|
+
handleZoomView(viewport: Viewport, nextZoom: number): void;
|
|
76
|
+
handlePanViewport(viewport: Viewport, deltaX: number, deltaY: number): void;
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=view-control-widget.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"view-control-widget.d.ts","sourceRoot":"","sources":["../../src/widgets/view-control-widget.tsx"],"names":[],"mappings":"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"}
|