@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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BlendMode, Layer } from "../core/layer";
|
|
2
2
|
import { Viewport } from "../core/viewport";
|
|
3
3
|
import type { IdetikContext } from "../idetik";
|
|
4
4
|
import { Chunk, ChunkSource, SliceCoordinates } from "../data/chunk";
|
|
@@ -9,30 +9,61 @@ import { ChannelProps, ChannelsEnabled } from "../core/channel";
|
|
|
9
9
|
import { EventContext } from "../core/event_dispatcher";
|
|
10
10
|
import { vec3 } from "gl-matrix";
|
|
11
11
|
import { PointPickingResult } from "./point_picking";
|
|
12
|
-
/**
|
|
13
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Initialization properties for constructing an image layer.
|
|
14
|
+
*/
|
|
15
|
+
export type ImageLayerProps = {
|
|
16
|
+
/** The chunked image source to stream from. */
|
|
14
17
|
source: ChunkSource;
|
|
18
|
+
/** The slice to display in world units. */
|
|
15
19
|
sliceCoords: SliceCoordinates;
|
|
20
|
+
/** Streaming policy. Defaults to the exploration policy. */
|
|
16
21
|
policy?: ImageSourcePolicy;
|
|
22
|
+
/** Slice plane orientation. Defaults to `"XY"`. */
|
|
17
23
|
orientation?: SliceOrientation;
|
|
24
|
+
/** Per-channel appearance. Length must match the source. */
|
|
18
25
|
channelProps?: ChannelProps[];
|
|
26
|
+
/** Called with the picked value when the layer is clicked. */
|
|
19
27
|
onPickValue?: (info: PointPickingResult) => void;
|
|
28
|
+
/** Layer opacity in `[0, 1]`. Defaults to `1`. */
|
|
29
|
+
opacity?: number;
|
|
30
|
+
/** How the layer blends. Defaults to `"additive"`. */
|
|
31
|
+
blendMode?: BlendMode;
|
|
32
|
+
/** Hides content behind. Defaults to `true`. */
|
|
33
|
+
occludes?: boolean;
|
|
20
34
|
};
|
|
21
35
|
/**
|
|
22
|
-
* A layer that renders a 2D slice of a chunked
|
|
36
|
+
* A layer that renders a 2D slice of a chunked multi-channel image source.
|
|
37
|
+
*
|
|
38
|
+
* Image layer streams chunks from a source such as
|
|
39
|
+
* {@link OmeZarrImageSource} according to its streaming policy, which
|
|
40
|
+
* decides which resolution levels and chunks to load for the current view.
|
|
41
|
+
* Per-channel appearance is controlled with {@link ChannelProps} and the
|
|
42
|
+
* visible slice is selected with {@link SliceCoordinates}. The layer holds
|
|
43
|
+
* `sliceCoords` by reference, so mutating the object it was constructed
|
|
44
|
+
* with moves through the data.
|
|
23
45
|
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
46
|
+
* ```ts
|
|
47
|
+
* const source = await OmeZarrImageSource.fromHttp({ url });
|
|
48
|
+
*
|
|
49
|
+
* const layer = new ImageLayer({
|
|
50
|
+
* source,
|
|
51
|
+
* sliceCoords: { t: 0, z: 0, c: [0, 1] },
|
|
52
|
+
* channelProps: [
|
|
53
|
+
* { color: Color.GREEN, contrastLimits: [0, 1024] },
|
|
54
|
+
* { color: Color.MAGENTA, contrastLimits: [0, 1024] },
|
|
55
|
+
* ],
|
|
56
|
+
* });
|
|
57
|
+
*
|
|
58
|
+
* viewport.addLayer(layer);
|
|
59
|
+
* ```
|
|
30
60
|
*
|
|
31
61
|
* @see {@link VolumeLayer} for 3D volume rendering of the same data.
|
|
32
62
|
*
|
|
33
63
|
* @group Layers
|
|
34
64
|
*/
|
|
35
65
|
export declare class ImageLayer extends Layer implements ChannelsEnabled {
|
|
66
|
+
/** Identifies the layer type as `ImageLayer`. */
|
|
36
67
|
readonly type = "ImageLayer";
|
|
37
68
|
private readonly source_;
|
|
38
69
|
private readonly sliceCoords_;
|
|
@@ -55,26 +86,61 @@ export declare class ImageLayer extends Layer implements ChannelsEnabled {
|
|
|
55
86
|
private lastPresentationTimeStamp_?;
|
|
56
87
|
private lastPresentationTimeCoord_?;
|
|
57
88
|
private readonly wireframeColors_;
|
|
89
|
+
/**
|
|
90
|
+
* Creates an image layer for the given source and slice.
|
|
91
|
+
*
|
|
92
|
+
* @param props - Initialization properties.
|
|
93
|
+
*/
|
|
58
94
|
constructor({ source, sliceCoords, policy, orientation, channelProps, onPickValue, ...layerOptions }: ImageLayerProps);
|
|
95
|
+
/** @hidden */
|
|
59
96
|
protected attach(context: IdetikContext): void;
|
|
97
|
+
/** @hidden */
|
|
60
98
|
protected detach(_context: IdetikContext): void;
|
|
99
|
+
/**
|
|
100
|
+
* Streams chunks for the current view and refreshes the visible slice.
|
|
101
|
+
*
|
|
102
|
+
* @param viewport - The viewport being rendered.
|
|
103
|
+
*/
|
|
61
104
|
update(viewport?: Viewport): void;
|
|
105
|
+
/** The slice plane the layer displays. */
|
|
62
106
|
get orientation(): SliceOrientation;
|
|
63
107
|
/**
|
|
64
|
-
* Changes the slice orientation at runtime. Visible renderables are
|
|
65
|
-
* for the new plane
|
|
108
|
+
* Changes the slice orientation at runtime. Visible renderables are
|
|
109
|
+
* rebuilt for the new plane and chunks already resident in the shared
|
|
110
|
+
* cache are reused.
|
|
111
|
+
*
|
|
112
|
+
* @param orientation - The new slice plane.
|
|
66
113
|
*/
|
|
67
114
|
setOrientation(orientation: SliceOrientation): void;
|
|
68
115
|
private updateChunks;
|
|
69
116
|
private rebuildRenderGroups;
|
|
117
|
+
/** The `t` coordinate of the most recently presented slice. */
|
|
70
118
|
get lastPresentationTimeCoord(): number | undefined;
|
|
71
119
|
private isPresentationStale;
|
|
120
|
+
/**
|
|
121
|
+
* Handles click picking for `onPickValue`. Called automatically for
|
|
122
|
+
* each pointer event.
|
|
123
|
+
*
|
|
124
|
+
* @param event - The event with clip and world coordinates attached.
|
|
125
|
+
*/
|
|
72
126
|
onEvent(event: EventContext): void;
|
|
73
127
|
private pickAtRay;
|
|
128
|
+
/** The layer's chunk store view for diagnostic overlays. */
|
|
74
129
|
get chunkStoreView(): ChunkStoreView | undefined;
|
|
130
|
+
/**
|
|
131
|
+
* The slice coordinates the layer displays. This is the object passed
|
|
132
|
+
* at construction and may be mutated to move through the data.
|
|
133
|
+
*/
|
|
75
134
|
get sliceCoords(): SliceCoordinates;
|
|
135
|
+
/** The chunked image source the layer streams from. */
|
|
76
136
|
get source(): ChunkSource;
|
|
137
|
+
/**
|
|
138
|
+
* The streaming policy in effect. Assign a new policy to reschedule
|
|
139
|
+
* loading at runtime, for example when switching between exploration
|
|
140
|
+
* and playback.
|
|
141
|
+
*/
|
|
77
142
|
get imageSourcePolicy(): Readonly<ImageSourcePolicy>;
|
|
143
|
+
/** @param newPolicy - The policy to apply. */
|
|
78
144
|
set imageSourcePolicy(newPolicy: ImageSourcePolicy);
|
|
79
145
|
private getImageForChunk;
|
|
80
146
|
private getChannelPropsForChunk;
|
|
@@ -82,14 +148,42 @@ export declare class ImageLayer extends Layer implements ChannelsEnabled {
|
|
|
82
148
|
private updateSlicePosition;
|
|
83
149
|
private sliceIndexForChunk;
|
|
84
150
|
private updateImageChunk;
|
|
151
|
+
/**
|
|
152
|
+
* Reads the data value at a world position from the resident chunks.
|
|
153
|
+
* Prefers the current level of detail and falls back to other resident
|
|
154
|
+
* levels.
|
|
155
|
+
*
|
|
156
|
+
* @param world - The world-space position to sample.
|
|
157
|
+
* @returns The sampled value or `null` if no resident chunk covers it.
|
|
158
|
+
*/
|
|
85
159
|
getValueAtWorld(world: vec3): Promise<number | null>;
|
|
86
160
|
private readValueFromChunk;
|
|
161
|
+
/** Whether chunk wireframes are drawn colored by level of detail. */
|
|
87
162
|
get debugMode(): boolean;
|
|
163
|
+
/** @param debug - Whether to draw chunk wireframes. */
|
|
88
164
|
set debugMode(debug: boolean);
|
|
165
|
+
/** The current per-channel appearance settings. */
|
|
89
166
|
get channelProps(): ChannelProps[] | undefined;
|
|
167
|
+
/**
|
|
168
|
+
* Applies new per-channel appearance settings to all visible chunks
|
|
169
|
+
* and notifies channel change callbacks.
|
|
170
|
+
*
|
|
171
|
+
* @param channelProps - One entry per source channel.
|
|
172
|
+
*/
|
|
90
173
|
setChannelProps(channelProps: ChannelProps[]): void;
|
|
174
|
+
/** Restores the channel settings passed at construction. */
|
|
91
175
|
resetChannelProps(): void;
|
|
176
|
+
/**
|
|
177
|
+
* Registers a callback invoked after every channel settings change.
|
|
178
|
+
*
|
|
179
|
+
* @param callback - The callback to add.
|
|
180
|
+
*/
|
|
92
181
|
addChannelChangeCallback(callback: () => void): void;
|
|
182
|
+
/**
|
|
183
|
+
* Removes a previously registered channel change callback.
|
|
184
|
+
*
|
|
185
|
+
* @param callback - The callback to remove.
|
|
186
|
+
*/
|
|
93
187
|
removeChannelChangeCallback(callback: () => void): void;
|
|
94
188
|
private releaseAndRemoveChunks;
|
|
95
189
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image_layer.d.ts","sourceRoot":"","sources":["../../../../src/layers/image_layer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"image_layer.d.ts","sourceRoot":"","sources":["../../../../src/layers/image_layer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EACL,KAAK,EACL,WAAW,EACX,gBAAgB,EAEjB,MAAM,eAAe,CAAC;AACvB,OAAO,EAEL,SAAS,EACT,gBAAgB,EAGjB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,cAAc,EAAuB,MAAM,0BAA0B,CAAC;AAC/E,OAAO,EAEL,iBAAiB,EAClB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,YAAY,EACZ,eAAe,EAEhB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAGxD,OAAO,EAAc,IAA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,CAAC,iBAAiB,CAAC,CAE1D;IAED,8CAA8C;IAC9C,IAAW,iBAAiB,CAAC,SAAS,EAAE,iBAAiB,EAUxD;IAED,OAAO,CAAC,gBAAgB;IAiBxB,OAAO,CAAC,uBAAuB;IAK/B,OAAO,CAAC,WAAW;IAWnB,OAAO,CAAC,mBAAmB;IAS3B,OAAO,CAAC,kBAAkB;IAY1B,OAAO,CAAC,gBAAgB;IAexB;;;;;;;OAOG;IACU,eAAe,CAAC,KAAK,EAAE,IAAI,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;YAanD,kBAAkB;IAiChC,qEAAqE;IACrE,IAAW,SAAS,IAAI,OAAO,CAE9B;IAED,uDAAuD;IACvD,IAAW,SAAS,CAAC,KAAK,EAAE,OAAO,EASlC;IAED,mDAAmD;IACnD,IAAW,YAAY,IAAI,YAAY,EAAE,GAAG,SAAS,CAEpD;IAED;;;;;OAKG;IACI,eAAe,CAAC,YAAY,EAAE,YAAY,EAAE;IAWnD,4DAA4D;IACrD,iBAAiB,IAAI,IAAI;IAMhC;;;;OAIG;IACI,wBAAwB,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI;IAI3D;;;;OAIG;IACI,2BAA2B,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI;IAQ9D,OAAO,CAAC,sBAAsB;CAS/B;AAED,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,UAOtE"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BlendMode, Layer } from "../core/layer";
|
|
2
2
|
import { Viewport } from "../core/viewport";
|
|
3
3
|
import type { IdetikContext } from "../idetik";
|
|
4
4
|
import { ChunkSource, SliceCoordinates } from "../data/chunk";
|
|
@@ -9,17 +9,61 @@ import { LabelColorMapProps, LabelColorMap } from "../objects/renderable/label_i
|
|
|
9
9
|
import { EventContext } from "../core/event_dispatcher";
|
|
10
10
|
import { vec3 } from "gl-matrix";
|
|
11
11
|
import { PointPickingResult } from "./point_picking";
|
|
12
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Initialization properties for constructing a label layer.
|
|
14
|
+
*/
|
|
15
|
+
export type LabelLayerProps = {
|
|
16
|
+
/** The single-channel label source to stream from. */
|
|
13
17
|
source: ChunkSource;
|
|
18
|
+
/** The slice to display in world units. */
|
|
14
19
|
sliceCoords: SliceCoordinates;
|
|
20
|
+
/** Streaming policy. Defaults to the exploration policy. */
|
|
15
21
|
policy?: ImageSourcePolicy;
|
|
22
|
+
/** Slice plane orientation. Defaults to `"XY"`. */
|
|
16
23
|
orientation?: SliceOrientation;
|
|
24
|
+
/** Colors for label values. Defaults to a built-in cycle. */
|
|
17
25
|
colorMap?: LabelColorMapProps;
|
|
26
|
+
/** Called with the picked label when the layer is clicked. */
|
|
18
27
|
onPickValue?: (info: PointPickingResult) => void;
|
|
28
|
+
/** Outlines the picked label. Defaults to `false`. */
|
|
19
29
|
outlineSelected?: boolean;
|
|
30
|
+
/** Layer opacity in `[0, 1]`. Defaults to `1`. */
|
|
31
|
+
opacity?: number;
|
|
32
|
+
/** How the layer blends. Defaults to `"none"`. */
|
|
33
|
+
blendMode?: BlendMode;
|
|
34
|
+
/** Hides content behind. Inferred from `blendMode`. */
|
|
35
|
+
occludes?: boolean;
|
|
20
36
|
};
|
|
21
|
-
/**
|
|
37
|
+
/**
|
|
38
|
+
* A layer that renders a 2D slice of a single-channel label image.
|
|
39
|
+
*
|
|
40
|
+
* Label layer displays segmentation data where each pixel holds an
|
|
41
|
+
* integer label. Labels are colored by cycling through the color map's
|
|
42
|
+
* `cycle` with exact-value overrides in its `lookupTable`. Chunks stream
|
|
43
|
+
* through the same policy machinery as {@link ImageLayer} and the source
|
|
44
|
+
* must be single channel.
|
|
45
|
+
*
|
|
46
|
+
* Clicking the layer picks the label under the pointer. With
|
|
47
|
+
* `outlineSelected` the picked label is outlined, and `onPickValue`
|
|
48
|
+
* receives the world position and label value for custom handling such as
|
|
49
|
+
* highlighting through {@link setColorMap}.
|
|
50
|
+
*
|
|
51
|
+
* ```ts
|
|
52
|
+
* const labels = new LabelLayer({
|
|
53
|
+
* source: labelSource,
|
|
54
|
+
* sliceCoords: { z: 12, c: [0] },
|
|
55
|
+
* opacity: 0.55,
|
|
56
|
+
* blendMode: "normal",
|
|
57
|
+
* onPickValue: ({ value }) => console.log(`label ${value}`),
|
|
58
|
+
* });
|
|
59
|
+
*
|
|
60
|
+
* viewport.addLayer(labels);
|
|
61
|
+
* ```
|
|
62
|
+
*
|
|
63
|
+
* @group Layers
|
|
64
|
+
*/
|
|
22
65
|
export declare class LabelLayer extends Layer {
|
|
66
|
+
/** Identifies the layer type as `LabelLayer`. */
|
|
23
67
|
readonly type = "LabelLayer";
|
|
24
68
|
private readonly source_;
|
|
25
69
|
private readonly sliceCoords_;
|
|
@@ -39,29 +83,86 @@ export declare class LabelLayer extends Layer {
|
|
|
39
83
|
private static readonly STALE_PRESENTATION_MS_;
|
|
40
84
|
private lastPresentationTimeStamp_?;
|
|
41
85
|
private lastPresentationTimeCoord_?;
|
|
86
|
+
/**
|
|
87
|
+
* Creates a label layer for the given source and slice.
|
|
88
|
+
*
|
|
89
|
+
* @param props - Initialization properties.
|
|
90
|
+
*/
|
|
42
91
|
constructor({ source, sliceCoords, policy, orientation, colorMap, onPickValue, outlineSelected, ...layerOptions }: LabelLayerProps);
|
|
92
|
+
/** @hidden */
|
|
43
93
|
protected attach(context: IdetikContext): void;
|
|
94
|
+
/** @hidden */
|
|
44
95
|
protected detach(_context: IdetikContext): void;
|
|
96
|
+
/**
|
|
97
|
+
* Streams chunks for the current view and refreshes the visible slice.
|
|
98
|
+
* Called automatically once per frame.
|
|
99
|
+
*
|
|
100
|
+
* @param viewport - The viewport being rendered.
|
|
101
|
+
*/
|
|
45
102
|
update(viewport?: Viewport): void;
|
|
103
|
+
/** The slice plane the layer displays. */
|
|
46
104
|
get orientation(): SliceOrientation;
|
|
47
105
|
/**
|
|
48
|
-
* Changes the slice orientation at runtime. Visible renderables are
|
|
49
|
-
* for the new plane
|
|
106
|
+
* Changes the slice orientation at runtime. Visible renderables are
|
|
107
|
+
* rebuilt for the new plane and chunks already resident in the shared
|
|
108
|
+
* cache are reused.
|
|
109
|
+
*
|
|
110
|
+
* @param orientation - The new slice plane.
|
|
50
111
|
*/
|
|
51
112
|
setOrientation(orientation: SliceOrientation): void;
|
|
52
113
|
private updateChunks;
|
|
53
114
|
private isPresentationStale;
|
|
115
|
+
/**
|
|
116
|
+
* Handles click picking and selection outlining. Called automatically
|
|
117
|
+
* for each pointer event on the owning viewport.
|
|
118
|
+
*
|
|
119
|
+
* @param event - The event with clip and world coordinates attached.
|
|
120
|
+
*/
|
|
54
121
|
onEvent(event: EventContext): void;
|
|
55
122
|
private pickAtRay;
|
|
123
|
+
/** The validated color map currently in effect. */
|
|
56
124
|
get colorMap(): LabelColorMap;
|
|
125
|
+
/**
|
|
126
|
+
* Replaces the color map and recolors all visible chunks.
|
|
127
|
+
*
|
|
128
|
+
* @param colorMap - Colors for label values. Omitted fields fall back
|
|
129
|
+
* to defaults.
|
|
130
|
+
*/
|
|
57
131
|
setColorMap(colorMap: LabelColorMapProps): void;
|
|
132
|
+
/**
|
|
133
|
+
* Sets the label value drawn as selected or `null` to clear the
|
|
134
|
+
* selection.
|
|
135
|
+
*
|
|
136
|
+
* @param value - The label value to select.
|
|
137
|
+
*/
|
|
58
138
|
setSelectedValue(value: number | null): void;
|
|
139
|
+
/**
|
|
140
|
+
* The slice coordinates the layer displays. This is the object passed
|
|
141
|
+
* at construction and may be mutated to move through the data.
|
|
142
|
+
*/
|
|
59
143
|
get sliceCoords(): SliceCoordinates;
|
|
144
|
+
/** The chunked label source the layer streams from. */
|
|
60
145
|
get source(): ChunkSource;
|
|
146
|
+
/**
|
|
147
|
+
* The streaming policy in effect. Assign a new policy to reschedule
|
|
148
|
+
* loading at runtime, for example when switching between exploration
|
|
149
|
+
* and playback.
|
|
150
|
+
*/
|
|
61
151
|
get imageSourcePolicy(): Readonly<ImageSourcePolicy>;
|
|
152
|
+
/** @param newPolicy - The policy to apply. */
|
|
62
153
|
set imageSourcePolicy(newPolicy: ImageSourcePolicy);
|
|
154
|
+
/** The layer's chunk store view for diagnostic overlays. */
|
|
63
155
|
get chunkStoreView(): ChunkStoreView | undefined;
|
|
156
|
+
/** The `t` coordinate of the most recently presented slice. */
|
|
64
157
|
get lastPresentationTimeCoord(): number | undefined;
|
|
158
|
+
/**
|
|
159
|
+
* Reads the label value at a world position from the resident chunks.
|
|
160
|
+
* Prefers the current level of detail and falls back to other resident
|
|
161
|
+
* levels.
|
|
162
|
+
*
|
|
163
|
+
* @param world - The world-space position to sample.
|
|
164
|
+
* @returns The label value or `null` if no resident chunk covers it.
|
|
165
|
+
*/
|
|
65
166
|
getValueAtWorld(world: vec3): Promise<number | null>;
|
|
66
167
|
private readValueFromChunk;
|
|
67
168
|
private getLabelForChunk;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"label_layer.d.ts","sourceRoot":"","sources":["../../../../src/layers/label_layer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"label_layer.d.ts","sourceRoot":"","sources":["../../../../src/layers/label_layer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAEL,WAAW,EACX,gBAAgB,EAEjB,MAAM,eAAe,CAAC;AACvB,OAAO,EAGL,gBAAgB,EAGjB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,cAAc,EAAuB,MAAM,0BAA0B,CAAC;AAC/E,OAAO,EAEL,iBAAiB,EAClB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,kBAAkB,EAClB,aAAa,EAGd,MAAM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,iBAAiB,IAAI,QAAQ,CAAC,iBAAiB,CAAC,CAE1D;IAED,8CAA8C;IAC9C,IAAW,iBAAiB,CAAC,SAAS,EAAE,iBAAiB,EAUxD;IAGD,4DAA4D;IAC5D,IAAW,cAAc,IAAI,cAAc,GAAG,SAAS,CAEtD;IAED,+DAA+D;IAC/D,IAAW,yBAAyB,IAAI,MAAM,GAAG,SAAS,CAEzD;IAED;;;;;;;OAOG;IACU,eAAe,CAAC,KAAK,EAAE,IAAI,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;YAanD,kBAAkB;IAiChC,OAAO,CAAC,gBAAgB;IAmBxB,OAAO,CAAC,WAAW;IAanB,OAAO,CAAC,mBAAmB;IAS3B,OAAO,CAAC,kBAAkB;IAW1B,OAAO,CAAC,gBAAgB;IAQxB,OAAO,CAAC,sBAAsB;CAS/B"}
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import { EventContext } from "../core/event_dispatcher";
|
|
2
2
|
import { Ray } from "../math/ray";
|
|
3
3
|
import { vec2, vec3 } from "gl-matrix";
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* The result of picking a value from a layer with a click.
|
|
6
|
+
*/
|
|
7
|
+
export type PointPickingResult = {
|
|
8
|
+
/** The picked position in world units. */
|
|
5
9
|
world: vec3;
|
|
10
|
+
/** The data value sampled at the position. */
|
|
6
11
|
value: number;
|
|
7
|
-
}
|
|
12
|
+
};
|
|
8
13
|
export declare function handlePointPickingEvent<T>(event: EventContext, pointerDownPos: vec2 | null, pickAtRay: (ray: Ray) => Promise<{
|
|
9
14
|
world: vec3;
|
|
10
15
|
value: T;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"point_picking.d.ts","sourceRoot":"","sources":["../../../../src/layers/point_picking.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAElC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEvC,MAAM,
|
|
1
|
+
{"version":3,"file":"point_picking.d.ts","sourceRoot":"","sources":["../../../../src/layers/point_picking.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAElC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEvC;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,0CAA0C;IAC1C,KAAK,EAAE,IAAI,CAAC;IACZ,8CAA8C;IAC9C,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,wBAAgB,uBAAuB,CAAC,CAAC,EACvC,KAAK,EAAE,YAAY,EACnB,cAAc,EAAE,IAAI,GAAG,IAAI,EAC3B,SAAS,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,OAAO,CAAC;IAAE,KAAK,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,CAAC,CAAA;CAAE,GAAG,IAAI,CAAC,EAClE,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE;IAAE,KAAK,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,CAAC,CAAA;CAAE,KAAK,IAAI,EACvD,aAAa,GAAE,MAAU,GACxB,IAAI,GAAG,IAAI,CAyCb"}
|
|
@@ -4,15 +4,61 @@ import { Viewport } from "../core/viewport";
|
|
|
4
4
|
import { IdetikContext } from "../idetik";
|
|
5
5
|
import { ImageSourcePolicy } from "../core/image_source_policy";
|
|
6
6
|
import { ChannelProps, ChannelsEnabled } from "../core/channel";
|
|
7
|
+
/**
|
|
8
|
+
* Initialization properties for constructing a volume layer.
|
|
9
|
+
*/
|
|
7
10
|
export type VolumeLayerProps = {
|
|
11
|
+
/** The chunked image source to stream from. */
|
|
8
12
|
source: ChunkSource;
|
|
13
|
+
/** Selects `t` and `c`. Spatial axes are ignored. */
|
|
9
14
|
sliceCoords: SliceCoordinates;
|
|
15
|
+
/** Streaming policy. Defaults to the exploration policy. */
|
|
10
16
|
policy?: ImageSourcePolicy;
|
|
17
|
+
/** Per-channel appearance. Length must match the source. */
|
|
11
18
|
channelProps?: ChannelProps[];
|
|
12
19
|
};
|
|
13
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* A layer that renders a chunked multi-channel image source as a 3D
|
|
22
|
+
* volume.
|
|
23
|
+
*
|
|
24
|
+
* Volume layer ray marches the loaded chunks with premultiplied blending
|
|
25
|
+
* and composites all visible channels in a single pass. The volume renders
|
|
26
|
+
* at a single level of detail taken from the policy's `lod.min`, so pin
|
|
27
|
+
* one with the policy when constructing the layer. While the camera moves
|
|
28
|
+
* the ray march step size is doubled to keep interaction responsive.
|
|
29
|
+
*
|
|
30
|
+
* ```ts
|
|
31
|
+
* const source = await OmeZarrImageSource.fromHttp({ url });
|
|
32
|
+
*
|
|
33
|
+
* const layer = new VolumeLayer({
|
|
34
|
+
* source,
|
|
35
|
+
* sliceCoords: { t: 0, c: undefined },
|
|
36
|
+
* policy: createExplorationPolicy({ lod: { min: 2, max: 2 } }),
|
|
37
|
+
* channelProps: [
|
|
38
|
+
* { color: "#00ffff", contrastLimits: [300, 1500] },
|
|
39
|
+
* { color: "#ff00ff", contrastLimits: [75, 500] },
|
|
40
|
+
* ],
|
|
41
|
+
* });
|
|
42
|
+
*
|
|
43
|
+
* viewport.addLayer(layer);
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* @see {@link ImageLayer} for 2D slicing of the same data.
|
|
47
|
+
*
|
|
48
|
+
* @group Layers
|
|
49
|
+
*/
|
|
14
50
|
export declare class VolumeLayer extends Layer implements ChannelsEnabled {
|
|
51
|
+
/** Identifies the layer type as `VolumeLayer`. */
|
|
15
52
|
readonly type = "VolumeLayer";
|
|
53
|
+
/** Highlights rays of zero length for debugging. Defaults to `false`. */
|
|
54
|
+
debugShowDegenerateRays: boolean;
|
|
55
|
+
/** Ray march step size relative to voxel size. Defaults to `1`. */
|
|
56
|
+
relativeStepSize: number;
|
|
57
|
+
/** Scales sample opacity during compositing. Defaults to `1`. */
|
|
58
|
+
opacityMultiplier: number;
|
|
59
|
+
/** Alpha where a ray stops early. Defaults to `0.99`. */
|
|
60
|
+
earlyTerminationAlpha: number;
|
|
61
|
+
/** Volume ray marching reads scene depth to composite with occluding layers. */
|
|
16
62
|
protected requiresSceneDepth_: boolean;
|
|
17
63
|
private readonly source_;
|
|
18
64
|
private readonly sliceCoords_;
|
|
@@ -28,27 +74,63 @@ export declare class VolumeLayer extends Layer implements ChannelsEnabled {
|
|
|
28
74
|
private lastNumRenderedChannelChunks_;
|
|
29
75
|
private interactiveStepSizeScale_;
|
|
30
76
|
private debugShowWireframes_;
|
|
31
|
-
|
|
32
|
-
relativeStepSize: number;
|
|
33
|
-
opacityMultiplier: number;
|
|
34
|
-
earlyTerminationAlpha: number;
|
|
77
|
+
/** Whether chunk bounding wireframes are drawn for debugging. */
|
|
35
78
|
get debugShowWireframes(): boolean;
|
|
79
|
+
/** @param value - Whether to draw chunk wireframes. */
|
|
36
80
|
set debugShowWireframes(value: boolean);
|
|
81
|
+
/**
|
|
82
|
+
* Sets the streaming policy at runtime and reschedules loading. The
|
|
83
|
+
* volume renders the level of detail given by the policy's `lod.min`.
|
|
84
|
+
*
|
|
85
|
+
* @param newPolicy - The policy to apply.
|
|
86
|
+
*/
|
|
37
87
|
set imageSourcePolicy(newPolicy: ImageSourcePolicy);
|
|
88
|
+
/**
|
|
89
|
+
* Applies new per-channel appearance settings to all visible volumes
|
|
90
|
+
* and notifies channel change callbacks.
|
|
91
|
+
*
|
|
92
|
+
* @param channelProps - One entry per source channel.
|
|
93
|
+
*/
|
|
38
94
|
setChannelProps(channelProps: ChannelProps[]): void;
|
|
95
|
+
/** The current per-channel appearance settings. */
|
|
39
96
|
get channelProps(): ChannelProps[] | undefined;
|
|
97
|
+
/** Restores the channel settings passed at construction. */
|
|
40
98
|
resetChannelProps(): void;
|
|
99
|
+
/**
|
|
100
|
+
* Registers a callback invoked after every channel settings change.
|
|
101
|
+
*
|
|
102
|
+
* @param callback - The callback to add.
|
|
103
|
+
*/
|
|
41
104
|
addChannelChangeCallback(callback: () => void): void;
|
|
105
|
+
/**
|
|
106
|
+
* Removes a previously registered channel change callback.
|
|
107
|
+
*
|
|
108
|
+
* @param callback - The callback to remove.
|
|
109
|
+
*/
|
|
42
110
|
removeChannelChangeCallback(callback: () => void): void;
|
|
111
|
+
/**
|
|
112
|
+
* Creates a volume layer for the given source.
|
|
113
|
+
*
|
|
114
|
+
* @param props - Initialization properties.
|
|
115
|
+
*/
|
|
43
116
|
constructor({ source, sliceCoords, policy, channelProps }: VolumeLayerProps);
|
|
44
117
|
private getOrCreateVolume;
|
|
118
|
+
/** @hidden */
|
|
45
119
|
protected attach(context: IdetikContext): void;
|
|
120
|
+
/** @hidden */
|
|
46
121
|
protected detach(_context: IdetikContext): void;
|
|
47
122
|
private updateChunks;
|
|
48
123
|
private updateVolumeTransform;
|
|
49
124
|
private releaseAndRemoveVolume;
|
|
125
|
+
/**
|
|
126
|
+
* Streams chunks for the current view and rebuilds the volume set
|
|
127
|
+
* sorted front to back. Called automatically once per frame.
|
|
128
|
+
*
|
|
129
|
+
* @param viewport - The viewport being rendered.
|
|
130
|
+
*/
|
|
50
131
|
update(viewport?: Viewport): void;
|
|
51
132
|
private rebuildObjects;
|
|
133
|
+
/** Returns the ray marching uniforms for this layer. */
|
|
52
134
|
getUniforms(): Record<string, unknown>;
|
|
53
135
|
}
|
|
54
136
|
export declare function poolKeyForChunk(chunk: Chunk): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"volume_layer.d.ts","sourceRoot":"","sources":["../../../../src/layers/volume_layer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACrE,OAAO,EAAE,KAAK,EAAE,MAA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OAIG;IACI,2BAA2B,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI;IAQ9D;;;;OAIG;gBACS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,gBAAgB;IAU3E,OAAO,CAAC,iBAAiB;IAiBzB,cAAc;IACd,SAAS,CAAC,MAAM,CAAC,OAAO,EAAE,aAAa;IAYvC,cAAc;IACd,SAAS,CAAC,MAAM,CAAC,QAAQ,EAAE,aAAa;IAUxC,OAAO,CAAC,YAAY;IA+BpB,OAAO,CAAC,qBAAqB;IAoB7B,OAAO,CAAC,sBAAsB;IAM9B;;;;;OAKG;IACI,MAAM,CAAC,QAAQ,CAAC,EAAE,QAAQ;IAiBjC,OAAO,CAAC,cAAc;IAUtB,wDAAwD;IACjD,WAAW,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAS9C;AAqBD,wBAAgB,eAAe,CAAC,KAAK,EAAE,KAAK,UAM3C"}
|
|
@@ -6,6 +6,9 @@ export type SliceAxes = {
|
|
|
6
6
|
w: SpatialAxis;
|
|
7
7
|
};
|
|
8
8
|
export declare const AxisComponent: Record<SpatialAxis, 0 | 1 | 2>;
|
|
9
|
+
/**
|
|
10
|
+
* The plane a 2D slice lies on, named by its in-plane axes.
|
|
11
|
+
*/
|
|
9
12
|
export type SliceOrientation = "XY" | "XZ" | "YZ";
|
|
10
13
|
export declare function sliceAxesFor(orientation: SliceOrientation): SliceAxes;
|
|
11
14
|
export declare function orientationRotation(axes: SliceAxes): quat;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"axes.d.ts","sourceRoot":"","sources":["../../../../src/math/axes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,IAAI,EAAQ,MAAM,WAAW,CAAC;AAE7C,MAAM,MAAM,WAAW,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;AAE1C,MAAM,MAAM,SAAS,GAAG;IACtB,CAAC,EAAE,WAAW,CAAC;IACf,CAAC,EAAE,WAAW,CAAC;IACf,CAAC,EAAE,WAAW,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,WAAW,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAIxD,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAElD,wBAAgB,YAAY,CAAC,WAAW,EAAE,gBAAgB,GAAG,SAAS,CASrE;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI,CAmBzD"}
|
|
1
|
+
{"version":3,"file":"axes.d.ts","sourceRoot":"","sources":["../../../../src/math/axes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,IAAI,EAAQ,MAAM,WAAW,CAAC;AAE7C,MAAM,MAAM,WAAW,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;AAE1C,MAAM,MAAM,SAAS,GAAG;IACtB,CAAC,EAAE,WAAW,CAAC;IACf,CAAC,EAAE,WAAW,CAAC;IACf,CAAC,EAAE,WAAW,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,WAAW,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAIxD,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAElD,wBAAgB,YAAY,CAAC,WAAW,EAAE,gBAAgB,GAAG,SAAS,CASrE;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI,CAmBzD"}
|
|
@@ -1,19 +1,49 @@
|
|
|
1
1
|
import { vec2 } from "gl-matrix";
|
|
2
|
+
/**
|
|
3
|
+
* Axis-aligned bounding box defined by minimum and maximum corners.
|
|
4
|
+
*
|
|
5
|
+
* Box2 represents a 2D region bounded by two corners: `min` and `max`. It
|
|
6
|
+
* is used for view rectangles, viewport regions, and intersection checks.
|
|
7
|
+
* A default-constructed box is empty and intersection treats boxes
|
|
8
|
+
* as half-open intervals.
|
|
9
|
+
*
|
|
10
|
+
* @group Math
|
|
11
|
+
*/
|
|
2
12
|
export declare class Box2 {
|
|
13
|
+
/** Minimum corner of the box. */
|
|
3
14
|
min: vec2;
|
|
15
|
+
/** Maximum corner of the box. */
|
|
4
16
|
max: vec2;
|
|
5
17
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
18
|
+
* Creates a box from optional corner points. The corners are cloned.
|
|
19
|
+
* When a corner is omitted the box starts empty.
|
|
20
|
+
*
|
|
21
|
+
* @param min - The minimum corner.
|
|
22
|
+
* @param max - The maximum corner.
|
|
10
23
|
*/
|
|
11
24
|
constructor(min?: vec2, max?: vec2);
|
|
25
|
+
/** Returns a deep copy of the box. */
|
|
12
26
|
clone(): Box2;
|
|
27
|
+
/** Returns `true` when the box encloses no area. */
|
|
13
28
|
isEmpty(): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Tests whether two boxes overlap. Boxes are treated as half-open
|
|
31
|
+
* intervals so touching edges do not count as overlap.
|
|
32
|
+
*
|
|
33
|
+
* @param a - The first box.
|
|
34
|
+
* @param b - The second box.
|
|
35
|
+
*/
|
|
14
36
|
static intersects(a: Box2, b: Box2): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Tests whether two boxes have exactly equal corners.
|
|
39
|
+
*
|
|
40
|
+
* @param a - The first box.
|
|
41
|
+
* @param b - The second box.
|
|
42
|
+
*/
|
|
15
43
|
static equals(a: Box2, b: Box2): boolean;
|
|
44
|
+
/** Returns a copy with both corners floored componentwise. */
|
|
16
45
|
floor(): Box2;
|
|
46
|
+
/** Converts the box to an `x, y, width, height` rectangle. */
|
|
17
47
|
toRect(): {
|
|
18
48
|
x: number;
|
|
19
49
|
y: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"box2.d.ts","sourceRoot":"","sources":["../../../../src/math/box2.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,qBAAa,IAAI;
|
|
1
|
+
{"version":3,"file":"box2.d.ts","sourceRoot":"","sources":["../../../../src/math/box2.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC;;;;;;;;;GASG;AACH,qBAAa,IAAI;IACf,iCAAiC;IAC1B,GAAG,EAAE,IAAI,CAAC;IACjB,iCAAiC;IAC1B,GAAG,EAAE,IAAI,CAAC;IAEjB;;;;;;OAMG;gBACS,GAAG,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC,EAAE,IAAI;IAKlC,sCAAsC;IAC/B,KAAK;IAIZ,oDAAoD;IAC7C,OAAO,IAAI,OAAO;IAIzB;;;;;;OAMG;WACW,UAAU,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,GAAG,OAAO;IAMnD;;;;;OAKG;WACW,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,GAAG,OAAO;IAI/C,8DAA8D;IACvD,KAAK,IAAI,IAAI;IAOpB,8DAA8D;IACvD,MAAM,IAAI;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE;CAOzE"}
|