@cosmos.gl/graph 2.7.0-beta.2 → 2.7.0-beta.3
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/{index-CSMQs8iI.js → index-u8g06ZrC.js} +13407 -13403
- package/dist/index-u8g06ZrC.js.map +1 -0
- package/dist/index.js +11 -10
- package/dist/index.min.js +59 -59
- package/dist/index.min.js.map +1 -1
- package/dist/src/helper.d.ts +10 -0
- package/dist/src/index.d.ts +22 -0
- package/dist/src/modules/Store/index.d.ts +6 -1
- package/dist/{webgl-device-QoBMYpnS.js → webgl-device-BeV8-7_B.js} +2 -2
- package/dist/webgl-device-BeV8-7_B.js.map +1 -0
- package/package.json +6 -5
- package/dist/index-CSMQs8iI.js.map +0 -1
- package/dist/webgl-device-QoBMYpnS.js.map +0 -1
package/dist/src/helper.d.ts
CHANGED
|
@@ -43,8 +43,18 @@ export declare function rgbToBrightness(r: number, g: number, b: number): number
|
|
|
43
43
|
* - Consider batching the migration to avoid inconsistencies
|
|
44
44
|
*
|
|
45
45
|
* Current status: Deprecated but still functional. Keeping for now until full migration can be planned.
|
|
46
|
+
*
|
|
47
|
+
* @note Cosmos currently supports WebGL only; support for other device types will be added later.
|
|
46
48
|
*/
|
|
47
49
|
export declare function readPixels(device: Device, fbo: Framebuffer, sourceX?: number, sourceY?: number, sourceWidth?: number, sourceHeight?: number): Float32Array;
|
|
50
|
+
/**
|
|
51
|
+
* Returns the maximum point size supported by the device, scaled by pixel ratio.
|
|
52
|
+
* For WebGL devices, reads the limit from the context; for other device types, uses MAX_POINT_SIZE from Store.
|
|
53
|
+
* @param device - The luma.gl device
|
|
54
|
+
* @param pixelRatio - Device pixel ratio to scale the result
|
|
55
|
+
* @returns Maximum point size (device limit / pixelRatio)
|
|
56
|
+
*/
|
|
57
|
+
export declare function getMaxPointSize(device: Device, pixelRatio: number): number;
|
|
48
58
|
export declare function clamp(num: number, min: number, max: number): number;
|
|
49
59
|
export declare function isNumber(value: number | undefined | null | typeof NaN): boolean;
|
|
50
60
|
/**
|
package/dist/src/index.d.ts
CHANGED
|
@@ -4,11 +4,18 @@ import { GraphData } from './modules/GraphData';
|
|
|
4
4
|
export declare class Graph {
|
|
5
5
|
config: GraphConfig;
|
|
6
6
|
graph: GraphData;
|
|
7
|
+
/** Canvas element, assigned asynchronously during device initialization */
|
|
7
8
|
private canvas;
|
|
8
9
|
private attributionDivElement;
|
|
9
10
|
private canvasD3Selection;
|
|
10
11
|
private device;
|
|
11
12
|
private deviceInitPromise;
|
|
13
|
+
/**
|
|
14
|
+
* Tracks whether this Graph instance owns the device and should destroy it on cleanup.
|
|
15
|
+
* Set to `true` when Graph creates its own device, `false` when using an external device.
|
|
16
|
+
* When `false`, the external device lifecycle is managed by the user.
|
|
17
|
+
*/
|
|
18
|
+
private shouldDestroyDevice;
|
|
12
19
|
private requestAnimationFrameId;
|
|
13
20
|
private isRightClickMouse;
|
|
14
21
|
private store;
|
|
@@ -34,6 +41,21 @@ export declare class Graph {
|
|
|
34
41
|
* If the mouse is not on the Canvas, the `findHoveredPoint` or `findHoveredLine` method will not be executed.
|
|
35
42
|
*/
|
|
36
43
|
private _isMouseOnCanvas;
|
|
44
|
+
/**
|
|
45
|
+
* Last mouse position for detecting significant mouse movement
|
|
46
|
+
*/
|
|
47
|
+
private _lastMouseX;
|
|
48
|
+
private _lastMouseY;
|
|
49
|
+
/**
|
|
50
|
+
* Last checked mouse position for hover detection
|
|
51
|
+
*/
|
|
52
|
+
private _lastCheckedMouseX;
|
|
53
|
+
private _lastCheckedMouseY;
|
|
54
|
+
/**
|
|
55
|
+
* Force hover detection on next frame, bypassing mouse movement check.
|
|
56
|
+
* Set when scene changes but mouse stays still (after simulation or zoom ends).
|
|
57
|
+
*/
|
|
58
|
+
private _shouldForceHoverDetection;
|
|
37
59
|
/**
|
|
38
60
|
* After setting data and render graph at a first time, the fit logic will run
|
|
39
61
|
* */
|
|
@@ -8,6 +8,11 @@ export declare const MAX_POINT_SIZE = 64;
|
|
|
8
8
|
* The `findHoveredItem` method will skip actual detection until this count is reached.
|
|
9
9
|
*/
|
|
10
10
|
export declare const MAX_HOVER_DETECTION_DELAY = 4;
|
|
11
|
+
/**
|
|
12
|
+
* Minimum mouse movement threshold (in pixels) to trigger hover detection.
|
|
13
|
+
* If the mouse moves less than this distance, hover detection will be skipped to save performance.
|
|
14
|
+
*/
|
|
15
|
+
export declare const MIN_MOUSE_MOVEMENT_THRESHOLD = 2;
|
|
11
16
|
export type Hovered = {
|
|
12
17
|
index: number;
|
|
13
18
|
position: [number, number];
|
|
@@ -19,7 +24,7 @@ type Focused = {
|
|
|
19
24
|
* Type alias for a 4x4 matrix stored as a 16-element array in column-major order.
|
|
20
25
|
* Used for std140 uniform buffer layout compatibility.
|
|
21
26
|
*/
|
|
22
|
-
type Mat4Array = [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number];
|
|
27
|
+
export type Mat4Array = [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number];
|
|
23
28
|
export declare class Store {
|
|
24
29
|
pointsTextureSize: number;
|
|
25
30
|
linksTextureSize: number;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var je = Object.defineProperty;
|
|
2
2
|
var Qe = (r, t, e) => t in r ? je(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
|
|
3
3
|
var o = (r, t, e) => Qe(r, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
-
import { i as Me, a as Ye, n as Ke, u as Ze, R as S, l as b, T as B, g as Je, t as We, D as et, b as tt, B as C, S as rt, c as it, d as nt, e as st, f as at, h as ot, j as ct, k as lt, m as pe, o as ut, p as ht } from "./index-
|
|
4
|
+
import { i as Me, a as Ye, n as Ke, u as Ze, R as S, l as b, T as B, g as Je, t as We, D as et, b as tt, B as C, S as rt, c as it, d as nt, e as st, f as at, h as ot, j as ct, k as lt, m as pe, o as ut, p as ht } from "./index-u8g06ZrC.js";
|
|
5
5
|
function ft(r) {
|
|
6
6
|
return Me() ? Ye() ? "Electron" : (Ke.userAgent || "").indexOf("Edge") > -1 ? "Edge" : globalThis.chrome ? "Chrome" : globalThis.safari ? "Safari" : globalThis.mozInnerScreenX ? "Firefox" : "Unknown" : "Node";
|
|
7
7
|
}
|
|
@@ -3930,4 +3930,4 @@ function Xr(r, t) {
|
|
|
3930
3930
|
export {
|
|
3931
3931
|
jr as WebGLDevice
|
|
3932
3932
|
};
|
|
3933
|
-
//# sourceMappingURL=webgl-device-
|
|
3933
|
+
//# sourceMappingURL=webgl-device-BeV8-7_B.js.map
|