@vitessce/gl 4.0.8 → 4.0.10
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/{deflate-DNngSh3q.js → deflate-DD4d--xe.js} +1 -1
- package/dist/{index-_UASQg2S.js → index-D4C8DA1x.js} +1324 -109
- package/dist/index.js +18 -13
- package/dist/{jpeg-BrGNk507.js → jpeg-CZeZBc_8.js} +1 -1
- package/dist/{lerc-A9bnCzoN.js → lerc-Ct7C32yr.js} +1 -1
- package/dist/{lzw-_IYIPfiq.js → lzw-BgdxJ7Qg.js} +1 -1
- package/dist/{packbits-CxQQOChS.js → packbits-BhOBFsGy.js} +1 -1
- package/dist/{raw-ti2YIR09.js → raw-B5_2TWMK.js} +1 -1
- package/dist/{webimage-DgRcFzf_.js → webimage-DcEapRkY.js} +1 -1
- package/dist-tsc/AnnotationLayer.d.ts +91 -0
- package/dist-tsc/AnnotationLayer.d.ts.map +1 -0
- package/dist-tsc/AnnotationLayer.js +71 -0
- package/dist-tsc/AnnotationLayer.js.map +1 -0
- package/dist-tsc/AnnotationLayer.test.d.ts +2 -0
- package/dist-tsc/AnnotationLayer.test.d.ts.map +1 -0
- package/dist-tsc/AnnotationLayer.test.js +59 -0
- package/dist-tsc/AnnotationLayer.test.js.map +1 -0
- package/dist-tsc/annotation-layer-utils.d.ts +25 -0
- package/dist-tsc/annotation-layer-utils.d.ts.map +1 -0
- package/dist-tsc/annotation-layer-utils.js +1110 -0
- package/dist-tsc/annotation-layer-utils.js.map +1 -0
- package/dist-tsc/annotation-layer-utils.test.d.ts +2 -0
- package/dist-tsc/annotation-layer-utils.test.d.ts.map +1 -0
- package/dist-tsc/annotation-layer-utils.test.js +153 -0
- package/dist-tsc/annotation-layer-utils.test.js.map +1 -0
- package/dist-tsc/deck.js +2 -2
- package/dist-tsc/deck.js.map +1 -1
- package/dist-tsc/index.d.ts +2 -0
- package/dist-tsc/index.js +2 -0
- package/dist-tsc/index.js.map +1 -1
- package/package.json +4 -3
- package/src/AnnotationLayer.js +91 -0
- package/src/AnnotationLayer.test.js +67 -0
- package/src/annotation-layer-utils.js +1137 -0
- package/src/annotation-layer-utils.test.js +180 -0
- package/src/deck.js +2 -1
- package/src/index.js +2 -0
package/dist/index.js
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
import { f as distEs6Exports } from "./index-
|
|
2
|
-
import { q,
|
|
1
|
+
import { f as distEs6Exports } from "./index-D4C8DA1x.js";
|
|
2
|
+
import { r, q, n, u, t, s, A, j, k, m, C, o, D, G, e, H, c, M, l, p, d, P, S, i, T, h, E, y, z, x, F, b, w, I, v } from "./index-D4C8DA1x.js";
|
|
3
3
|
const SELECTION_TYPE = distEs6Exports.SELECTION_TYPE;
|
|
4
4
|
export {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
r as AXIS_FONT_FAMILY,
|
|
6
|
+
q as AXIS_LABEL_TEXT_SIZE,
|
|
7
|
+
n as AXIS_MARGIN,
|
|
8
|
+
u as AXIS_MAX_SIZE,
|
|
9
|
+
t as AXIS_MIN_SIZE,
|
|
10
|
+
s as AXIS_PADDING,
|
|
11
|
+
A as AnnotationLayer,
|
|
11
12
|
j as BitmaskLayer,
|
|
12
13
|
k as BitmaskLayerBeta,
|
|
13
14
|
m as COLOR_BAR_SIZE,
|
|
14
15
|
C as ContourLayerWithText,
|
|
15
|
-
|
|
16
|
+
o as DATA_TEXTURE_SIZE,
|
|
16
17
|
D as DEFAULT_GL_OPTIONS,
|
|
17
18
|
G as GLSL_COLORMAPS,
|
|
18
19
|
e as GLSL_COLORMAP_DEFAULT,
|
|
@@ -20,7 +21,7 @@ export {
|
|
|
20
21
|
c as HeatmapCompositeTextLayer,
|
|
21
22
|
M as MAX_ROW_AGG,
|
|
22
23
|
l as MIN_ROW_AGG,
|
|
23
|
-
|
|
24
|
+
p as PIXELATED_TEXTURE_PARAMETERS,
|
|
24
25
|
d as PaddedExpressionHeatmapBitmapLayer,
|
|
25
26
|
P as PixelatedBitmapLayer,
|
|
26
27
|
SELECTION_TYPE,
|
|
@@ -28,9 +29,13 @@ export {
|
|
|
28
29
|
i as SelectionExtension,
|
|
29
30
|
T as TILE_SIZE,
|
|
30
31
|
h as colormaps,
|
|
31
|
-
|
|
32
|
+
E as computeArrowhead,
|
|
33
|
+
y as createAnnotationLayers,
|
|
34
|
+
z as createPreviewLayer,
|
|
35
|
+
x as deck,
|
|
36
|
+
F as getMeasurementLabel,
|
|
32
37
|
b as getSelectionLayer,
|
|
33
|
-
|
|
34
|
-
|
|
38
|
+
w as luma,
|
|
39
|
+
I as math,
|
|
35
40
|
v as viv
|
|
36
41
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as inflate_1 } from "./pako.esm-SxljTded.js";
|
|
2
|
-
import { g as getDefaultExportFromCjs, B as BaseDecoder, L as LercParameters, a as LercAddCompression } from "./index-
|
|
2
|
+
import { g as getDefaultExportFromCjs, B as BaseDecoder, L as LercParameters, a as LercAddCompression } from "./index-D4C8DA1x.js";
|
|
3
3
|
var LercDecode = { exports: {} };
|
|
4
4
|
var hasRequiredLercDecode;
|
|
5
5
|
function requireLercDecode() {
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A composite layer that renders annotation shapes
|
|
3
|
+
* (rectangles, lines, ellipses, polygons, polylines),
|
|
4
|
+
* along with their text labels, measurement labels,
|
|
5
|
+
* selection halo, semantic-zoom dots/clusters,
|
|
6
|
+
* and an optional preview of an in-progress shape.
|
|
7
|
+
*/
|
|
8
|
+
declare class AnnotationLayer {
|
|
9
|
+
shouldUpdateState({ changeFlags }: {
|
|
10
|
+
changeFlags: any;
|
|
11
|
+
}): any;
|
|
12
|
+
/**
|
|
13
|
+
* Prefix the sublayer ID with this layer's ID (so that multiple
|
|
14
|
+
* AnnotationLayers can co-exist), and combine this layer's
|
|
15
|
+
* opacity with the per-shape opacity of the sublayer.
|
|
16
|
+
* Note: we avoid getSubLayerProps here, since it would
|
|
17
|
+
* overwrite the sublayer extensions (e.g., PathStyleExtension)
|
|
18
|
+
* and opacity values.
|
|
19
|
+
* @param {object} layer A DeckGL layer instance.
|
|
20
|
+
* @returns {object} The cloned layer instance.
|
|
21
|
+
*/
|
|
22
|
+
wrapSubLayer(layer: object): object;
|
|
23
|
+
renderLayers(): object[];
|
|
24
|
+
}
|
|
25
|
+
declare namespace AnnotationLayer {
|
|
26
|
+
export let layerName: string;
|
|
27
|
+
export { defaultProps };
|
|
28
|
+
}
|
|
29
|
+
export default AnnotationLayer;
|
|
30
|
+
declare namespace defaultProps {
|
|
31
|
+
namespace data {
|
|
32
|
+
let type: string;
|
|
33
|
+
let value: never[];
|
|
34
|
+
let compare: boolean;
|
|
35
|
+
}
|
|
36
|
+
namespace selectedShapeUid {
|
|
37
|
+
let type_1: string;
|
|
38
|
+
export { type_1 as type };
|
|
39
|
+
let value_1: null;
|
|
40
|
+
export { value_1 as value };
|
|
41
|
+
}
|
|
42
|
+
namespace physicalPixelSize {
|
|
43
|
+
let type_2: string;
|
|
44
|
+
export { type_2 as type };
|
|
45
|
+
let value_2: null;
|
|
46
|
+
export { value_2 as value };
|
|
47
|
+
let compare_1: boolean;
|
|
48
|
+
export { compare_1 as compare };
|
|
49
|
+
}
|
|
50
|
+
namespace authoredZoom {
|
|
51
|
+
let type_3: string;
|
|
52
|
+
export { type_3 as type };
|
|
53
|
+
let value_3: null;
|
|
54
|
+
export { value_3 as value };
|
|
55
|
+
}
|
|
56
|
+
namespace semanticZoom {
|
|
57
|
+
let type_4: string;
|
|
58
|
+
export { type_4 as type };
|
|
59
|
+
let value_4: boolean;
|
|
60
|
+
export { value_4 as value };
|
|
61
|
+
}
|
|
62
|
+
namespace viewType {
|
|
63
|
+
let type_5: string;
|
|
64
|
+
export { type_5 as type };
|
|
65
|
+
let value_5: string;
|
|
66
|
+
export { value_5 as value };
|
|
67
|
+
}
|
|
68
|
+
namespace inProgressShape {
|
|
69
|
+
let type_6: string;
|
|
70
|
+
export { type_6 as type };
|
|
71
|
+
let value_6: null;
|
|
72
|
+
export { value_6 as value };
|
|
73
|
+
let compare_2: boolean;
|
|
74
|
+
export { compare_2 as compare };
|
|
75
|
+
}
|
|
76
|
+
namespace hoverCoord {
|
|
77
|
+
let type_7: string;
|
|
78
|
+
export { type_7 as type };
|
|
79
|
+
let value_7: null;
|
|
80
|
+
export { value_7 as value };
|
|
81
|
+
let compare_3: boolean;
|
|
82
|
+
export { compare_3 as compare };
|
|
83
|
+
}
|
|
84
|
+
namespace previewStrokeColor {
|
|
85
|
+
let type_8: string;
|
|
86
|
+
export { type_8 as type };
|
|
87
|
+
let value_8: number[];
|
|
88
|
+
export { value_8 as value };
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=AnnotationLayer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnnotationLayer.d.ts","sourceRoot":"","sources":["../src/AnnotationLayer.js"],"names":[],"mappings":"AAyBA;;;;;;GAMG;AACH;IAIE;;YAEC;IAED;;;;;;;;;OASG;IACH,oBAHW,MAAM,GACJ,MAAM,CAUlB;IAED,yBA2BC;CACF"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { CompositeLayer } from '@deck.gl/core';
|
|
2
|
+
import { ViewType } from '@vitessce/constants-internal';
|
|
3
|
+
import { createAnnotationLayers, createPreviewLayer } from './annotation-layer-utils.js';
|
|
4
|
+
const defaultProps = {
|
|
5
|
+
// Array of annotation shape objects (see annotationShapeObj in @vitessce/schemas).
|
|
6
|
+
data: { type: 'object', value: [], compare: true },
|
|
7
|
+
// UID of the shape to highlight with a selection halo.
|
|
8
|
+
selectedShapeUid: { type: 'string', value: null },
|
|
9
|
+
// { x, y, unit } used to format measurement labels in physical units.
|
|
10
|
+
physicalPixelSize: { type: 'object', value: null, compare: true },
|
|
11
|
+
// The zoom level at which the shapes were authored (reference for semantic zoom).
|
|
12
|
+
authoredZoom: { type: 'number', value: null },
|
|
13
|
+
// Whether to apply semantic zoom (level-of-detail) based on authoredZoom.
|
|
14
|
+
semanticZoom: { type: 'boolean', value: true },
|
|
15
|
+
// The view type in which the layer is rendered (affects measurement label formatting).
|
|
16
|
+
viewType: { type: 'string', value: ViewType.SPATIAL },
|
|
17
|
+
// In-progress shape being drawn, as { type, vertices }.
|
|
18
|
+
inProgressShape: { type: 'object', value: null, compare: true },
|
|
19
|
+
// Current mouse position (in data coordinates) while drawing.
|
|
20
|
+
hoverCoord: { type: 'array', value: null, compare: true },
|
|
21
|
+
// Stroke color [r, g, b] of the in-progress shape preview.
|
|
22
|
+
previewStrokeColor: { type: 'color', value: [255, 255, 0] },
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* A composite layer that renders annotation shapes
|
|
26
|
+
* (rectangles, lines, ellipses, polygons, polylines),
|
|
27
|
+
* along with their text labels, measurement labels,
|
|
28
|
+
* selection halo, semantic-zoom dots/clusters,
|
|
29
|
+
* and an optional preview of an in-progress shape.
|
|
30
|
+
*/
|
|
31
|
+
export default class AnnotationLayer extends CompositeLayer {
|
|
32
|
+
// The semantic zoom and arrowhead sizes depend on the current zoom level,
|
|
33
|
+
// so the sublayers must also be re-rendered when the viewport changes.
|
|
34
|
+
// eslint-disable-next-line class-methods-use-this
|
|
35
|
+
shouldUpdateState({ changeFlags }) {
|
|
36
|
+
return changeFlags.propsOrDataChanged || changeFlags.viewportChanged;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Prefix the sublayer ID with this layer's ID (so that multiple
|
|
40
|
+
* AnnotationLayers can co-exist), and combine this layer's
|
|
41
|
+
* opacity with the per-shape opacity of the sublayer.
|
|
42
|
+
* Note: we avoid getSubLayerProps here, since it would
|
|
43
|
+
* overwrite the sublayer extensions (e.g., PathStyleExtension)
|
|
44
|
+
* and opacity values.
|
|
45
|
+
* @param {object} layer A DeckGL layer instance.
|
|
46
|
+
* @returns {object} The cloned layer instance.
|
|
47
|
+
*/
|
|
48
|
+
wrapSubLayer(layer) {
|
|
49
|
+
const { id, opacity, pickable, visible } = this.props;
|
|
50
|
+
return layer.clone({
|
|
51
|
+
id: `${id}-${layer.id}`,
|
|
52
|
+
opacity: layer.props.opacity * opacity,
|
|
53
|
+
pickable,
|
|
54
|
+
visible,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
renderLayers() {
|
|
58
|
+
const { data, selectedShapeUid, physicalPixelSize, authoredZoom, semanticZoom, viewType, inProgressShape, hoverCoord, previewStrokeColor, } = this.props;
|
|
59
|
+
const zoom = this.context.viewport?.zoom ?? 0;
|
|
60
|
+
const visibleShapes = (data ?? []).filter(shape => shape.visible !== false);
|
|
61
|
+
const annotationLayers = createAnnotationLayers(visibleShapes, zoom, selectedShapeUid, physicalPixelSize, authoredZoom, semanticZoom, viewType);
|
|
62
|
+
const previewLayer = createPreviewLayer(inProgressShape, hoverCoord, previewStrokeColor.slice(0, 3));
|
|
63
|
+
return [
|
|
64
|
+
...annotationLayers,
|
|
65
|
+
...(previewLayer ? [previewLayer] : []),
|
|
66
|
+
].map(layer => this.wrapSubLayer(layer));
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
AnnotationLayer.layerName = 'AnnotationLayer';
|
|
70
|
+
AnnotationLayer.defaultProps = defaultProps;
|
|
71
|
+
//# sourceMappingURL=AnnotationLayer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnnotationLayer.js","sourceRoot":"","sources":["../src/AnnotationLayer.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAEzF,MAAM,YAAY,GAAG;IACnB,mFAAmF;IACnF,IAAI,EAAE,EAAE,IA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YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnnotationLayer.test.d.ts","sourceRoot":"","sources":["../src/AnnotationLayer.test.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import AnnotationLayer from './AnnotationLayer.js';
|
|
3
|
+
function renderSubLayers(props, zoom = 0) {
|
|
4
|
+
const layer = new AnnotationLayer({ id: 'annotations', ...props });
|
|
5
|
+
layer.context = { viewport: { zoom } };
|
|
6
|
+
return layer.renderLayers();
|
|
7
|
+
}
|
|
8
|
+
describe('AnnotationLayer', () => {
|
|
9
|
+
it('renders no sublayers when given no shapes', () => {
|
|
10
|
+
expect(renderSubLayers({ data: [] })).toHaveLength(0);
|
|
11
|
+
});
|
|
12
|
+
it('prefixes sublayer IDs with the parent layer ID', () => {
|
|
13
|
+
const data = [{ uid: 'r1', type: 'rectangle', x: 0, y: 0, width: 10, height: 10 }];
|
|
14
|
+
const layers = renderSubLayers({ data });
|
|
15
|
+
expect(layers).toHaveLength(1);
|
|
16
|
+
expect(layers[0].id).toBe('annotations-annotation-rect-r1-0');
|
|
17
|
+
});
|
|
18
|
+
it('skips shapes with visible: false', () => {
|
|
19
|
+
const data = [
|
|
20
|
+
{ uid: 'r1', type: 'rectangle', x: 0, y: 0, width: 10, height: 10, visible: false },
|
|
21
|
+
{ uid: 'r2', type: 'rectangle', x: 0, y: 0, width: 10, height: 10 },
|
|
22
|
+
];
|
|
23
|
+
const layers = renderSubLayers({ data });
|
|
24
|
+
expect(layers).toHaveLength(1);
|
|
25
|
+
expect(layers[0].id).toContain('r2');
|
|
26
|
+
});
|
|
27
|
+
it('multiplies the parent opacity with the sublayer opacity', () => {
|
|
28
|
+
const data = [{ uid: 'r1', type: 'rectangle', x: 0, y: 0, width: 10, height: 10 }];
|
|
29
|
+
const layers = renderSubLayers({ data, opacity: 0.5 });
|
|
30
|
+
expect(layers[0].props.opacity).toBeCloseTo(0.5);
|
|
31
|
+
});
|
|
32
|
+
it('preserves the PathStyleExtension of dashed sublayers', () => {
|
|
33
|
+
const data = [{ uid: 'p1', type: 'polyline', points: [[0, 0], [10, 10]], strokeDashArray: '4 2' }];
|
|
34
|
+
const layers = renderSubLayers({ data });
|
|
35
|
+
expect(layers[0].props.extensions).toHaveLength(1);
|
|
36
|
+
expect(layers[0].props.getDashArray).toEqual([4, 2]);
|
|
37
|
+
});
|
|
38
|
+
it('renders shapes as dots when zoomed far out relative to authoredZoom', () => {
|
|
39
|
+
const data = [{ uid: 'r1', type: 'rectangle', x: 0, y: 0, width: 10, height: 10 }];
|
|
40
|
+
const layers = renderSubLayers({ data, authoredZoom: 0 }, -2);
|
|
41
|
+
expect(layers).toHaveLength(1);
|
|
42
|
+
expect(layers[0].id).toBe('annotations-annotation-dots');
|
|
43
|
+
});
|
|
44
|
+
it('renders full geometry when semanticZoom is false', () => {
|
|
45
|
+
const data = [{ uid: 'r1', type: 'rectangle', x: 0, y: 0, width: 10, height: 10 }];
|
|
46
|
+
const layers = renderSubLayers({ data, authoredZoom: 0, semanticZoom: false }, -2);
|
|
47
|
+
expect(layers[0].id).toBe('annotations-annotation-rect-r1-0');
|
|
48
|
+
});
|
|
49
|
+
it('renders a preview sublayer for an in-progress shape', () => {
|
|
50
|
+
const layers = renderSubLayers({
|
|
51
|
+
data: [],
|
|
52
|
+
inProgressShape: { type: 'line', vertices: [[0, 0]] },
|
|
53
|
+
hoverCoord: [5, 5],
|
|
54
|
+
});
|
|
55
|
+
expect(layers).toHaveLength(1);
|
|
56
|
+
expect(layers[0].id).toBe('annotations-annotation-preview-line');
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
//# sourceMappingURL=AnnotationLayer.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnnotationLayer.test.js","sourceRoot":"","sources":["../src/AnnotationLayer.test.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,Q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AK,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;QACnF,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,kCAAkC,CAAC,CAAC;IAChE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,qDAAqD,EAAE,GAAG,EAAE;QAC7D,MAAM,MAAM,GAAG,eAAe,CAAC;YAC7B,IAAI,EAAE,EAAE;YACR,eAAe,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE;YACrD,UAAU,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;SACnB,CAAC,CAAC;QACH,MAAM,CAAC,MAAM,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;QAC/B,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,qCAAqC,CAAC,CAAC;IACnE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Build a deck.gl layer that previews the in-progress annotation shape while drawing.
|
|
3
|
+
* @param {{ type: string, vertices: [number, number][] }} inProgress
|
|
4
|
+
* @param {[number, number] | null} hoverCoord - current mouse position in data coords
|
|
5
|
+
* @param {number[]} strokeColor - [r, g, b]
|
|
6
|
+
*/
|
|
7
|
+
export function createPreviewLayer(inProgress: {
|
|
8
|
+
type: string;
|
|
9
|
+
vertices: [number, number][];
|
|
10
|
+
}, hoverCoord: [number, number] | null, strokeColor?: number[]): any;
|
|
11
|
+
/**
|
|
12
|
+
* Compute the two endpoints of a tick-cap (perpendicular crossbar) at (tipX, tipY).
|
|
13
|
+
* dirX/dirY is the line direction (the tick is perpendicular to it).
|
|
14
|
+
* Returns null if the direction vector is zero-length.
|
|
15
|
+
*/
|
|
16
|
+
export function computeTickCap(tipX: any, tipY: any, dirX: any, dirY: any, dataSize: any): any[][] | null;
|
|
17
|
+
/**
|
|
18
|
+
* Compute the three vertices of an arrowhead triangle pointing in the direction (dirX, dirY).
|
|
19
|
+
* The tip is at (tipX, tipY). dataSize controls the triangle's height in data units.
|
|
20
|
+
* Returns null if the direction vector is zero-length.
|
|
21
|
+
*/
|
|
22
|
+
export function computeArrowhead(tipX: any, tipY: any, dirX: any, dirY: any, dataSize: any): any[][] | null;
|
|
23
|
+
export function getMeasurementLabel(shape: any, physicalPixelSize: any, viewType?: string): any;
|
|
24
|
+
export function createAnnotationLayers(shapes?: any[], zoom?: number, selectedShapeUid?: null, physicalPixelSize?: null, authoredZoom?: null, semanticZoom?: boolean, viewType?: string): any[];
|
|
25
|
+
//# sourceMappingURL=annotation-layer-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"annotation-layer-utils.d.ts","sourceRoot":"","sources":["../src/annotation-layer-utils.js"],"names":[],"mappings":"AAiDA;;;;;GAKG;AACH,+CAJW;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAA;CAAE,cAC9C,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,gBACvB,MAAM,EAAE,OAkFlB;AAED;;;;GAIG;AACH,0GAaC;AAED;;;;GAIG;AACH,4GAeC;AAgBD,gGA8DC;AA0DD,gMAuzBC"}
|