@idetik/core 0.40.0 → 0.40.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/dist/assets/worker_kernel-CBlE4MBI.js.map +1 -1
- package/dist/index.d.ts +1717 -381
- package/dist/index.js +981 -193
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +32 -32
- package/dist/index.umd.cjs.map +1 -1
- package/dist/types/src/core/channel.d.ts +7 -1
- package/dist/types/src/core/channel.d.ts.map +1 -1
- package/dist/types/src/core/image_source_policy.d.ts +4 -4
- package/dist/types/src/core/image_source_policy.d.ts.map +1 -1
- package/dist/types/src/core/layer.d.ts +136 -21
- package/dist/types/src/core/layer.d.ts.map +1 -1
- package/dist/types/src/core/renderable_object.d.ts +108 -3
- package/dist/types/src/core/renderable_object.d.ts.map +1 -1
- package/dist/types/src/core/viewport.d.ts +82 -2
- package/dist/types/src/core/viewport.d.ts.map +1 -1
- package/dist/types/src/data/chunk.d.ts +37 -2
- package/dist/types/src/data/chunk.d.ts.map +1 -1
- package/dist/types/src/data/chunk_manager.d.ts +5 -0
- package/dist/types/src/data/chunk_manager.d.ts.map +1 -1
- package/dist/types/src/data/ome_zarr/image_source.d.ts +56 -13
- package/dist/types/src/data/ome_zarr/image_source.d.ts.map +1 -1
- package/dist/types/src/data/ome_zarr/metadata_loaders.d.ts +4 -4
- package/dist/types/src/data/ome_zarr/metadata_loaders.d.ts.map +1 -1
- package/dist/types/src/idetik.d.ts +129 -59
- package/dist/types/src/idetik.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +29 -8
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/layers/axes_layer.d.ts +30 -5
- package/dist/types/src/layers/axes_layer.d.ts.map +1 -1
- package/dist/types/src/layers/image_layer.d.ts +106 -12
- package/dist/types/src/layers/image_layer.d.ts.map +1 -1
- package/dist/types/src/layers/label_layer.d.ts +106 -5
- package/dist/types/src/layers/label_layer.d.ts.map +1 -1
- package/dist/types/src/layers/point_picking.d.ts +7 -2
- package/dist/types/src/layers/point_picking.d.ts.map +1 -1
- package/dist/types/src/layers/volume_layer.d.ts +87 -5
- package/dist/types/src/layers/volume_layer.d.ts.map +1 -1
- package/dist/types/src/math/axes.d.ts +3 -0
- package/dist/types/src/math/axes.d.ts.map +1 -1
- package/dist/types/src/math/box2.d.ts +34 -4
- package/dist/types/src/math/box2.d.ts.map +1 -1
- package/dist/types/src/math/box3.d.ts +38 -4
- package/dist/types/src/math/box3.d.ts.map +1 -1
- package/dist/types/src/math/color.d.ts +49 -2
- package/dist/types/src/math/color.d.ts.map +1 -1
- package/dist/types/src/math/frustum.d.ts +28 -0
- package/dist/types/src/math/frustum.d.ts.map +1 -1
- package/dist/types/src/math/transforms.d.ts +57 -0
- package/dist/types/src/math/transforms.d.ts.map +1 -1
- package/dist/types/src/objects/cameras/camera.d.ts +55 -0
- package/dist/types/src/objects/cameras/camera.d.ts.map +1 -1
- package/dist/types/src/objects/cameras/controls.d.ts +88 -1
- package/dist/types/src/objects/cameras/controls.d.ts.map +1 -1
- package/dist/types/src/objects/cameras/orbit_controls.d.ts +56 -1
- package/dist/types/src/objects/cameras/orbit_controls.d.ts.map +1 -1
- package/dist/types/src/objects/cameras/orthographic_camera.d.ts +90 -13
- package/dist/types/src/objects/cameras/orthographic_camera.d.ts.map +1 -1
- package/dist/types/src/objects/cameras/perspective_camera.d.ts +65 -3
- package/dist/types/src/objects/cameras/perspective_camera.d.ts.map +1 -1
- package/dist/types/src/objects/renderable/image_renderable.d.ts +48 -3
- package/dist/types/src/objects/renderable/image_renderable.d.ts.map +1 -1
- package/dist/types/src/objects/renderable/label_image_renderable.d.ts +66 -4
- package/dist/types/src/objects/renderable/label_image_renderable.d.ts.map +1 -1
- package/dist/types/src/objects/renderable/points_renderable.d.ts +47 -2
- package/dist/types/src/objects/renderable/points_renderable.d.ts.map +1 -1
- package/dist/types/src/objects/renderable/projected_line_renderable.d.ts +27 -3
- package/dist/types/src/objects/renderable/projected_line_renderable.d.ts.map +1 -1
- package/dist/types/src/objects/renderable/volume_renderable.d.ts +63 -3
- package/dist/types/src/objects/renderable/volume_renderable.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -6,11 +6,17 @@ export type Channel = {
|
|
|
6
6
|
contrastLimits: [number, number];
|
|
7
7
|
opacity: number;
|
|
8
8
|
};
|
|
9
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* Appearance settings for a single image channel.
|
|
11
|
+
*/
|
|
10
12
|
export type ChannelProps = {
|
|
13
|
+
/** Whether the channel is drawn. Defaults to `true`. */
|
|
11
14
|
visible?: boolean;
|
|
15
|
+
/** The channel's tint color. Defaults to white. */
|
|
12
16
|
color?: ColorLike;
|
|
17
|
+
/** Intensity range shown. Defaults to the data range. */
|
|
13
18
|
contrastLimits?: [number, number];
|
|
19
|
+
/** Channel opacity in `[0, 1]`. Defaults to `1`. */
|
|
14
20
|
opacity?: number;
|
|
15
21
|
};
|
|
16
22
|
/** Layer that exposes channel controls. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"channel.d.ts","sourceRoot":"","sources":["../../../../src/core/channel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,OAAO,EAA4B,MAAM,6BAA6B,CAAC;AAMhF,MAAM,MAAM,OAAO,GAAG;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,KAAK,CAAC;IACb,cAAc,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF
|
|
1
|
+
{"version":3,"file":"channel.d.ts","sourceRoot":"","sources":["../../../../src/core/channel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,OAAO,EAA4B,MAAM,6BAA6B,CAAC;AA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|
};
|
|
33
33
|
}>;
|
|
34
|
-
/** @
|
|
34
|
+
/** @hidden */
|
|
35
35
|
export declare function createImageSourcePolicy(config: ImageSourcePolicyProps): ImageSourcePolicy;
|
|
36
|
-
/** @
|
|
36
|
+
/** @hidden */
|
|
37
37
|
export declare function createExplorationPolicy(overrides?: Partial<ImageSourcePolicyProps>): ImageSourcePolicy;
|
|
38
|
-
/** @
|
|
38
|
+
/** @hidden */
|
|
39
39
|
export declare function createPlaybackPolicy(overrides?: Partial<ImageSourcePolicyProps>): ImageSourcePolicy;
|
|
40
|
-
/** @
|
|
40
|
+
/** @hidden */
|
|
41
41
|
export declare function createNoPrefetchPolicy(overrides?: Partial<ImageSourcePolicyProps>): ImageSourcePolicy;
|
|
42
42
|
export {};
|
|
43
43
|
//# sourceMappingURL=image_source_policy.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image_source_policy.d.ts","sourceRoot":"","sources":["../../../../src/core/image_source_policy.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,cAAc,uGAMV,CAAC;AAEX,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAE/D,MAAM,MAAM,sBAAsB,GAAG;IACnC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE;QACR,CAAC,EAAE,MAAM,CAAC;QACV,CAAC,EAAE,MAAM,CAAC;QACV,CAAC,CAAC,EAAE,MAAM,CAAC;QACX,CAAC,CAAC,EAAE,MAAM,CAAC;KACZ,CAAC;IACF,aAAa,EAAE,gBAAgB,EAAE,CAAC;IAClC,GAAG,CAAC,EAAE;QACJ,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,QAAQ,CAAC;IACvC,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE;QACR,CAAC,EAAE,MAAM,CAAC;QACV,CAAC,EAAE,MAAM,CAAC;QACV,CAAC,EAAE,MAAM,CAAC;QACV,CAAC,EAAE,MAAM,CAAC;KACX,CAAC;IACF,aAAa,EAAE,SAAS,gBAAgB,EAAE,CAAC;IAC3C,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC,CAAC;IACxD,GAAG,EAAE;QACH,GAAG,EAAE,MAAM,CAAC;QACZ,GAAG,EAAE,MAAM,CAAC;QACZ,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;CACH,CAAC,CAAC;AAEH,
|
|
1
|
+
{"version":3,"file":"image_source_policy.d.ts","sourceRoot":"","sources":["../../../../src/core/image_source_policy.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,cAAc,uGAMV,CAAC;AAEX,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAE/D,MAAM,MAAM,sBAAsB,GAAG;IACnC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE;QACR,CAAC,EAAE,MAAM,CAAC;QACV,CAAC,EAAE,MAAM,CAAC;QACV,CAAC,CAAC,EAAE,MAAM,CAAC;QACX,CAAC,CAAC,EAAE,MAAM,CAAC;KACZ,CAAC;IACF,aAAa,EAAE,gBAAgB,EAAE,CAAC;IAClC,GAAG,CAAC,EAAE;QACJ,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,QAAQ,CAAC;IACvC,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE;QACR,CAAC,EAAE,MAAM,CAAC;QACV,CAAC,EAAE,MAAM,CAAC;QACV,CAAC,EAAE,MAAM,CAAC;QACV,CAAC,EAAE,MAAM,CAAC;KACX,CAAC;IACF,aAAa,EAAE,SAAS,gBAAgB,EAAE,CAAC;IAC3C,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC,CAAC;IACxD,GAAG,EAAE;QACH,GAAG,EAAE,MAAM,CAAC;QACZ,GAAG,EAAE,MAAM,CAAC;QACZ,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;CACH,CAAC,CAAC;AAEH,cAAc;AACd,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,sBAAsB,GAC7B,iBAAiB,CAoCnB;AAED,cAAc;AACd,wBAAgB,uBAAuB,CACrC,SAAS,GAAE,OAAO,CAAC,sBAAsB,CAAM,GAC9C,iBAAiB,CAanB;AAED,cAAc;AACd,wBAAgB,oBAAoB,CAClC,SAAS,GAAE,OAAO,CAAC,sBAAsB,CAAM,GAC9C,iBAAiB,CAanB;AAED,cAAc;AACd,wBAAgB,sBAAsB,CACpC,SAAS,GAAE,OAAO,CAAC,sBAAsB,CAAM,GAC9C,iBAAiB,CAanB"}
|
|
@@ -2,63 +2,178 @@ import { IdetikContext } from "../idetik";
|
|
|
2
2
|
import { RenderableObject } from "./renderable_object";
|
|
3
3
|
import { EventContext } from "./event_dispatcher";
|
|
4
4
|
import { Viewport } from "./viewport";
|
|
5
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* The loading lifecycle state of a layer.
|
|
7
|
+
*/
|
|
6
8
|
export type LayerState = "initialized" | "loading" | "ready";
|
|
9
|
+
/**
|
|
10
|
+
* How a layer's output blends with previously drawn content.
|
|
11
|
+
*/
|
|
7
12
|
export type BlendMode = "none" | "normal" | "additive" | "subtractive" | "multiply" | "premultipliedOver";
|
|
8
|
-
|
|
9
|
-
|
|
13
|
+
/**
|
|
14
|
+
* A callback invoked after a layer's state changes.
|
|
15
|
+
*/
|
|
16
|
+
export type StateChangeCallback = (newState: LayerState, prevState?: LayerState) => void;
|
|
17
|
+
/**
|
|
18
|
+
* Initialization properties for constructing a layer.
|
|
19
|
+
*/
|
|
20
|
+
export type LayerProps = {
|
|
21
|
+
/** Layer opacity in `[0, 1]`. Defaults to `1`. */
|
|
10
22
|
opacity?: number;
|
|
23
|
+
/** How the layer blends. Defaults to `"none"`. */
|
|
11
24
|
blendMode?: BlendMode;
|
|
25
|
+
/** Hides content behind. Inferred from `blendMode`. */
|
|
12
26
|
occludes?: boolean;
|
|
13
|
-
}
|
|
27
|
+
};
|
|
14
28
|
/**
|
|
15
|
-
* Abstract base class for
|
|
29
|
+
* Abstract base class for any layer that can be added to a viewport.
|
|
30
|
+
*
|
|
31
|
+
* A layer owns a set of renderable objects and contributes them to the
|
|
32
|
+
* scene each frame. Subclasses such as {@link ImageLayer},
|
|
33
|
+
* {@link VolumeLayer}, and {@link LabelLayer} implement {@link update} to
|
|
34
|
+
* build or refresh those objects for the current view. Custom layers
|
|
35
|
+
* register objects with {@link addObject} and report readiness through
|
|
36
|
+
* {@link setState}.
|
|
37
|
+
*
|
|
38
|
+
* Layers carry shared presentation state in {@link opacity},
|
|
39
|
+
* {@link blendMode}, and {@link occludes}, and expose a lifecycle
|
|
40
|
+
* {@link LayerState} that observers can subscribe to. A layer instance may
|
|
41
|
+
* be attached to only one viewport at a time.
|
|
42
|
+
*
|
|
43
|
+
* ```ts
|
|
44
|
+
* class Particles extends Layer {
|
|
45
|
+
* public readonly type = "Particles";
|
|
16
46
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
47
|
+
* constructor(points: PointProps[]) {
|
|
48
|
+
* super();
|
|
49
|
+
* this.addObject(new PointsRenderable(points));
|
|
50
|
+
* this.setState("ready");
|
|
51
|
+
* }
|
|
22
52
|
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* viewport
|
|
53
|
+
* public update() {}
|
|
54
|
+
* }
|
|
55
|
+
*
|
|
56
|
+
* viewport.addLayer(new Particles(points));
|
|
57
|
+
* ```
|
|
27
58
|
*
|
|
28
59
|
* @group Layers
|
|
29
60
|
*/
|
|
30
61
|
export declare abstract class Layer {
|
|
62
|
+
/** A string identifying the concrete layer type. */
|
|
31
63
|
abstract readonly type: string;
|
|
64
|
+
/**
|
|
65
|
+
* How the layer's output blends with previously drawn content. Also
|
|
66
|
+
* applies to blending between objects within the layer.
|
|
67
|
+
*/
|
|
68
|
+
blendMode: BlendMode;
|
|
69
|
+
/**
|
|
70
|
+
* Whether the layer writes depth and hides content drawn behind it.
|
|
71
|
+
*
|
|
72
|
+
* Occluding layers render a depth pass and always draw before
|
|
73
|
+
* non-occluding layers regardless of their order in the viewport. When
|
|
74
|
+
* not set explicitly this value is inferred from `blendMode` at
|
|
75
|
+
* construction only. Reassigning {@link blendMode} later does not update
|
|
76
|
+
* it.
|
|
77
|
+
*/
|
|
78
|
+
occludes: boolean;
|
|
79
|
+
/** Set to `true` by subclasses whose shaders read scene depth. */
|
|
80
|
+
protected requiresSceneDepth_: boolean;
|
|
32
81
|
private readonly coverageGroups_;
|
|
33
82
|
private state_;
|
|
34
83
|
private attached_;
|
|
35
84
|
private readonly callbacks_;
|
|
36
85
|
private opacity_;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
86
|
+
/**
|
|
87
|
+
* Creates a layer with the given presentation state.
|
|
88
|
+
*
|
|
89
|
+
* @param props - Initialization properties.
|
|
90
|
+
*/
|
|
40
91
|
constructor({ opacity, blendMode, occludes, }?: LayerProps);
|
|
92
|
+
/**
|
|
93
|
+
* Whether the layer's shaders read scene depth. When `true` the renderer
|
|
94
|
+
* draws occluding layers to a depth texture the layer's shaders can
|
|
95
|
+
* sample. A layer cannot both occlude and read scene depth.
|
|
96
|
+
*/
|
|
41
97
|
get requiresSceneDepth(): boolean;
|
|
98
|
+
/** The layer's opacity in `[0, 1]`. Values outside are clamped. */
|
|
42
99
|
get opacity(): number;
|
|
100
|
+
/** @param value - The new opacity in `[0, 1]`. */
|
|
43
101
|
set opacity(value: number);
|
|
102
|
+
/**
|
|
103
|
+
* Builds or refreshes the layer's renderable objects for the current
|
|
104
|
+
* view. Called automatically once per frame for every layer in a
|
|
105
|
+
* viewport.
|
|
106
|
+
*
|
|
107
|
+
* @param viewport - The viewport being rendered.
|
|
108
|
+
*/
|
|
44
109
|
abstract update(viewport?: Viewport): void;
|
|
45
|
-
|
|
110
|
+
/**
|
|
111
|
+
* Handles a pointer or wheel event from the owning viewport. Called
|
|
112
|
+
* automatically for each event before the camera controls. The default
|
|
113
|
+
* implementation does nothing.
|
|
114
|
+
*
|
|
115
|
+
* @param _event - The event with clip and world coordinates attached.
|
|
116
|
+
*/
|
|
117
|
+
onEvent(_event: EventContext): void;
|
|
118
|
+
/**
|
|
119
|
+
* Lifecycle hook that is called automatically when a layer is
|
|
120
|
+
* is attached to a viewport. A layer can only be attached to one viewport
|
|
121
|
+
* at a time.
|
|
122
|
+
*
|
|
123
|
+
* @param context - The shared runtime context.
|
|
124
|
+
*/
|
|
46
125
|
onAttached(context: IdetikContext): void;
|
|
126
|
+
/**
|
|
127
|
+
* Lifecycle hook that is called automatically when a layer is detached
|
|
128
|
+
* from a viewport.
|
|
129
|
+
*
|
|
130
|
+
* @param context - The shared runtime context.
|
|
131
|
+
*/
|
|
47
132
|
onDetached(context: IdetikContext): void;
|
|
133
|
+
/** @hidden */
|
|
48
134
|
protected attach(_context: IdetikContext): void;
|
|
135
|
+
/** @hidden */
|
|
49
136
|
protected detach(_context: IdetikContext): void;
|
|
137
|
+
/**
|
|
138
|
+
* The layer's renderable objects grouped by coverage group. Objects in
|
|
139
|
+
* a group draw each pixel at most once, letting chunks at multiple
|
|
140
|
+
* levels of detail overlap correctly.
|
|
141
|
+
*/
|
|
50
142
|
get coverageGroups(): ReadonlyMap<number | null, readonly RenderableObject[]>;
|
|
143
|
+
/** The layer's current lifecycle state. */
|
|
51
144
|
get state(): LayerState;
|
|
145
|
+
/**
|
|
146
|
+
* Registers a callback invoked after every state change.
|
|
147
|
+
*
|
|
148
|
+
* @param callback - Receives the new and previous states.
|
|
149
|
+
*/
|
|
52
150
|
addStateChangeCallback(callback: StateChangeCallback): void;
|
|
151
|
+
/**
|
|
152
|
+
* Removes a previously registered state change callback.
|
|
153
|
+
*
|
|
154
|
+
* @param callback - The callback to remove.
|
|
155
|
+
*/
|
|
53
156
|
removeStateChangeCallback(callback: StateChangeCallback): void;
|
|
157
|
+
/**
|
|
158
|
+
* Sets the lifecycle state and notifies state change callbacks.
|
|
159
|
+
*
|
|
160
|
+
* @param newState - The state to enter.
|
|
161
|
+
*/
|
|
54
162
|
protected setState(newState: LayerState): void;
|
|
163
|
+
/**
|
|
164
|
+
* Registers a renderable object for drawing. Objects in the same
|
|
165
|
+
* coverage group draw each pixel at most once.
|
|
166
|
+
*
|
|
167
|
+
* @param object - The object to add.
|
|
168
|
+
* @param coverageGroup - The group key.
|
|
169
|
+
*/
|
|
55
170
|
protected addObject(object: RenderableObject, coverageGroup?: number | null): void;
|
|
171
|
+
/** Removes all registered renderable objects. */
|
|
56
172
|
protected clearObjects(): void;
|
|
57
173
|
/**
|
|
58
|
-
*
|
|
59
|
-
*
|
|
174
|
+
* Returns uniform name-value pairs applied to every object drawn by
|
|
175
|
+
* this layer. Override in subclasses that need custom shader uniforms.
|
|
60
176
|
*/
|
|
61
177
|
getUniforms(): Record<string, unknown>;
|
|
62
178
|
}
|
|
63
|
-
export {};
|
|
64
179
|
//# sourceMappingURL=layer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layer.d.ts","sourceRoot":"","sources":["../../../../src/core/layer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAGvD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC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6,9 +6,49 @@ import { TrsTransform } from "../math/transforms";
|
|
|
6
6
|
import { Shader } from "../renderers/shaders";
|
|
7
7
|
import { Color } from "../math/color";
|
|
8
8
|
import { CullingMode } from "../renderers/webgl_state";
|
|
9
|
+
/**
|
|
10
|
+
* Abstract base class representing a {@link Layer}-renderable object.
|
|
11
|
+
*
|
|
12
|
+
* Renderables pair a geometry with a shader program, textures, uniform
|
|
13
|
+
* values, and a world transform. Subclasses assign a geometry, select one
|
|
14
|
+
* of the built-in shader programs through {@link programName} or provide
|
|
15
|
+
* a new one, bind textures with {@link setTexture}, and override {@link getUniforms} to
|
|
16
|
+
* feed values to the shader.
|
|
17
|
+
*
|
|
18
|
+
* ```ts
|
|
19
|
+
* class MyRenderable extends RenderableObject {
|
|
20
|
+
* constructor(texture: Texture) {
|
|
21
|
+
* super();
|
|
22
|
+
* this.geometry = new PlaneGeometry(512, 512, 1, 1);
|
|
23
|
+
* this.programName = "floatScalarImage";
|
|
24
|
+
*
|
|
25
|
+
* this.setTexture(0, texture);
|
|
26
|
+
* }
|
|
27
|
+
*
|
|
28
|
+
* public get type() {
|
|
29
|
+
* return "MyRenderable";
|
|
30
|
+
* }
|
|
31
|
+
*
|
|
32
|
+
* public override getUniforms() {
|
|
33
|
+
* return { u_imageSampler: 0 };
|
|
34
|
+
* }
|
|
35
|
+
* }
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* @group Renderables
|
|
39
|
+
*/
|
|
9
40
|
export declare abstract class RenderableObject extends Node {
|
|
41
|
+
/**
|
|
42
|
+
* Draws the geometry's wireframe on top of the normal pass. Layers use
|
|
43
|
+
* this as a chunk debugging aid. Defaults to `false`.
|
|
44
|
+
*/
|
|
10
45
|
wireframeEnabled: boolean;
|
|
46
|
+
/** The color of the wireframe overlay. Defaults to `Color.WHITE`. */
|
|
11
47
|
wireframeColor: Color;
|
|
48
|
+
/**
|
|
49
|
+
* Whether the object is depth tested when drawn. Objects that opt out
|
|
50
|
+
* are also left out of the depth prepass. Defaults to `true`.
|
|
51
|
+
*/
|
|
12
52
|
depthTest: boolean;
|
|
13
53
|
private readonly textures_;
|
|
14
54
|
private staleTextures_;
|
|
@@ -18,25 +58,90 @@ export declare abstract class RenderableObject extends Node {
|
|
|
18
58
|
private programName_;
|
|
19
59
|
private depthProgramName_;
|
|
20
60
|
private cullFaceMode_;
|
|
61
|
+
/**
|
|
62
|
+
* Assigns a texture to the given texture unit. The renderer binds each
|
|
63
|
+
* entry of {@link textures} to its matching unit before drawing.
|
|
64
|
+
*
|
|
65
|
+
* @param index - The texture unit to bind to.
|
|
66
|
+
* @param texture - The texture to assign.
|
|
67
|
+
*/
|
|
21
68
|
setTexture(index: number, texture: Texture): void;
|
|
69
|
+
/**
|
|
70
|
+
* Removes all assigned textures.
|
|
71
|
+
*/
|
|
22
72
|
protected clearTextures(): void;
|
|
73
|
+
/**
|
|
74
|
+
* Queues a replaced texture for GPU disposal. Subclasses call this when
|
|
75
|
+
* swapping out a texture they own. The renderer drains the queue
|
|
76
|
+
* through {@link popStaleTextures} before the next draw. Passing
|
|
77
|
+
* `undefined` is a no-op.
|
|
78
|
+
*
|
|
79
|
+
* @param texture - The texture that is no longer in use.
|
|
80
|
+
*/
|
|
23
81
|
protected markStaleTexture(texture: Texture | undefined): void;
|
|
82
|
+
/**
|
|
83
|
+
* Drains the queue of textures marked stale. Called automatically by
|
|
84
|
+
* the renderer, which disposes the GPU resources of each returned
|
|
85
|
+
* texture.
|
|
86
|
+
*
|
|
87
|
+
* @returns The textures queued since the last call.
|
|
88
|
+
*/
|
|
24
89
|
popStaleTextures(): Texture[];
|
|
90
|
+
/**
|
|
91
|
+
* The geometry drawn for this object.
|
|
92
|
+
*/
|
|
25
93
|
get geometry(): Geometry;
|
|
94
|
+
/**
|
|
95
|
+
* A line-segment version of {@link geometry} used for the wireframe
|
|
96
|
+
* overlay. Built lazily on first access and cached until the geometry
|
|
97
|
+
* changes.
|
|
98
|
+
*/
|
|
26
99
|
get wireframeGeometry(): WireframeGeometry;
|
|
100
|
+
/** The assigned textures indexed by texture unit. */
|
|
27
101
|
get textures(): Texture[];
|
|
102
|
+
/**
|
|
103
|
+
* The object's world transform as translation, rotation, and scale.
|
|
104
|
+
* Layers position, orient, and size renderables through it.
|
|
105
|
+
*/
|
|
28
106
|
get transform(): TrsTransform;
|
|
107
|
+
/** @param geometry - The geometry to draw. */
|
|
29
108
|
set geometry(geometry: Geometry);
|
|
109
|
+
/**
|
|
110
|
+
* The name of a shader program that draws the object. The
|
|
111
|
+
* renderer skips objects whose program name is `null`.
|
|
112
|
+
*/
|
|
30
113
|
get programName(): Shader | null;
|
|
114
|
+
/**
|
|
115
|
+
* The name of the shader program used in the depth prepass or `null`
|
|
116
|
+
* to stay out of it. Objects without one never occlude other layers.
|
|
117
|
+
*/
|
|
31
118
|
get depthProgramName(): Shader | null;
|
|
32
|
-
|
|
119
|
+
/**
|
|
120
|
+
* The geometry's bounding box transformed to world space. The renderer
|
|
121
|
+
* culls objects whose box falls outside the view frustum.
|
|
122
|
+
*/
|
|
123
|
+
get boundingBox(): import("..").Box3;
|
|
124
|
+
/**
|
|
125
|
+
* @param programName - The shader program name.
|
|
126
|
+
*/
|
|
33
127
|
protected set programName(programName: Shader);
|
|
128
|
+
/**
|
|
129
|
+
* Selects the shader program for the depth prepass. Subclasses set
|
|
130
|
+
* this so the object writes depth and occludes content in other
|
|
131
|
+
* layers.
|
|
132
|
+
*
|
|
133
|
+
* @param programName - The shader program name.
|
|
134
|
+
*/
|
|
34
135
|
protected set depthProgramName(programName: Shader);
|
|
136
|
+
/** Which triangle faces are culled when drawing. Defaults to `"none"`. */
|
|
35
137
|
get cullFaceMode(): CullingMode;
|
|
138
|
+
/** @param mode - The culling mode to apply. */
|
|
36
139
|
set cullFaceMode(mode: CullingMode);
|
|
37
140
|
/**
|
|
38
|
-
*
|
|
39
|
-
*
|
|
141
|
+
* Returns the uniform values to upload before drawing. Override in
|
|
142
|
+
* subclasses that need custom uniforms. Values are matched to shader
|
|
143
|
+
* uniforms by name and take precedence over the owning layer's
|
|
144
|
+
* uniforms.
|
|
40
145
|
*/
|
|
41
146
|
getUniforms(): Record<string, unknown>;
|
|
42
147
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderable_object.d.ts","sourceRoot":"","sources":["../../../../src/core/renderable_object.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,8BAAsB,gBAAiB,SAAQ,IAAI;
|
|
1
|
+
{"version":3,"file":"renderable_object.d.ts","sourceRoot":"","sources":["../../../../src/core/renderable_object.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,8BAAsB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HxC;IAED,+CAA+C;IAC/C,IAAW,YAAY,CAAC,IAAI,EAAE,WAAW,EAExC;IAED;;;;;OAKG;IACI,WAAW,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAG9C"}
|
|
@@ -5,40 +5,120 @@ import { Box2 } from "../math/box2";
|
|
|
5
5
|
import { vec2, vec3 } from "gl-matrix";
|
|
6
6
|
import { EventDispatcher } from "./event_dispatcher";
|
|
7
7
|
import { IdetikContext } from "../idetik";
|
|
8
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Initialization properties for constructing a viewport.
|
|
10
|
+
*/
|
|
11
|
+
export type ViewportProps = {
|
|
12
|
+
/** Unique id. Defaults to the element id or a generated id. */
|
|
9
13
|
id?: string;
|
|
14
|
+
/** Host element. Defaults to the Idetik canvas. */
|
|
10
15
|
element?: HTMLElement;
|
|
16
|
+
/** The camera the viewport renders with. */
|
|
11
17
|
camera: Camera;
|
|
18
|
+
/** Layers to render in order. */
|
|
12
19
|
layers?: Layer[];
|
|
20
|
+
/** Input controls driving the camera. */
|
|
13
21
|
cameraControls?: CameraControls;
|
|
14
|
-
}
|
|
22
|
+
};
|
|
15
23
|
interface ResolvedViewportProps extends ViewportProps {
|
|
16
24
|
id: string;
|
|
17
25
|
element: HTMLElement;
|
|
18
26
|
context: IdetikContext;
|
|
19
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* A region of the canvas that renders a stack of layers through a camera.
|
|
30
|
+
*
|
|
31
|
+
* Every viewport draws into the shared canvas through the area of its host
|
|
32
|
+
* element. The element defaults to the canvas itself and must be unique
|
|
33
|
+
* across viewports.
|
|
34
|
+
*
|
|
35
|
+
* Viewports also route input. Pointer and wheel events on the host element
|
|
36
|
+
* are enriched with clip and world coordinates and a picking ray, sent to
|
|
37
|
+
* each layer in order and passed to the camera controls unless a layer stops
|
|
38
|
+
* propagation.
|
|
39
|
+
*
|
|
40
|
+
* ```ts
|
|
41
|
+
* const idetik = new Idetik({
|
|
42
|
+
* canvas,
|
|
43
|
+
* viewports: [{ id: 'main', camera, layers: [imageLayer] }],
|
|
44
|
+
* });
|
|
45
|
+
*
|
|
46
|
+
* const viewport = idetik.getViewport('main')!;
|
|
47
|
+
* viewport.addLayer(labelLayer);
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
50
|
+
* @group Core
|
|
51
|
+
*/
|
|
20
52
|
export declare class Viewport {
|
|
53
|
+
/** The viewport's unique identifier. */
|
|
21
54
|
readonly id: string;
|
|
55
|
+
/** The host element defining the viewport's area. */
|
|
22
56
|
readonly element: HTMLElement;
|
|
57
|
+
/** The camera the viewport renders with. */
|
|
23
58
|
readonly camera: Camera;
|
|
59
|
+
/** The pointer and wheel event dispatcher for the host element. */
|
|
24
60
|
readonly events: EventDispatcher;
|
|
61
|
+
/** Input controls driving the camera. */
|
|
25
62
|
cameraControls?: CameraControls;
|
|
26
63
|
private readonly context_;
|
|
27
64
|
private layers_;
|
|
65
|
+
/** @hidden */
|
|
28
66
|
constructor(props: ResolvedViewportProps);
|
|
67
|
+
/**
|
|
68
|
+
* The layers rendered by this viewport in order. Layers with `occludes`
|
|
69
|
+
* set draw before non-occluding layers regardless of stack order.
|
|
70
|
+
*/
|
|
29
71
|
get layers(): readonly Layer[];
|
|
72
|
+
/**
|
|
73
|
+
* Adds a layer to the top of the stack.
|
|
74
|
+
*
|
|
75
|
+
* @param layer - The layer to add.
|
|
76
|
+
*/
|
|
30
77
|
addLayer(layer: Layer): void;
|
|
78
|
+
/**
|
|
79
|
+
* Removes a previously added layer.
|
|
80
|
+
*
|
|
81
|
+
* @param layer - The layer to remove.
|
|
82
|
+
*/
|
|
31
83
|
removeLayer(layer: Layer): void;
|
|
84
|
+
/** Removes all layers from the viewport. */
|
|
32
85
|
removeAllLayers(): void;
|
|
86
|
+
/**
|
|
87
|
+
* Syncs the camera's aspect ratio to the host element's size. Called
|
|
88
|
+
* automatically when the host element resizes.
|
|
89
|
+
*/
|
|
33
90
|
updateSize(): void;
|
|
91
|
+
/**
|
|
92
|
+
* Computes the viewport's box relative to the given canvas in device pixels.
|
|
93
|
+
*
|
|
94
|
+
* @param canvas - The canvas to compute the box against.
|
|
95
|
+
* @returns The viewport's box in the canvas's coordinate space.
|
|
96
|
+
*/
|
|
34
97
|
getBoxRelativeTo(canvas: HTMLCanvasElement): Box2;
|
|
98
|
+
/**
|
|
99
|
+
* The viewport's rectangle in the drawing buffer in device pixels.
|
|
100
|
+
*/
|
|
35
101
|
getBufferRect(): {
|
|
36
102
|
x: number;
|
|
37
103
|
y: number;
|
|
38
104
|
width: number;
|
|
39
105
|
height: number;
|
|
40
106
|
};
|
|
107
|
+
/**
|
|
108
|
+
* Converts a client-space position to clip space. The `y` axis points
|
|
109
|
+
* down, matching the renderer's mirrored projection.
|
|
110
|
+
*
|
|
111
|
+
* @param position - The client-space position to convert.
|
|
112
|
+
* @param depth - The clip-space z value.
|
|
113
|
+
*/
|
|
41
114
|
clientToClip(position: vec2, depth?: number): vec3;
|
|
115
|
+
/**
|
|
116
|
+
* Converts a client-space position such as a pointer location to world
|
|
117
|
+
* space.
|
|
118
|
+
*
|
|
119
|
+
* @param position - The client-space position to convert.
|
|
120
|
+
* @param depth - The clip-space z value.
|
|
121
|
+
*/
|
|
42
122
|
clientToWorld(position: vec2, depth?: number): vec3;
|
|
43
123
|
private getBox;
|
|
44
124
|
private updateAspectRatio;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"viewport.d.ts","sourceRoot":"","sources":["../../../../src/core/viewport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGvC,OAAO,EAAgB,eAAe,EA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ACrB,QAAQ,EAAE,CAYZ"}
|
|
@@ -42,32 +42,67 @@ export type Chunk = {
|
|
|
42
42
|
z: number;
|
|
43
43
|
};
|
|
44
44
|
} & ChunkViewState;
|
|
45
|
+
/**
|
|
46
|
+
* Per-axis dimension metadata for a multiscale image source.
|
|
47
|
+
*
|
|
48
|
+
* Maps the spatial axes `x`, `y`, `z` and the non-spatial axes `c` and
|
|
49
|
+
* `t` onto the source's stored dimensions.
|
|
50
|
+
*/
|
|
45
51
|
export type SourceDimensionMap = {
|
|
52
|
+
/** The `x` spatial dimension. */
|
|
46
53
|
x: SourceDimension;
|
|
54
|
+
/** The `y` spatial dimension. */
|
|
47
55
|
y: SourceDimension;
|
|
56
|
+
/** The `z` spatial dimension if present. */
|
|
48
57
|
z?: SourceDimension;
|
|
58
|
+
/** The channel dimension if present. */
|
|
49
59
|
c?: SourceDimension;
|
|
60
|
+
/** The time dimension if present. */
|
|
50
61
|
t?: SourceDimension;
|
|
62
|
+
/** Number of levels of detail in the pyramid. */
|
|
51
63
|
numLods: number;
|
|
52
64
|
};
|
|
65
|
+
/**
|
|
66
|
+
* One dimension of a multiscale image source.
|
|
67
|
+
*/
|
|
53
68
|
export type SourceDimension = {
|
|
69
|
+
/** Axis name from the source metadata. */
|
|
54
70
|
name: string;
|
|
71
|
+
/** Position of the axis in the stored arrays. */
|
|
55
72
|
index: number;
|
|
73
|
+
/** Physical unit if declared in the metadata. */
|
|
56
74
|
unit?: string;
|
|
75
|
+
/** Per-LOD metadata ordered finest first. */
|
|
57
76
|
lods: SourceDimensionLod[];
|
|
58
77
|
};
|
|
59
|
-
|
|
78
|
+
/**
|
|
79
|
+
* Metadata for one dimension at one level of detail.
|
|
80
|
+
*
|
|
81
|
+
* Combines array metadata with the OME-Zarr coordinate transform.
|
|
82
|
+
*/
|
|
83
|
+
export type SourceDimensionLod = {
|
|
84
|
+
/** Extent of the dimension in array elements. */
|
|
60
85
|
size: number;
|
|
86
|
+
/** Chunk extent along the dimension in elements. */
|
|
61
87
|
chunkSize: number;
|
|
88
|
+
/** World units per array element. */
|
|
62
89
|
scale: number;
|
|
90
|
+
/** World coordinate of the first element. */
|
|
63
91
|
translation: number;
|
|
64
92
|
};
|
|
65
|
-
/**
|
|
93
|
+
/**
|
|
94
|
+
* World-space coordinates selecting the data to display.
|
|
95
|
+
*/
|
|
66
96
|
export type SliceCoordinates = {
|
|
97
|
+
/** Position on the `x` axis in world units. */
|
|
67
98
|
x?: number;
|
|
99
|
+
/** Position on the `y` axis in world units. */
|
|
68
100
|
y?: number;
|
|
101
|
+
/** Position on the `z` axis in world units. */
|
|
69
102
|
z?: number;
|
|
103
|
+
/** Channel indices to load. Defaults to all channels. */
|
|
70
104
|
c?: number[];
|
|
105
|
+
/** The time point to display. */
|
|
71
106
|
t?: number;
|
|
72
107
|
};
|
|
73
108
|
export type ChunkSource = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chunk.d.ts","sourceRoot":"","sources":["../../../../src/data/chunk.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EACZ,yBAAyB,EAC1B,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAAE,IAAI,EAAQ,MAAM,WAAW,CAAC;AACvC,OAAO,EAAiB,SAAS,EAAE,MAAM,cAAc,CAAC;AAExD,QAAA,MAAM,cAAc,+KAQV,CAAC;AACX,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AACnE,MAAM,MAAM,SAAS,GAAG,YAAY,CAAC,oBAAoB,CAAC,CAAC;AAE3D,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,SAAS,CAU9D;AAED,MAAM,MAAM,cAAc,GAAG;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,QAAQ,EAAE,MAAM,GAAG,IAA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IACzD,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC;IACb,iCAAiC;IACjC,CAAC,CAAC,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,MAAM,IAAI,WAAW,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,qBAAqB,IAAI,kBAAkB,CAAC;IAE5C,kBAAkB,IAAI,MAAM,CAAC;IAE7B,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACjE,CAAC;AAEF,wBAAgB,YAAY,CAAC,GAAG,EAAE,kBAAkB,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAE3E;AAED,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,kBAAkB,EACvB,KAAK,EAAE,MAAM,GACZ,MAAM,CAGR;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,GAAG,IAAI,CAW3E"}
|
|
@@ -3,8 +3,13 @@ import { SliceAxes } from "../math/axes";
|
|
|
3
3
|
import { ChunkStoreView } from "./chunk_store_view";
|
|
4
4
|
import { ImageSourcePolicy } from "../core/image_source_policy";
|
|
5
5
|
import { Texture } from "../objects/textures/texture";
|
|
6
|
+
/**
|
|
7
|
+
* A snapshot of the chunk request queue.
|
|
8
|
+
*/
|
|
6
9
|
export type QueueStats = {
|
|
10
|
+
/** Number of requests waiting to start. */
|
|
7
11
|
pending: number;
|
|
12
|
+
/** Number of requests currently in flight. */
|
|
8
13
|
running: number;
|
|
9
14
|
};
|
|
10
15
|
export declare class ChunkManager {
|