@hema-to/regl-scatterplot 1.14.1

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.
@@ -0,0 +1,126 @@
1
+ /**
2
+ * Check if all GL extensions are supported and enabled and warn otherwise
3
+ * @param {import('regl').Regl} regl Regl instance to be tested
4
+ * @param {boolean} silent If `true` the function will not print `console.warn` statements
5
+ * @return {boolean} If `true` all required GL extensions are supported
6
+ */
7
+ declare function checkReglExtensions(regl: import("regl").Regl, silent: boolean): boolean;
8
+ /**
9
+ * Create a new Regl instance with `GL_EXTENSIONS` enables
10
+ * @param {HTMLCanvasElement} canvas Canvas element to be rendered on
11
+ * @return {import('regl').Regl} New Regl instance
12
+ */
13
+ export function createRegl(canvas: HTMLCanvasElement): import("regl").Regl;
14
+ export function createRenderer(options?: Partial<import("./types").RendererOptions>): {
15
+ /**
16
+ * Get the associated canvas element
17
+ * @return {HTMLCanvasElement} The associated canvas element
18
+ */
19
+ readonly canvas: HTMLCanvasElement;
20
+ /**
21
+ * Get the associated Regl instance
22
+ * @return {import('regl').Regl} The associated Regl instance
23
+ */
24
+ readonly regl: import("regl").Regl;
25
+ /**
26
+ * Get the gamma value
27
+ * @return {number} The gamma value
28
+ */
29
+ gamma: number;
30
+ /**
31
+ * Get whether the browser supports all necessary WebGL features
32
+ * @return {boolean} If `true` the browser supports all necessary WebGL features
33
+ */
34
+ readonly isSupported: boolean;
35
+ /**
36
+ * Get whether the renderer (and its Regl instance) is destroyed
37
+ * @return {boolean} If `true` the renderer is destroyed
38
+ */
39
+ readonly isDestroyed: boolean;
40
+ render: (draw: () => any, targetCanvas: HTMLCanvasElement) => void;
41
+ resize: (customWidth: number, customHeight: number) => void;
42
+ onFrame: (draw: () => any) => () => void;
43
+ refresh: () => void;
44
+ destroy: () => void;
45
+ };
46
+ /**
47
+ * Create spatial index from points.
48
+ *
49
+ * @description
50
+ * The spatial index can be used with `scatterplot.draw(points, { spatialIndex })`
51
+ * to drastically speed up the draw call.
52
+ *
53
+ * @param {import('./types').Points} points - The points for which to create the spatial index.
54
+ * @param {boolean=} useWorker - Whether to create the spatial index in a worker thread or not. If `undefined`, the spatial index will be created in a worker if `points` contains more than one million entries.
55
+ * @return {Promise<ArrayBuffer>} Spatial index
56
+ */
57
+ export function createSpatialIndex(points: import("./types").Points, useWorker?: boolean | undefined): Promise<ArrayBuffer>;
58
+ /**
59
+ * @deprecated Please use `scatterplot.createTextureFromUrl(url)`
60
+ *
61
+ * Create a Regl texture from an URL.
62
+ * @param {import('regl').Regl} regl Regl instance used for creating the texture.
63
+ * @param {string} url Source URL of the image.
64
+ * @return {Promise<import('regl').Texture2D>} Promise resolving to the texture object.
65
+ */
66
+ export function createTextureFromUrl(regl: import("regl").Regl, url: string, timeout?: number): Promise<import("regl").Texture2D>;
67
+ declare function createScatterplot(initialProperties?: Partial<import("./types").Properties>): {
68
+ /**
69
+ * Get whether the browser supports all necessary WebGL features
70
+ * @return {boolean} If `true` the browser supports all necessary WebGL features
71
+ */
72
+ readonly isSupported: boolean;
73
+ clear: () => Promise<void>;
74
+ clearPoints: () => Promise<void>;
75
+ clearPointConnections: () => Promise<void>;
76
+ clearAnnotations: () => Promise<void>;
77
+ createTextureFromUrl: (url: string, timeout?: number) => Promise<import("regl").Texture2D>;
78
+ deselect: ({ preventEvent }?: {
79
+ preventEvent?: boolean;
80
+ }) => void;
81
+ destroy: () => void;
82
+ draw: (newPoints: import("./types").Points, options?: import("./types").ScatterplotMethodOptions["draw"]) => Promise<void>;
83
+ drawAnnotations: (newAnnotations: import("./types").Annotation[]) => Promise<void>;
84
+ filter: (pointIdxs: number | number[], { preventEvent }?: import("./types").ScatterplotMethodOptions["filter"]) => Promise<any>;
85
+ get: <Key extends keyof import("./types").Properties>(property: Key) => import("./types").Properties[Key];
86
+ getScreenPosition: (pointIdx: number) => [number, number] | undefined;
87
+ hover: (point: number, { showReticleOnce, preventEvent }?: import("./types").ScatterplotMethodOptions["hover"]) => void;
88
+ redraw: () => void;
89
+ refresh: () => void;
90
+ reset: (args_0?: Partial<{
91
+ preventEvent: boolean;
92
+ }>) => Promise<void>;
93
+ select: (pointIdxs: number | number[], { intersect, merge, remove, preventEvent, }?: import("./types").ScatterplotMethodOptions["select"]) => void;
94
+ set: (properties: Partial<import("./types").Settable>) => Promise<void>;
95
+ export: {
96
+ /**
97
+ * Export view as `ImageData` using the current render settings
98
+ * @overload
99
+ * @param {undefined} options
100
+ * @return {ImageData}
101
+ */
102
+ (options: undefined): ImageData;
103
+ /**
104
+ * Export view as `ImageData` using custom render settings
105
+ * @overload
106
+ * @param {import('./types').ScatterplotMethodOptions['export']} options
107
+ * @return {Promise<ImageData>}
108
+ */
109
+ (options: import("./types").ScatterplotMethodOptions["export"]): Promise<ImageData>;
110
+ };
111
+ subscribe: <Key extends "view" | "select" | "focus" | "destroy" | "points" | "lassoEnd" | "deselect" | "init" | "backgroundImageReady" | "unfilter" | "lassoStart" | "transitionStart" | "pointConnectionsDraw" | "lassoExtend" | "pointOver" | "pointOut" | "transitionEnd" | "draw" | "drawing">(event: Key, handler: import("pub-sub-es").Handler<import("./types").Events[Key]>, times?: number) => {
112
+ event: Key;
113
+ handler: import("pub-sub-es").Handler<import("./types").Events[Key]>;
114
+ };
115
+ unfilter: ({ preventEvent }?: import("./types").ScatterplotMethodOptions["filter"]) => Promise<any>;
116
+ unsubscribe: {
117
+ <Key extends "view" | "select" | "focus" | "destroy" | "points" | "lassoEnd" | "deselect" | "init" | "backgroundImageReady" | "unfilter" | "lassoStart" | "transitionStart" | "pointConnectionsDraw" | "lassoExtend" | "pointOver" | "pointOut" | "transitionEnd" | "draw" | "drawing">(subscription: import("pub-sub-es").Subscription<import("./types").Events, Key>): void;
118
+ <Key_1 extends "view" | "select" | "focus" | "destroy" | "points" | "lassoEnd" | "deselect" | "init" | "backgroundImageReady" | "unfilter" | "lassoStart" | "transitionStart" | "pointConnectionsDraw" | "lassoExtend" | "pointOver" | "pointOut" | "transitionEnd" | "draw" | "drawing">(event: Key_1, handler: import("pub-sub-es").Handler<import("./types").Events[Key_1]>): void;
119
+ };
120
+ view: (cameraView: number[], { preventEvent }?: import("./types").ScatterplotMethodOptions["preventEvent"]) => void;
121
+ zoomToLocation: (target: number[], distance: number, options?: import("./types").ScatterplotMethodOptions["zoomToLocation"]) => Promise<void>;
122
+ zoomToArea: (rect: import("./types").Rect, options?: import("./types").ScatterplotMethodOptions["zoomToArea"]) => Promise<void>;
123
+ zoomToPoints: (pointIdxs: number[], options?: import("./types").ScatterplotMethodOptions["zoomToPoints"]) => Promise<void>;
124
+ zoomToOrigin: (options?: import("./types").ScatterplotMethodOptions["zoomToLocation"]) => Promise<void>;
125
+ };
126
+ export { checkReglExtensions as checkSupport, createScatterplot as default };