@cosmos.gl/graph 3.0.0-beta.5 → 3.0.0-beta.7
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/README.md +21 -2
- package/dist/config.d.ts +127 -179
- package/dist/index.d.ts +77 -41
- package/dist/index.js +1341 -993
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +163 -67
- package/dist/index.min.js.map +1 -1
- package/dist/modules/Clusters/index.d.ts +9 -0
- package/dist/modules/GraphData/index.d.ts +4 -5
- package/dist/modules/Lines/conic-curve-module.d.ts +2 -0
- package/dist/modules/Lines/index.d.ts +10 -0
- package/dist/modules/Points/index.d.ts +7 -0
- package/dist/modules/Zoom/index.d.ts +4 -0
- package/dist/variables.d.ts +75 -43
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,77 +1,26 @@
|
|
|
1
|
-
import { select as
|
|
1
|
+
import { select as b } from "d3-selection";
|
|
2
2
|
import "d3-transition";
|
|
3
|
-
import { easeQuadIn as
|
|
4
|
-
import { textureFormatDecoder as
|
|
5
|
-
import { webgl2Adapter as
|
|
6
|
-
import { color as
|
|
7
|
-
import
|
|
8
|
-
import { scaleLinear as
|
|
3
|
+
import { easeQuadIn as ne, easeQuadOut as re, easeQuadInOut as ae } from "d3-ease";
|
|
4
|
+
import { textureFormatDecoder as de, Texture as g, Buffer as S, UniformStore as R, luma as le } from "@luma.gl/core";
|
|
5
|
+
import { webgl2Adapter as ce } from "@luma.gl/webgl";
|
|
6
|
+
import { color as fe } from "d3-color";
|
|
7
|
+
import he from "dompurify";
|
|
8
|
+
import { scaleLinear as Q, scalePow as ue } from "d3-scale";
|
|
9
9
|
import { mat3 as V } from "gl-matrix";
|
|
10
|
-
import { Random as
|
|
11
|
-
import { Model as
|
|
12
|
-
import
|
|
13
|
-
import { range as
|
|
14
|
-
import { zoomIdentity as W, zoom as
|
|
15
|
-
import { drag as
|
|
16
|
-
|
|
17
|
-
enableSimulation: !0,
|
|
18
|
-
spaceSize: 8192,
|
|
19
|
-
pointSizeScale: 1,
|
|
20
|
-
linkWidthScale: 1,
|
|
21
|
-
linkArrowsSizeScale: 1,
|
|
22
|
-
renderLinks: !0,
|
|
23
|
-
curvedLinks: !1,
|
|
24
|
-
curvedLinkSegments: 19,
|
|
25
|
-
curvedLinkWeight: 0.8,
|
|
26
|
-
curvedLinkControlPointDistance: 0.5,
|
|
27
|
-
linkArrows: !1,
|
|
28
|
-
linkVisibilityDistanceRange: [50, 150],
|
|
29
|
-
linkVisibilityMinTransparency: 0.25,
|
|
30
|
-
hoveredPointCursor: "auto",
|
|
31
|
-
hoveredLinkCursor: "auto",
|
|
32
|
-
renderHoveredPointRing: !1,
|
|
33
|
-
hoveredPointRingColor: "white",
|
|
34
|
-
hoveredLinkColor: void 0,
|
|
35
|
-
hoveredLinkWidthIncrease: 5,
|
|
36
|
-
focusedPointRingColor: "white",
|
|
37
|
-
focusedPointIndex: void 0,
|
|
38
|
-
simulation: {
|
|
39
|
-
decay: 5e3,
|
|
40
|
-
gravity: 0.25,
|
|
41
|
-
center: 0,
|
|
42
|
-
repulsion: 1,
|
|
43
|
-
repulsionTheta: 1.15,
|
|
44
|
-
linkSpring: 1,
|
|
45
|
-
linkDistance: 10,
|
|
46
|
-
linkDistRandomVariationRange: [1, 1.2],
|
|
47
|
-
repulsionFromMouse: 2,
|
|
48
|
-
friction: 0.85,
|
|
49
|
-
cluster: 0.1
|
|
50
|
-
},
|
|
51
|
-
showFPSMonitor: !1,
|
|
52
|
-
pixelRatio: typeof window < "u" && window.devicePixelRatio || 2,
|
|
53
|
-
scalePointsOnZoom: !1,
|
|
54
|
-
scaleLinksOnZoom: !1,
|
|
55
|
-
enableZoom: !0,
|
|
56
|
-
enableSimulationDuringZoom: !1,
|
|
57
|
-
enableDrag: !1,
|
|
58
|
-
fitViewOnInit: !0,
|
|
59
|
-
fitViewDelay: 250,
|
|
60
|
-
fitViewPadding: 0.1,
|
|
61
|
-
fitViewDuration: 250,
|
|
62
|
-
pointSamplingDistance: 150,
|
|
63
|
-
attribution: "",
|
|
64
|
-
rescalePositions: void 0,
|
|
65
|
-
enableRightClickRepulsion: !1
|
|
66
|
-
}, ve = 0.7, Ie = 0.95, me = 3;
|
|
67
|
-
var K;
|
|
10
|
+
import { Random as Se } from "random";
|
|
11
|
+
import { Model as x } from "@luma.gl/engine";
|
|
12
|
+
import pe from "gl-bench";
|
|
13
|
+
import { range as _e } from "d3-array";
|
|
14
|
+
import { zoomIdentity as W, zoom as Te } from "d3-zoom";
|
|
15
|
+
import { drag as ge } from "d3-drag";
|
|
16
|
+
var L;
|
|
68
17
|
(function(e) {
|
|
69
18
|
e[e.DEPTH_BUFFER_BIT = 256] = "DEPTH_BUFFER_BIT", e[e.STENCIL_BUFFER_BIT = 1024] = "STENCIL_BUFFER_BIT", e[e.COLOR_BUFFER_BIT = 16384] = "COLOR_BUFFER_BIT", e[e.POINTS = 0] = "POINTS", e[e.LINES = 1] = "LINES", e[e.LINE_LOOP = 2] = "LINE_LOOP", e[e.LINE_STRIP = 3] = "LINE_STRIP", e[e.TRIANGLES = 4] = "TRIANGLES", e[e.TRIANGLE_STRIP = 5] = "TRIANGLE_STRIP", e[e.TRIANGLE_FAN = 6] = "TRIANGLE_FAN", e[e.ZERO = 0] = "ZERO", e[e.ONE = 1] = "ONE", e[e.SRC_COLOR = 768] = "SRC_COLOR", e[e.ONE_MINUS_SRC_COLOR = 769] = "ONE_MINUS_SRC_COLOR", e[e.SRC_ALPHA = 770] = "SRC_ALPHA", e[e.ONE_MINUS_SRC_ALPHA = 771] = "ONE_MINUS_SRC_ALPHA", e[e.DST_ALPHA = 772] = "DST_ALPHA", e[e.ONE_MINUS_DST_ALPHA = 773] = "ONE_MINUS_DST_ALPHA", e[e.DST_COLOR = 774] = "DST_COLOR", e[e.ONE_MINUS_DST_COLOR = 775] = "ONE_MINUS_DST_COLOR", e[e.SRC_ALPHA_SATURATE = 776] = "SRC_ALPHA_SATURATE", e[e.CONSTANT_COLOR = 32769] = "CONSTANT_COLOR", e[e.ONE_MINUS_CONSTANT_COLOR = 32770] = "ONE_MINUS_CONSTANT_COLOR", e[e.CONSTANT_ALPHA = 32771] = "CONSTANT_ALPHA", e[e.ONE_MINUS_CONSTANT_ALPHA = 32772] = "ONE_MINUS_CONSTANT_ALPHA", e[e.FUNC_ADD = 32774] = "FUNC_ADD", e[e.FUNC_SUBTRACT = 32778] = "FUNC_SUBTRACT", e[e.FUNC_REVERSE_SUBTRACT = 32779] = "FUNC_REVERSE_SUBTRACT", e[e.BLEND_EQUATION = 32777] = "BLEND_EQUATION", e[e.BLEND_EQUATION_RGB = 32777] = "BLEND_EQUATION_RGB", e[e.BLEND_EQUATION_ALPHA = 34877] = "BLEND_EQUATION_ALPHA", e[e.BLEND_DST_RGB = 32968] = "BLEND_DST_RGB", e[e.BLEND_SRC_RGB = 32969] = "BLEND_SRC_RGB", e[e.BLEND_DST_ALPHA = 32970] = "BLEND_DST_ALPHA", e[e.BLEND_SRC_ALPHA = 32971] = "BLEND_SRC_ALPHA", e[e.BLEND_COLOR = 32773] = "BLEND_COLOR", e[e.ARRAY_BUFFER_BINDING = 34964] = "ARRAY_BUFFER_BINDING", e[e.ELEMENT_ARRAY_BUFFER_BINDING = 34965] = "ELEMENT_ARRAY_BUFFER_BINDING", e[e.LINE_WIDTH = 2849] = "LINE_WIDTH", e[e.ALIASED_POINT_SIZE_RANGE = 33901] = "ALIASED_POINT_SIZE_RANGE", e[e.ALIASED_LINE_WIDTH_RANGE = 33902] = "ALIASED_LINE_WIDTH_RANGE", e[e.CULL_FACE_MODE = 2885] = "CULL_FACE_MODE", e[e.FRONT_FACE = 2886] = "FRONT_FACE", e[e.DEPTH_RANGE = 2928] = "DEPTH_RANGE", e[e.DEPTH_WRITEMASK = 2930] = "DEPTH_WRITEMASK", e[e.DEPTH_CLEAR_VALUE = 2931] = "DEPTH_CLEAR_VALUE", e[e.DEPTH_FUNC = 2932] = "DEPTH_FUNC", e[e.STENCIL_CLEAR_VALUE = 2961] = "STENCIL_CLEAR_VALUE", e[e.STENCIL_FUNC = 2962] = "STENCIL_FUNC", e[e.STENCIL_FAIL = 2964] = "STENCIL_FAIL", e[e.STENCIL_PASS_DEPTH_FAIL = 2965] = "STENCIL_PASS_DEPTH_FAIL", e[e.STENCIL_PASS_DEPTH_PASS = 2966] = "STENCIL_PASS_DEPTH_PASS", e[e.STENCIL_REF = 2967] = "STENCIL_REF", e[e.STENCIL_VALUE_MASK = 2963] = "STENCIL_VALUE_MASK", e[e.STENCIL_WRITEMASK = 2968] = "STENCIL_WRITEMASK", e[e.STENCIL_BACK_FUNC = 34816] = "STENCIL_BACK_FUNC", e[e.STENCIL_BACK_FAIL = 34817] = "STENCIL_BACK_FAIL", e[e.STENCIL_BACK_PASS_DEPTH_FAIL = 34818] = "STENCIL_BACK_PASS_DEPTH_FAIL", e[e.STENCIL_BACK_PASS_DEPTH_PASS = 34819] = "STENCIL_BACK_PASS_DEPTH_PASS", e[e.STENCIL_BACK_REF = 36003] = "STENCIL_BACK_REF", e[e.STENCIL_BACK_VALUE_MASK = 36004] = "STENCIL_BACK_VALUE_MASK", e[e.STENCIL_BACK_WRITEMASK = 36005] = "STENCIL_BACK_WRITEMASK", e[e.VIEWPORT = 2978] = "VIEWPORT", e[e.SCISSOR_BOX = 3088] = "SCISSOR_BOX", e[e.COLOR_CLEAR_VALUE = 3106] = "COLOR_CLEAR_VALUE", e[e.COLOR_WRITEMASK = 3107] = "COLOR_WRITEMASK", e[e.UNPACK_ALIGNMENT = 3317] = "UNPACK_ALIGNMENT", e[e.PACK_ALIGNMENT = 3333] = "PACK_ALIGNMENT", e[e.MAX_TEXTURE_SIZE = 3379] = "MAX_TEXTURE_SIZE", e[e.MAX_VIEWPORT_DIMS = 3386] = "MAX_VIEWPORT_DIMS", e[e.SUBPIXEL_BITS = 3408] = "SUBPIXEL_BITS", e[e.RED_BITS = 3410] = "RED_BITS", e[e.GREEN_BITS = 3411] = "GREEN_BITS", e[e.BLUE_BITS = 3412] = "BLUE_BITS", e[e.ALPHA_BITS = 3413] = "ALPHA_BITS", e[e.DEPTH_BITS = 3414] = "DEPTH_BITS", e[e.STENCIL_BITS = 3415] = "STENCIL_BITS", e[e.POLYGON_OFFSET_UNITS = 10752] = "POLYGON_OFFSET_UNITS", e[e.POLYGON_OFFSET_FACTOR = 32824] = "POLYGON_OFFSET_FACTOR", e[e.TEXTURE_BINDING_2D = 32873] = "TEXTURE_BINDING_2D", e[e.SAMPLE_BUFFERS = 32936] = "SAMPLE_BUFFERS", e[e.SAMPLES = 32937] = "SAMPLES", e[e.SAMPLE_COVERAGE_VALUE = 32938] = "SAMPLE_COVERAGE_VALUE", e[e.SAMPLE_COVERAGE_INVERT = 32939] = "SAMPLE_COVERAGE_INVERT", e[e.COMPRESSED_TEXTURE_FORMATS = 34467] = "COMPRESSED_TEXTURE_FORMATS", e[e.VENDOR = 7936] = "VENDOR", e[e.RENDERER = 7937] = "RENDERER", e[e.VERSION = 7938] = "VERSION", e[e.IMPLEMENTATION_COLOR_READ_TYPE = 35738] = "IMPLEMENTATION_COLOR_READ_TYPE", e[e.IMPLEMENTATION_COLOR_READ_FORMAT = 35739] = "IMPLEMENTATION_COLOR_READ_FORMAT", e[e.BROWSER_DEFAULT_WEBGL = 37444] = "BROWSER_DEFAULT_WEBGL", e[e.STATIC_DRAW = 35044] = "STATIC_DRAW", e[e.STREAM_DRAW = 35040] = "STREAM_DRAW", e[e.DYNAMIC_DRAW = 35048] = "DYNAMIC_DRAW", e[e.ARRAY_BUFFER = 34962] = "ARRAY_BUFFER", e[e.ELEMENT_ARRAY_BUFFER = 34963] = "ELEMENT_ARRAY_BUFFER", e[e.BUFFER_SIZE = 34660] = "BUFFER_SIZE", e[e.BUFFER_USAGE = 34661] = "BUFFER_USAGE", e[e.CURRENT_VERTEX_ATTRIB = 34342] = "CURRENT_VERTEX_ATTRIB", e[e.VERTEX_ATTRIB_ARRAY_ENABLED = 34338] = "VERTEX_ATTRIB_ARRAY_ENABLED", e[e.VERTEX_ATTRIB_ARRAY_SIZE = 34339] = "VERTEX_ATTRIB_ARRAY_SIZE", e[e.VERTEX_ATTRIB_ARRAY_STRIDE = 34340] = "VERTEX_ATTRIB_ARRAY_STRIDE", e[e.VERTEX_ATTRIB_ARRAY_TYPE = 34341] = "VERTEX_ATTRIB_ARRAY_TYPE", e[e.VERTEX_ATTRIB_ARRAY_NORMALIZED = 34922] = "VERTEX_ATTRIB_ARRAY_NORMALIZED", e[e.VERTEX_ATTRIB_ARRAY_POINTER = 34373] = "VERTEX_ATTRIB_ARRAY_POINTER", e[e.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING = 34975] = "VERTEX_ATTRIB_ARRAY_BUFFER_BINDING", e[e.CULL_FACE = 2884] = "CULL_FACE", e[e.FRONT = 1028] = "FRONT", e[e.BACK = 1029] = "BACK", e[e.FRONT_AND_BACK = 1032] = "FRONT_AND_BACK", e[e.BLEND = 3042] = "BLEND", e[e.DEPTH_TEST = 2929] = "DEPTH_TEST", e[e.DITHER = 3024] = "DITHER", e[e.POLYGON_OFFSET_FILL = 32823] = "POLYGON_OFFSET_FILL", e[e.SAMPLE_ALPHA_TO_COVERAGE = 32926] = "SAMPLE_ALPHA_TO_COVERAGE", e[e.SAMPLE_COVERAGE = 32928] = "SAMPLE_COVERAGE", e[e.SCISSOR_TEST = 3089] = "SCISSOR_TEST", e[e.STENCIL_TEST = 2960] = "STENCIL_TEST", e[e.NO_ERROR = 0] = "NO_ERROR", e[e.INVALID_ENUM = 1280] = "INVALID_ENUM", e[e.INVALID_VALUE = 1281] = "INVALID_VALUE", e[e.INVALID_OPERATION = 1282] = "INVALID_OPERATION", e[e.OUT_OF_MEMORY = 1285] = "OUT_OF_MEMORY", e[e.CONTEXT_LOST_WEBGL = 37442] = "CONTEXT_LOST_WEBGL", e[e.CW = 2304] = "CW", e[e.CCW = 2305] = "CCW", e[e.DONT_CARE = 4352] = "DONT_CARE", e[e.FASTEST = 4353] = "FASTEST", e[e.NICEST = 4354] = "NICEST", e[e.GENERATE_MIPMAP_HINT = 33170] = "GENERATE_MIPMAP_HINT", e[e.BYTE = 5120] = "BYTE", e[e.UNSIGNED_BYTE = 5121] = "UNSIGNED_BYTE", e[e.SHORT = 5122] = "SHORT", e[e.UNSIGNED_SHORT = 5123] = "UNSIGNED_SHORT", e[e.INT = 5124] = "INT", e[e.UNSIGNED_INT = 5125] = "UNSIGNED_INT", e[e.FLOAT = 5126] = "FLOAT", e[e.DOUBLE = 5130] = "DOUBLE", e[e.DEPTH_COMPONENT = 6402] = "DEPTH_COMPONENT", e[e.ALPHA = 6406] = "ALPHA", e[e.RGB = 6407] = "RGB", e[e.RGBA = 6408] = "RGBA", e[e.LUMINANCE = 6409] = "LUMINANCE", e[e.LUMINANCE_ALPHA = 6410] = "LUMINANCE_ALPHA", e[e.UNSIGNED_SHORT_4_4_4_4 = 32819] = "UNSIGNED_SHORT_4_4_4_4", e[e.UNSIGNED_SHORT_5_5_5_1 = 32820] = "UNSIGNED_SHORT_5_5_5_1", e[e.UNSIGNED_SHORT_5_6_5 = 33635] = "UNSIGNED_SHORT_5_6_5", e[e.FRAGMENT_SHADER = 35632] = "FRAGMENT_SHADER", e[e.VERTEX_SHADER = 35633] = "VERTEX_SHADER", e[e.COMPILE_STATUS = 35713] = "COMPILE_STATUS", e[e.DELETE_STATUS = 35712] = "DELETE_STATUS", e[e.LINK_STATUS = 35714] = "LINK_STATUS", e[e.VALIDATE_STATUS = 35715] = "VALIDATE_STATUS", e[e.ATTACHED_SHADERS = 35717] = "ATTACHED_SHADERS", e[e.ACTIVE_ATTRIBUTES = 35721] = "ACTIVE_ATTRIBUTES", e[e.ACTIVE_UNIFORMS = 35718] = "ACTIVE_UNIFORMS", e[e.MAX_VERTEX_ATTRIBS = 34921] = "MAX_VERTEX_ATTRIBS", e[e.MAX_VERTEX_UNIFORM_VECTORS = 36347] = "MAX_VERTEX_UNIFORM_VECTORS", e[e.MAX_VARYING_VECTORS = 36348] = "MAX_VARYING_VECTORS", e[e.MAX_COMBINED_TEXTURE_IMAGE_UNITS = 35661] = "MAX_COMBINED_TEXTURE_IMAGE_UNITS", e[e.MAX_VERTEX_TEXTURE_IMAGE_UNITS = 35660] = "MAX_VERTEX_TEXTURE_IMAGE_UNITS", e[e.MAX_TEXTURE_IMAGE_UNITS = 34930] = "MAX_TEXTURE_IMAGE_UNITS", e[e.MAX_FRAGMENT_UNIFORM_VECTORS = 36349] = "MAX_FRAGMENT_UNIFORM_VECTORS", e[e.SHADER_TYPE = 35663] = "SHADER_TYPE", e[e.SHADING_LANGUAGE_VERSION = 35724] = "SHADING_LANGUAGE_VERSION", e[e.CURRENT_PROGRAM = 35725] = "CURRENT_PROGRAM", e[e.NEVER = 512] = "NEVER", e[e.LESS = 513] = "LESS", e[e.EQUAL = 514] = "EQUAL", e[e.LEQUAL = 515] = "LEQUAL", e[e.GREATER = 516] = "GREATER", e[e.NOTEQUAL = 517] = "NOTEQUAL", e[e.GEQUAL = 518] = "GEQUAL", e[e.ALWAYS = 519] = "ALWAYS", e[e.KEEP = 7680] = "KEEP", e[e.REPLACE = 7681] = "REPLACE", e[e.INCR = 7682] = "INCR", e[e.DECR = 7683] = "DECR", e[e.INVERT = 5386] = "INVERT", e[e.INCR_WRAP = 34055] = "INCR_WRAP", e[e.DECR_WRAP = 34056] = "DECR_WRAP", e[e.NEAREST = 9728] = "NEAREST", e[e.LINEAR = 9729] = "LINEAR", e[e.NEAREST_MIPMAP_NEAREST = 9984] = "NEAREST_MIPMAP_NEAREST", e[e.LINEAR_MIPMAP_NEAREST = 9985] = "LINEAR_MIPMAP_NEAREST", e[e.NEAREST_MIPMAP_LINEAR = 9986] = "NEAREST_MIPMAP_LINEAR", e[e.LINEAR_MIPMAP_LINEAR = 9987] = "LINEAR_MIPMAP_LINEAR", e[e.TEXTURE_MAG_FILTER = 10240] = "TEXTURE_MAG_FILTER", e[e.TEXTURE_MIN_FILTER = 10241] = "TEXTURE_MIN_FILTER", e[e.TEXTURE_WRAP_S = 10242] = "TEXTURE_WRAP_S", e[e.TEXTURE_WRAP_T = 10243] = "TEXTURE_WRAP_T", e[e.TEXTURE_2D = 3553] = "TEXTURE_2D", e[e.TEXTURE = 5890] = "TEXTURE", e[e.TEXTURE_CUBE_MAP = 34067] = "TEXTURE_CUBE_MAP", e[e.TEXTURE_BINDING_CUBE_MAP = 34068] = "TEXTURE_BINDING_CUBE_MAP", e[e.TEXTURE_CUBE_MAP_POSITIVE_X = 34069] = "TEXTURE_CUBE_MAP_POSITIVE_X", e[e.TEXTURE_CUBE_MAP_NEGATIVE_X = 34070] = "TEXTURE_CUBE_MAP_NEGATIVE_X", e[e.TEXTURE_CUBE_MAP_POSITIVE_Y = 34071] = "TEXTURE_CUBE_MAP_POSITIVE_Y", e[e.TEXTURE_CUBE_MAP_NEGATIVE_Y = 34072] = "TEXTURE_CUBE_MAP_NEGATIVE_Y", e[e.TEXTURE_CUBE_MAP_POSITIVE_Z = 34073] = "TEXTURE_CUBE_MAP_POSITIVE_Z", e[e.TEXTURE_CUBE_MAP_NEGATIVE_Z = 34074] = "TEXTURE_CUBE_MAP_NEGATIVE_Z", e[e.MAX_CUBE_MAP_TEXTURE_SIZE = 34076] = "MAX_CUBE_MAP_TEXTURE_SIZE", e[e.TEXTURE0 = 33984] = "TEXTURE0", e[e.ACTIVE_TEXTURE = 34016] = "ACTIVE_TEXTURE", e[e.REPEAT = 10497] = "REPEAT", e[e.CLAMP_TO_EDGE = 33071] = "CLAMP_TO_EDGE", e[e.MIRRORED_REPEAT = 33648] = "MIRRORED_REPEAT", e[e.TEXTURE_WIDTH = 4096] = "TEXTURE_WIDTH", e[e.TEXTURE_HEIGHT = 4097] = "TEXTURE_HEIGHT", e[e.FLOAT_VEC2 = 35664] = "FLOAT_VEC2", e[e.FLOAT_VEC3 = 35665] = "FLOAT_VEC3", e[e.FLOAT_VEC4 = 35666] = "FLOAT_VEC4", e[e.INT_VEC2 = 35667] = "INT_VEC2", e[e.INT_VEC3 = 35668] = "INT_VEC3", e[e.INT_VEC4 = 35669] = "INT_VEC4", e[e.BOOL = 35670] = "BOOL", e[e.BOOL_VEC2 = 35671] = "BOOL_VEC2", e[e.BOOL_VEC3 = 35672] = "BOOL_VEC3", e[e.BOOL_VEC4 = 35673] = "BOOL_VEC4", e[e.FLOAT_MAT2 = 35674] = "FLOAT_MAT2", e[e.FLOAT_MAT3 = 35675] = "FLOAT_MAT3", e[e.FLOAT_MAT4 = 35676] = "FLOAT_MAT4", e[e.SAMPLER_2D = 35678] = "SAMPLER_2D", e[e.SAMPLER_CUBE = 35680] = "SAMPLER_CUBE", e[e.LOW_FLOAT = 36336] = "LOW_FLOAT", e[e.MEDIUM_FLOAT = 36337] = "MEDIUM_FLOAT", e[e.HIGH_FLOAT = 36338] = "HIGH_FLOAT", e[e.LOW_INT = 36339] = "LOW_INT", e[e.MEDIUM_INT = 36340] = "MEDIUM_INT", e[e.HIGH_INT = 36341] = "HIGH_INT", e[e.FRAMEBUFFER = 36160] = "FRAMEBUFFER", e[e.RENDERBUFFER = 36161] = "RENDERBUFFER", e[e.RGBA4 = 32854] = "RGBA4", e[e.RGB5_A1 = 32855] = "RGB5_A1", e[e.RGB565 = 36194] = "RGB565", e[e.DEPTH_COMPONENT16 = 33189] = "DEPTH_COMPONENT16", e[e.STENCIL_INDEX = 6401] = "STENCIL_INDEX", e[e.STENCIL_INDEX8 = 36168] = "STENCIL_INDEX8", e[e.DEPTH_STENCIL = 34041] = "DEPTH_STENCIL", e[e.RENDERBUFFER_WIDTH = 36162] = "RENDERBUFFER_WIDTH", e[e.RENDERBUFFER_HEIGHT = 36163] = "RENDERBUFFER_HEIGHT", e[e.RENDERBUFFER_INTERNAL_FORMAT = 36164] = "RENDERBUFFER_INTERNAL_FORMAT", e[e.RENDERBUFFER_RED_SIZE = 36176] = "RENDERBUFFER_RED_SIZE", e[e.RENDERBUFFER_GREEN_SIZE = 36177] = "RENDERBUFFER_GREEN_SIZE", e[e.RENDERBUFFER_BLUE_SIZE = 36178] = "RENDERBUFFER_BLUE_SIZE", e[e.RENDERBUFFER_ALPHA_SIZE = 36179] = "RENDERBUFFER_ALPHA_SIZE", e[e.RENDERBUFFER_DEPTH_SIZE = 36180] = "RENDERBUFFER_DEPTH_SIZE", e[e.RENDERBUFFER_STENCIL_SIZE = 36181] = "RENDERBUFFER_STENCIL_SIZE", e[e.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE = 36048] = "FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE", e[e.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME = 36049] = "FRAMEBUFFER_ATTACHMENT_OBJECT_NAME", e[e.FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL = 36050] = "FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL", e[e.FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE = 36051] = "FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE", e[e.COLOR_ATTACHMENT0 = 36064] = "COLOR_ATTACHMENT0", e[e.DEPTH_ATTACHMENT = 36096] = "DEPTH_ATTACHMENT", e[e.STENCIL_ATTACHMENT = 36128] = "STENCIL_ATTACHMENT", e[e.DEPTH_STENCIL_ATTACHMENT = 33306] = "DEPTH_STENCIL_ATTACHMENT", e[e.NONE = 0] = "NONE", e[e.FRAMEBUFFER_COMPLETE = 36053] = "FRAMEBUFFER_COMPLETE", e[e.FRAMEBUFFER_INCOMPLETE_ATTACHMENT = 36054] = "FRAMEBUFFER_INCOMPLETE_ATTACHMENT", e[e.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = 36055] = "FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT", e[e.FRAMEBUFFER_INCOMPLETE_DIMENSIONS = 36057] = "FRAMEBUFFER_INCOMPLETE_DIMENSIONS", e[e.FRAMEBUFFER_UNSUPPORTED = 36061] = "FRAMEBUFFER_UNSUPPORTED", e[e.FRAMEBUFFER_BINDING = 36006] = "FRAMEBUFFER_BINDING", e[e.RENDERBUFFER_BINDING = 36007] = "RENDERBUFFER_BINDING", e[e.READ_FRAMEBUFFER = 36008] = "READ_FRAMEBUFFER", e[e.DRAW_FRAMEBUFFER = 36009] = "DRAW_FRAMEBUFFER", e[e.MAX_RENDERBUFFER_SIZE = 34024] = "MAX_RENDERBUFFER_SIZE", e[e.INVALID_FRAMEBUFFER_OPERATION = 1286] = "INVALID_FRAMEBUFFER_OPERATION", e[e.UNPACK_FLIP_Y_WEBGL = 37440] = "UNPACK_FLIP_Y_WEBGL", e[e.UNPACK_PREMULTIPLY_ALPHA_WEBGL = 37441] = "UNPACK_PREMULTIPLY_ALPHA_WEBGL", e[e.UNPACK_COLORSPACE_CONVERSION_WEBGL = 37443] = "UNPACK_COLORSPACE_CONVERSION_WEBGL", e[e.READ_BUFFER = 3074] = "READ_BUFFER", e[e.UNPACK_ROW_LENGTH = 3314] = "UNPACK_ROW_LENGTH", e[e.UNPACK_SKIP_ROWS = 3315] = "UNPACK_SKIP_ROWS", e[e.UNPACK_SKIP_PIXELS = 3316] = "UNPACK_SKIP_PIXELS", e[e.PACK_ROW_LENGTH = 3330] = "PACK_ROW_LENGTH", e[e.PACK_SKIP_ROWS = 3331] = "PACK_SKIP_ROWS", e[e.PACK_SKIP_PIXELS = 3332] = "PACK_SKIP_PIXELS", e[e.TEXTURE_BINDING_3D = 32874] = "TEXTURE_BINDING_3D", e[e.UNPACK_SKIP_IMAGES = 32877] = "UNPACK_SKIP_IMAGES", e[e.UNPACK_IMAGE_HEIGHT = 32878] = "UNPACK_IMAGE_HEIGHT", e[e.MAX_3D_TEXTURE_SIZE = 32883] = "MAX_3D_TEXTURE_SIZE", e[e.MAX_ELEMENTS_VERTICES = 33e3] = "MAX_ELEMENTS_VERTICES", e[e.MAX_ELEMENTS_INDICES = 33001] = "MAX_ELEMENTS_INDICES", e[e.MAX_TEXTURE_LOD_BIAS = 34045] = "MAX_TEXTURE_LOD_BIAS", e[e.MAX_FRAGMENT_UNIFORM_COMPONENTS = 35657] = "MAX_FRAGMENT_UNIFORM_COMPONENTS", e[e.MAX_VERTEX_UNIFORM_COMPONENTS = 35658] = "MAX_VERTEX_UNIFORM_COMPONENTS", e[e.MAX_ARRAY_TEXTURE_LAYERS = 35071] = "MAX_ARRAY_TEXTURE_LAYERS", e[e.MIN_PROGRAM_TEXEL_OFFSET = 35076] = "MIN_PROGRAM_TEXEL_OFFSET", e[e.MAX_PROGRAM_TEXEL_OFFSET = 35077] = "MAX_PROGRAM_TEXEL_OFFSET", e[e.MAX_VARYING_COMPONENTS = 35659] = "MAX_VARYING_COMPONENTS", e[e.FRAGMENT_SHADER_DERIVATIVE_HINT = 35723] = "FRAGMENT_SHADER_DERIVATIVE_HINT", e[e.RASTERIZER_DISCARD = 35977] = "RASTERIZER_DISCARD", e[e.VERTEX_ARRAY_BINDING = 34229] = "VERTEX_ARRAY_BINDING", e[e.MAX_VERTEX_OUTPUT_COMPONENTS = 37154] = "MAX_VERTEX_OUTPUT_COMPONENTS", e[e.MAX_FRAGMENT_INPUT_COMPONENTS = 37157] = "MAX_FRAGMENT_INPUT_COMPONENTS", e[e.MAX_SERVER_WAIT_TIMEOUT = 37137] = "MAX_SERVER_WAIT_TIMEOUT", e[e.MAX_ELEMENT_INDEX = 36203] = "MAX_ELEMENT_INDEX", e[e.RED = 6403] = "RED", e[e.RGB8 = 32849] = "RGB8", e[e.RGBA8 = 32856] = "RGBA8", e[e.RGB10_A2 = 32857] = "RGB10_A2", e[e.TEXTURE_3D = 32879] = "TEXTURE_3D", e[e.TEXTURE_WRAP_R = 32882] = "TEXTURE_WRAP_R", e[e.TEXTURE_MIN_LOD = 33082] = "TEXTURE_MIN_LOD", e[e.TEXTURE_MAX_LOD = 33083] = "TEXTURE_MAX_LOD", e[e.TEXTURE_BASE_LEVEL = 33084] = "TEXTURE_BASE_LEVEL", e[e.TEXTURE_MAX_LEVEL = 33085] = "TEXTURE_MAX_LEVEL", e[e.TEXTURE_COMPARE_MODE = 34892] = "TEXTURE_COMPARE_MODE", e[e.TEXTURE_COMPARE_FUNC = 34893] = "TEXTURE_COMPARE_FUNC", e[e.SRGB = 35904] = "SRGB", e[e.SRGB8 = 35905] = "SRGB8", e[e.SRGB8_ALPHA8 = 35907] = "SRGB8_ALPHA8", e[e.COMPARE_REF_TO_TEXTURE = 34894] = "COMPARE_REF_TO_TEXTURE", e[e.RGBA32F = 34836] = "RGBA32F", e[e.RGB32F = 34837] = "RGB32F", e[e.RGBA16F = 34842] = "RGBA16F", e[e.RGB16F = 34843] = "RGB16F", e[e.TEXTURE_2D_ARRAY = 35866] = "TEXTURE_2D_ARRAY", e[e.TEXTURE_BINDING_2D_ARRAY = 35869] = "TEXTURE_BINDING_2D_ARRAY", e[e.R11F_G11F_B10F = 35898] = "R11F_G11F_B10F", e[e.RGB9_E5 = 35901] = "RGB9_E5", e[e.RGBA32UI = 36208] = "RGBA32UI", e[e.RGB32UI = 36209] = "RGB32UI", e[e.RGBA16UI = 36214] = "RGBA16UI", e[e.RGB16UI = 36215] = "RGB16UI", e[e.RGBA8UI = 36220] = "RGBA8UI", e[e.RGB8UI = 36221] = "RGB8UI", e[e.RGBA32I = 36226] = "RGBA32I", e[e.RGB32I = 36227] = "RGB32I", e[e.RGBA16I = 36232] = "RGBA16I", e[e.RGB16I = 36233] = "RGB16I", e[e.RGBA8I = 36238] = "RGBA8I", e[e.RGB8I = 36239] = "RGB8I", e[e.RED_INTEGER = 36244] = "RED_INTEGER", e[e.RGB_INTEGER = 36248] = "RGB_INTEGER", e[e.RGBA_INTEGER = 36249] = "RGBA_INTEGER", e[e.R8 = 33321] = "R8", e[e.RG8 = 33323] = "RG8", e[e.R16F = 33325] = "R16F", e[e.R32F = 33326] = "R32F", e[e.RG16F = 33327] = "RG16F", e[e.RG32F = 33328] = "RG32F", e[e.R8I = 33329] = "R8I", e[e.R8UI = 33330] = "R8UI", e[e.R16I = 33331] = "R16I", e[e.R16UI = 33332] = "R16UI", e[e.R32I = 33333] = "R32I", e[e.R32UI = 33334] = "R32UI", e[e.RG8I = 33335] = "RG8I", e[e.RG8UI = 33336] = "RG8UI", e[e.RG16I = 33337] = "RG16I", e[e.RG16UI = 33338] = "RG16UI", e[e.RG32I = 33339] = "RG32I", e[e.RG32UI = 33340] = "RG32UI", e[e.R8_SNORM = 36756] = "R8_SNORM", e[e.RG8_SNORM = 36757] = "RG8_SNORM", e[e.RGB8_SNORM = 36758] = "RGB8_SNORM", e[e.RGBA8_SNORM = 36759] = "RGBA8_SNORM", e[e.RGB10_A2UI = 36975] = "RGB10_A2UI", e[e.TEXTURE_IMMUTABLE_FORMAT = 37167] = "TEXTURE_IMMUTABLE_FORMAT", e[e.TEXTURE_IMMUTABLE_LEVELS = 33503] = "TEXTURE_IMMUTABLE_LEVELS", e[e.UNSIGNED_INT_2_10_10_10_REV = 33640] = "UNSIGNED_INT_2_10_10_10_REV", e[e.UNSIGNED_INT_10F_11F_11F_REV = 35899] = "UNSIGNED_INT_10F_11F_11F_REV", e[e.UNSIGNED_INT_5_9_9_9_REV = 35902] = "UNSIGNED_INT_5_9_9_9_REV", e[e.FLOAT_32_UNSIGNED_INT_24_8_REV = 36269] = "FLOAT_32_UNSIGNED_INT_24_8_REV", e[e.UNSIGNED_INT_24_8 = 34042] = "UNSIGNED_INT_24_8", e[e.HALF_FLOAT = 5131] = "HALF_FLOAT", e[e.RG = 33319] = "RG", e[e.RG_INTEGER = 33320] = "RG_INTEGER", e[e.INT_2_10_10_10_REV = 36255] = "INT_2_10_10_10_REV", e[e.CURRENT_QUERY = 34917] = "CURRENT_QUERY", e[e.QUERY_RESULT = 34918] = "QUERY_RESULT", e[e.QUERY_RESULT_AVAILABLE = 34919] = "QUERY_RESULT_AVAILABLE", e[e.ANY_SAMPLES_PASSED = 35887] = "ANY_SAMPLES_PASSED", e[e.ANY_SAMPLES_PASSED_CONSERVATIVE = 36202] = "ANY_SAMPLES_PASSED_CONSERVATIVE", e[e.MAX_DRAW_BUFFERS = 34852] = "MAX_DRAW_BUFFERS", e[e.DRAW_BUFFER0 = 34853] = "DRAW_BUFFER0", e[e.DRAW_BUFFER1 = 34854] = "DRAW_BUFFER1", e[e.DRAW_BUFFER2 = 34855] = "DRAW_BUFFER2", e[e.DRAW_BUFFER3 = 34856] = "DRAW_BUFFER3", e[e.DRAW_BUFFER4 = 34857] = "DRAW_BUFFER4", e[e.DRAW_BUFFER5 = 34858] = "DRAW_BUFFER5", e[e.DRAW_BUFFER6 = 34859] = "DRAW_BUFFER6", e[e.DRAW_BUFFER7 = 34860] = "DRAW_BUFFER7", e[e.DRAW_BUFFER8 = 34861] = "DRAW_BUFFER8", e[e.DRAW_BUFFER9 = 34862] = "DRAW_BUFFER9", e[e.DRAW_BUFFER10 = 34863] = "DRAW_BUFFER10", e[e.DRAW_BUFFER11 = 34864] = "DRAW_BUFFER11", e[e.DRAW_BUFFER12 = 34865] = "DRAW_BUFFER12", e[e.DRAW_BUFFER13 = 34866] = "DRAW_BUFFER13", e[e.DRAW_BUFFER14 = 34867] = "DRAW_BUFFER14", e[e.DRAW_BUFFER15 = 34868] = "DRAW_BUFFER15", e[e.MAX_COLOR_ATTACHMENTS = 36063] = "MAX_COLOR_ATTACHMENTS", e[e.COLOR_ATTACHMENT1 = 36065] = "COLOR_ATTACHMENT1", e[e.COLOR_ATTACHMENT2 = 36066] = "COLOR_ATTACHMENT2", e[e.COLOR_ATTACHMENT3 = 36067] = "COLOR_ATTACHMENT3", e[e.COLOR_ATTACHMENT4 = 36068] = "COLOR_ATTACHMENT4", e[e.COLOR_ATTACHMENT5 = 36069] = "COLOR_ATTACHMENT5", e[e.COLOR_ATTACHMENT6 = 36070] = "COLOR_ATTACHMENT6", e[e.COLOR_ATTACHMENT7 = 36071] = "COLOR_ATTACHMENT7", e[e.COLOR_ATTACHMENT8 = 36072] = "COLOR_ATTACHMENT8", e[e.COLOR_ATTACHMENT9 = 36073] = "COLOR_ATTACHMENT9", e[e.COLOR_ATTACHMENT10 = 36074] = "COLOR_ATTACHMENT10", e[e.COLOR_ATTACHMENT11 = 36075] = "COLOR_ATTACHMENT11", e[e.COLOR_ATTACHMENT12 = 36076] = "COLOR_ATTACHMENT12", e[e.COLOR_ATTACHMENT13 = 36077] = "COLOR_ATTACHMENT13", e[e.COLOR_ATTACHMENT14 = 36078] = "COLOR_ATTACHMENT14", e[e.COLOR_ATTACHMENT15 = 36079] = "COLOR_ATTACHMENT15", e[e.SAMPLER_3D = 35679] = "SAMPLER_3D", e[e.SAMPLER_2D_SHADOW = 35682] = "SAMPLER_2D_SHADOW", e[e.SAMPLER_2D_ARRAY = 36289] = "SAMPLER_2D_ARRAY", e[e.SAMPLER_2D_ARRAY_SHADOW = 36292] = "SAMPLER_2D_ARRAY_SHADOW", e[e.SAMPLER_CUBE_SHADOW = 36293] = "SAMPLER_CUBE_SHADOW", e[e.INT_SAMPLER_2D = 36298] = "INT_SAMPLER_2D", e[e.INT_SAMPLER_3D = 36299] = "INT_SAMPLER_3D", e[e.INT_SAMPLER_CUBE = 36300] = "INT_SAMPLER_CUBE", e[e.INT_SAMPLER_2D_ARRAY = 36303] = "INT_SAMPLER_2D_ARRAY", e[e.UNSIGNED_INT_SAMPLER_2D = 36306] = "UNSIGNED_INT_SAMPLER_2D", e[e.UNSIGNED_INT_SAMPLER_3D = 36307] = "UNSIGNED_INT_SAMPLER_3D", e[e.UNSIGNED_INT_SAMPLER_CUBE = 36308] = "UNSIGNED_INT_SAMPLER_CUBE", e[e.UNSIGNED_INT_SAMPLER_2D_ARRAY = 36311] = "UNSIGNED_INT_SAMPLER_2D_ARRAY", e[e.MAX_SAMPLES = 36183] = "MAX_SAMPLES", e[e.SAMPLER_BINDING = 35097] = "SAMPLER_BINDING", e[e.PIXEL_PACK_BUFFER = 35051] = "PIXEL_PACK_BUFFER", e[e.PIXEL_UNPACK_BUFFER = 35052] = "PIXEL_UNPACK_BUFFER", e[e.PIXEL_PACK_BUFFER_BINDING = 35053] = "PIXEL_PACK_BUFFER_BINDING", e[e.PIXEL_UNPACK_BUFFER_BINDING = 35055] = "PIXEL_UNPACK_BUFFER_BINDING", e[e.COPY_READ_BUFFER = 36662] = "COPY_READ_BUFFER", e[e.COPY_WRITE_BUFFER = 36663] = "COPY_WRITE_BUFFER", e[e.COPY_READ_BUFFER_BINDING = 36662] = "COPY_READ_BUFFER_BINDING", e[e.COPY_WRITE_BUFFER_BINDING = 36663] = "COPY_WRITE_BUFFER_BINDING", e[e.FLOAT_MAT2x3 = 35685] = "FLOAT_MAT2x3", e[e.FLOAT_MAT2x4 = 35686] = "FLOAT_MAT2x4", e[e.FLOAT_MAT3x2 = 35687] = "FLOAT_MAT3x2", e[e.FLOAT_MAT3x4 = 35688] = "FLOAT_MAT3x4", e[e.FLOAT_MAT4x2 = 35689] = "FLOAT_MAT4x2", e[e.FLOAT_MAT4x3 = 35690] = "FLOAT_MAT4x3", e[e.UNSIGNED_INT_VEC2 = 36294] = "UNSIGNED_INT_VEC2", e[e.UNSIGNED_INT_VEC3 = 36295] = "UNSIGNED_INT_VEC3", e[e.UNSIGNED_INT_VEC4 = 36296] = "UNSIGNED_INT_VEC4", e[e.UNSIGNED_NORMALIZED = 35863] = "UNSIGNED_NORMALIZED", e[e.SIGNED_NORMALIZED = 36764] = "SIGNED_NORMALIZED", e[e.VERTEX_ATTRIB_ARRAY_INTEGER = 35069] = "VERTEX_ATTRIB_ARRAY_INTEGER", e[e.VERTEX_ATTRIB_ARRAY_DIVISOR = 35070] = "VERTEX_ATTRIB_ARRAY_DIVISOR", e[e.TRANSFORM_FEEDBACK_BUFFER_MODE = 35967] = "TRANSFORM_FEEDBACK_BUFFER_MODE", e[e.MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS = 35968] = "MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS", e[e.TRANSFORM_FEEDBACK_VARYINGS = 35971] = "TRANSFORM_FEEDBACK_VARYINGS", e[e.TRANSFORM_FEEDBACK_BUFFER_START = 35972] = "TRANSFORM_FEEDBACK_BUFFER_START", e[e.TRANSFORM_FEEDBACK_BUFFER_SIZE = 35973] = "TRANSFORM_FEEDBACK_BUFFER_SIZE", e[e.TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN = 35976] = "TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN", e[e.MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS = 35978] = "MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS", e[e.MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS = 35979] = "MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS", e[e.INTERLEAVED_ATTRIBS = 35980] = "INTERLEAVED_ATTRIBS", e[e.SEPARATE_ATTRIBS = 35981] = "SEPARATE_ATTRIBS", e[e.TRANSFORM_FEEDBACK_BUFFER = 35982] = "TRANSFORM_FEEDBACK_BUFFER", e[e.TRANSFORM_FEEDBACK_BUFFER_BINDING = 35983] = "TRANSFORM_FEEDBACK_BUFFER_BINDING", e[e.TRANSFORM_FEEDBACK = 36386] = "TRANSFORM_FEEDBACK", e[e.TRANSFORM_FEEDBACK_PAUSED = 36387] = "TRANSFORM_FEEDBACK_PAUSED", e[e.TRANSFORM_FEEDBACK_ACTIVE = 36388] = "TRANSFORM_FEEDBACK_ACTIVE", e[e.TRANSFORM_FEEDBACK_BINDING = 36389] = "TRANSFORM_FEEDBACK_BINDING", e[e.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING = 33296] = "FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING", e[e.FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE = 33297] = "FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE", e[e.FRAMEBUFFER_ATTACHMENT_RED_SIZE = 33298] = "FRAMEBUFFER_ATTACHMENT_RED_SIZE", e[e.FRAMEBUFFER_ATTACHMENT_GREEN_SIZE = 33299] = "FRAMEBUFFER_ATTACHMENT_GREEN_SIZE", e[e.FRAMEBUFFER_ATTACHMENT_BLUE_SIZE = 33300] = "FRAMEBUFFER_ATTACHMENT_BLUE_SIZE", e[e.FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE = 33301] = "FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE", e[e.FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE = 33302] = "FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE", e[e.FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE = 33303] = "FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE", e[e.FRAMEBUFFER_DEFAULT = 33304] = "FRAMEBUFFER_DEFAULT", e[e.DEPTH24_STENCIL8 = 35056] = "DEPTH24_STENCIL8", e[e.DRAW_FRAMEBUFFER_BINDING = 36006] = "DRAW_FRAMEBUFFER_BINDING", e[e.READ_FRAMEBUFFER_BINDING = 36010] = "READ_FRAMEBUFFER_BINDING", e[e.RENDERBUFFER_SAMPLES = 36011] = "RENDERBUFFER_SAMPLES", e[e.FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER = 36052] = "FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER", e[e.FRAMEBUFFER_INCOMPLETE_MULTISAMPLE = 36182] = "FRAMEBUFFER_INCOMPLETE_MULTISAMPLE", e[e.UNIFORM_BUFFER = 35345] = "UNIFORM_BUFFER", e[e.UNIFORM_BUFFER_BINDING = 35368] = "UNIFORM_BUFFER_BINDING", e[e.UNIFORM_BUFFER_START = 35369] = "UNIFORM_BUFFER_START", e[e.UNIFORM_BUFFER_SIZE = 35370] = "UNIFORM_BUFFER_SIZE", e[e.MAX_VERTEX_UNIFORM_BLOCKS = 35371] = "MAX_VERTEX_UNIFORM_BLOCKS", e[e.MAX_FRAGMENT_UNIFORM_BLOCKS = 35373] = "MAX_FRAGMENT_UNIFORM_BLOCKS", e[e.MAX_COMBINED_UNIFORM_BLOCKS = 35374] = "MAX_COMBINED_UNIFORM_BLOCKS", e[e.MAX_UNIFORM_BUFFER_BINDINGS = 35375] = "MAX_UNIFORM_BUFFER_BINDINGS", e[e.MAX_UNIFORM_BLOCK_SIZE = 35376] = "MAX_UNIFORM_BLOCK_SIZE", e[e.MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS = 35377] = "MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS", e[e.MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS = 35379] = "MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS", e[e.UNIFORM_BUFFER_OFFSET_ALIGNMENT = 35380] = "UNIFORM_BUFFER_OFFSET_ALIGNMENT", e[e.ACTIVE_UNIFORM_BLOCKS = 35382] = "ACTIVE_UNIFORM_BLOCKS", e[e.UNIFORM_TYPE = 35383] = "UNIFORM_TYPE", e[e.UNIFORM_SIZE = 35384] = "UNIFORM_SIZE", e[e.UNIFORM_BLOCK_INDEX = 35386] = "UNIFORM_BLOCK_INDEX", e[e.UNIFORM_OFFSET = 35387] = "UNIFORM_OFFSET", e[e.UNIFORM_ARRAY_STRIDE = 35388] = "UNIFORM_ARRAY_STRIDE", e[e.UNIFORM_MATRIX_STRIDE = 35389] = "UNIFORM_MATRIX_STRIDE", e[e.UNIFORM_IS_ROW_MAJOR = 35390] = "UNIFORM_IS_ROW_MAJOR", e[e.UNIFORM_BLOCK_BINDING = 35391] = "UNIFORM_BLOCK_BINDING", e[e.UNIFORM_BLOCK_DATA_SIZE = 35392] = "UNIFORM_BLOCK_DATA_SIZE", e[e.UNIFORM_BLOCK_ACTIVE_UNIFORMS = 35394] = "UNIFORM_BLOCK_ACTIVE_UNIFORMS", e[e.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES = 35395] = "UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES", e[e.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER = 35396] = "UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER", e[e.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER = 35398] = "UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER", e[e.OBJECT_TYPE = 37138] = "OBJECT_TYPE", e[e.SYNC_CONDITION = 37139] = "SYNC_CONDITION", e[e.SYNC_STATUS = 37140] = "SYNC_STATUS", e[e.SYNC_FLAGS = 37141] = "SYNC_FLAGS", e[e.SYNC_FENCE = 37142] = "SYNC_FENCE", e[e.SYNC_GPU_COMMANDS_COMPLETE = 37143] = "SYNC_GPU_COMMANDS_COMPLETE", e[e.UNSIGNALED = 37144] = "UNSIGNALED", e[e.SIGNALED = 37145] = "SIGNALED", e[e.ALREADY_SIGNALED = 37146] = "ALREADY_SIGNALED", e[e.TIMEOUT_EXPIRED = 37147] = "TIMEOUT_EXPIRED", e[e.CONDITION_SATISFIED = 37148] = "CONDITION_SATISFIED", e[e.WAIT_FAILED = 37149] = "WAIT_FAILED", e[e.SYNC_FLUSH_COMMANDS_BIT = 1] = "SYNC_FLUSH_COMMANDS_BIT", e[e.COLOR = 6144] = "COLOR", e[e.DEPTH = 6145] = "DEPTH", e[e.STENCIL = 6146] = "STENCIL", e[e.MIN = 32775] = "MIN", e[e.MAX = 32776] = "MAX", e[e.DEPTH_COMPONENT24 = 33190] = "DEPTH_COMPONENT24", e[e.STREAM_READ = 35041] = "STREAM_READ", e[e.STREAM_COPY = 35042] = "STREAM_COPY", e[e.STATIC_READ = 35045] = "STATIC_READ", e[e.STATIC_COPY = 35046] = "STATIC_COPY", e[e.DYNAMIC_READ = 35049] = "DYNAMIC_READ", e[e.DYNAMIC_COPY = 35050] = "DYNAMIC_COPY", e[e.DEPTH_COMPONENT32F = 36012] = "DEPTH_COMPONENT32F", e[e.DEPTH32F_STENCIL8 = 36013] = "DEPTH32F_STENCIL8", e[e.INVALID_INDEX = 4294967295] = "INVALID_INDEX", e[e.TIMEOUT_IGNORED = -1] = "TIMEOUT_IGNORED", e[e.MAX_CLIENT_WAIT_TIMEOUT_WEBGL = 37447] = "MAX_CLIENT_WAIT_TIMEOUT_WEBGL", e[e.UNMASKED_VENDOR_WEBGL = 37445] = "UNMASKED_VENDOR_WEBGL", e[e.UNMASKED_RENDERER_WEBGL = 37446] = "UNMASKED_RENDERER_WEBGL", e[e.MAX_TEXTURE_MAX_ANISOTROPY_EXT = 34047] = "MAX_TEXTURE_MAX_ANISOTROPY_EXT", e[e.TEXTURE_MAX_ANISOTROPY_EXT = 34046] = "TEXTURE_MAX_ANISOTROPY_EXT", e[e.R16_EXT = 33322] = "R16_EXT", e[e.RG16_EXT = 33324] = "RG16_EXT", e[e.RGB16_EXT = 32852] = "RGB16_EXT", e[e.RGBA16_EXT = 32859] = "RGBA16_EXT", e[e.R16_SNORM_EXT = 36760] = "R16_SNORM_EXT", e[e.RG16_SNORM_EXT = 36761] = "RG16_SNORM_EXT", e[e.RGB16_SNORM_EXT = 36762] = "RGB16_SNORM_EXT", e[e.RGBA16_SNORM_EXT = 36763] = "RGBA16_SNORM_EXT", e[e.COMPRESSED_RGB_S3TC_DXT1_EXT = 33776] = "COMPRESSED_RGB_S3TC_DXT1_EXT", e[e.COMPRESSED_RGBA_S3TC_DXT1_EXT = 33777] = "COMPRESSED_RGBA_S3TC_DXT1_EXT", e[e.COMPRESSED_RGBA_S3TC_DXT3_EXT = 33778] = "COMPRESSED_RGBA_S3TC_DXT3_EXT", e[e.COMPRESSED_RGBA_S3TC_DXT5_EXT = 33779] = "COMPRESSED_RGBA_S3TC_DXT5_EXT", e[e.COMPRESSED_SRGB_S3TC_DXT1_EXT = 35916] = "COMPRESSED_SRGB_S3TC_DXT1_EXT", e[e.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT = 35917] = "COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT", e[e.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT = 35918] = "COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT", e[e.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT = 35919] = "COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT", e[e.COMPRESSED_RED_RGTC1_EXT = 36283] = "COMPRESSED_RED_RGTC1_EXT", e[e.COMPRESSED_SIGNED_RED_RGTC1_EXT = 36284] = "COMPRESSED_SIGNED_RED_RGTC1_EXT", e[e.COMPRESSED_RED_GREEN_RGTC2_EXT = 36285] = "COMPRESSED_RED_GREEN_RGTC2_EXT", e[e.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT = 36286] = "COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT", e[e.COMPRESSED_RGBA_BPTC_UNORM_EXT = 36492] = "COMPRESSED_RGBA_BPTC_UNORM_EXT", e[e.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT = 36493] = "COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT", e[e.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT = 36494] = "COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT", e[e.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT = 36495] = "COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT", e[e.COMPRESSED_R11_EAC = 37488] = "COMPRESSED_R11_EAC", e[e.COMPRESSED_SIGNED_R11_EAC = 37489] = "COMPRESSED_SIGNED_R11_EAC", e[e.COMPRESSED_RG11_EAC = 37490] = "COMPRESSED_RG11_EAC", e[e.COMPRESSED_SIGNED_RG11_EAC = 37491] = "COMPRESSED_SIGNED_RG11_EAC", e[e.COMPRESSED_RGB8_ETC2 = 37492] = "COMPRESSED_RGB8_ETC2", e[e.COMPRESSED_RGBA8_ETC2_EAC = 37493] = "COMPRESSED_RGBA8_ETC2_EAC", e[e.COMPRESSED_SRGB8_ETC2 = 37494] = "COMPRESSED_SRGB8_ETC2", e[e.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC = 37495] = "COMPRESSED_SRGB8_ALPHA8_ETC2_EAC", e[e.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 37496] = "COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2", e[e.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 37497] = "COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2", e[e.COMPRESSED_RGB_PVRTC_4BPPV1_IMG = 35840] = "COMPRESSED_RGB_PVRTC_4BPPV1_IMG", e[e.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG = 35842] = "COMPRESSED_RGBA_PVRTC_4BPPV1_IMG", e[e.COMPRESSED_RGB_PVRTC_2BPPV1_IMG = 35841] = "COMPRESSED_RGB_PVRTC_2BPPV1_IMG", e[e.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG = 35843] = "COMPRESSED_RGBA_PVRTC_2BPPV1_IMG", e[e.COMPRESSED_RGB_ETC1_WEBGL = 36196] = "COMPRESSED_RGB_ETC1_WEBGL", e[e.COMPRESSED_RGB_ATC_WEBGL = 35986] = "COMPRESSED_RGB_ATC_WEBGL", e[e.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL = 35986] = "COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL", e[e.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL = 34798] = "COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL", e[e.COMPRESSED_RGBA_ASTC_4x4_KHR = 37808] = "COMPRESSED_RGBA_ASTC_4x4_KHR", e[e.COMPRESSED_RGBA_ASTC_5x4_KHR = 37809] = "COMPRESSED_RGBA_ASTC_5x4_KHR", e[e.COMPRESSED_RGBA_ASTC_5x5_KHR = 37810] = "COMPRESSED_RGBA_ASTC_5x5_KHR", e[e.COMPRESSED_RGBA_ASTC_6x5_KHR = 37811] = "COMPRESSED_RGBA_ASTC_6x5_KHR", e[e.COMPRESSED_RGBA_ASTC_6x6_KHR = 37812] = "COMPRESSED_RGBA_ASTC_6x6_KHR", e[e.COMPRESSED_RGBA_ASTC_8x5_KHR = 37813] = "COMPRESSED_RGBA_ASTC_8x5_KHR", e[e.COMPRESSED_RGBA_ASTC_8x6_KHR = 37814] = "COMPRESSED_RGBA_ASTC_8x6_KHR", e[e.COMPRESSED_RGBA_ASTC_8x8_KHR = 37815] = "COMPRESSED_RGBA_ASTC_8x8_KHR", e[e.COMPRESSED_RGBA_ASTC_10x5_KHR = 37816] = "COMPRESSED_RGBA_ASTC_10x5_KHR", e[e.COMPRESSED_RGBA_ASTC_10x6_KHR = 37817] = "COMPRESSED_RGBA_ASTC_10x6_KHR", e[e.COMPRESSED_RGBA_ASTC_10x8_KHR = 37818] = "COMPRESSED_RGBA_ASTC_10x8_KHR", e[e.COMPRESSED_RGBA_ASTC_10x10_KHR = 37819] = "COMPRESSED_RGBA_ASTC_10x10_KHR", e[e.COMPRESSED_RGBA_ASTC_12x10_KHR = 37820] = "COMPRESSED_RGBA_ASTC_12x10_KHR", e[e.COMPRESSED_RGBA_ASTC_12x12_KHR = 37821] = "COMPRESSED_RGBA_ASTC_12x12_KHR", e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR = 37840] = "COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR", e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR = 37841] = "COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR", e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR = 37842] = "COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR", e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR = 37843] = "COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR", e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR = 37844] = "COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR", e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR = 37845] = "COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR", e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR = 37846] = "COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR", e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR = 37847] = "COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR", e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR = 37848] = "COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR", e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR = 37849] = "COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR", e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR = 37850] = "COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR", e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR = 37851] = "COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR", e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR = 37852] = "COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR", e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR = 37853] = "COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR", e[e.QUERY_COUNTER_BITS_EXT = 34916] = "QUERY_COUNTER_BITS_EXT", e[e.CURRENT_QUERY_EXT = 34917] = "CURRENT_QUERY_EXT", e[e.QUERY_RESULT_EXT = 34918] = "QUERY_RESULT_EXT", e[e.QUERY_RESULT_AVAILABLE_EXT = 34919] = "QUERY_RESULT_AVAILABLE_EXT", e[e.TIME_ELAPSED_EXT = 35007] = "TIME_ELAPSED_EXT", e[e.TIMESTAMP_EXT = 36392] = "TIMESTAMP_EXT", e[e.GPU_DISJOINT_EXT = 36795] = "GPU_DISJOINT_EXT", e[e.COMPLETION_STATUS_KHR = 37297] = "COMPLETION_STATUS_KHR", e[e.DEPTH_CLAMP_EXT = 34383] = "DEPTH_CLAMP_EXT", e[e.FIRST_VERTEX_CONVENTION_WEBGL = 36429] = "FIRST_VERTEX_CONVENTION_WEBGL", e[e.LAST_VERTEX_CONVENTION_WEBGL = 36430] = "LAST_VERTEX_CONVENTION_WEBGL", e[e.PROVOKING_VERTEX_WEBL = 36431] = "PROVOKING_VERTEX_WEBL", e[e.POLYGON_MODE_WEBGL = 2880] = "POLYGON_MODE_WEBGL", e[e.POLYGON_OFFSET_LINE_WEBGL = 10754] = "POLYGON_OFFSET_LINE_WEBGL", e[e.LINE_WEBGL = 6913] = "LINE_WEBGL", e[e.FILL_WEBGL = 6914] = "FILL_WEBGL", e[e.MAX_CLIP_DISTANCES_WEBGL = 3378] = "MAX_CLIP_DISTANCES_WEBGL", e[e.MAX_CULL_DISTANCES_WEBGL = 33529] = "MAX_CULL_DISTANCES_WEBGL", e[e.MAX_COMBINED_CLIP_AND_CULL_DISTANCES_WEBGL = 33530] = "MAX_COMBINED_CLIP_AND_CULL_DISTANCES_WEBGL", e[e.CLIP_DISTANCE0_WEBGL = 12288] = "CLIP_DISTANCE0_WEBGL", e[e.CLIP_DISTANCE1_WEBGL = 12289] = "CLIP_DISTANCE1_WEBGL", e[e.CLIP_DISTANCE2_WEBGL = 12290] = "CLIP_DISTANCE2_WEBGL", e[e.CLIP_DISTANCE3_WEBGL = 12291] = "CLIP_DISTANCE3_WEBGL", e[e.CLIP_DISTANCE4_WEBGL = 12292] = "CLIP_DISTANCE4_WEBGL", e[e.CLIP_DISTANCE5_WEBGL = 12293] = "CLIP_DISTANCE5_WEBGL", e[e.CLIP_DISTANCE6_WEBGL = 12294] = "CLIP_DISTANCE6_WEBGL", e[e.CLIP_DISTANCE7_WEBGL = 12295] = "CLIP_DISTANCE7_WEBGL", e[e.POLYGON_OFFSET_CLAMP_EXT = 36379] = "POLYGON_OFFSET_CLAMP_EXT", e[e.LOWER_LEFT_EXT = 36001] = "LOWER_LEFT_EXT", e[e.UPPER_LEFT_EXT = 36002] = "UPPER_LEFT_EXT", e[e.NEGATIVE_ONE_TO_ONE_EXT = 37726] = "NEGATIVE_ONE_TO_ONE_EXT", e[e.ZERO_TO_ONE_EXT = 37727] = "ZERO_TO_ONE_EXT", e[e.CLIP_ORIGIN_EXT = 37724] = "CLIP_ORIGIN_EXT", e[e.CLIP_DEPTH_MODE_EXT = 37725] = "CLIP_DEPTH_MODE_EXT", e[e.SRC1_COLOR_WEBGL = 35065] = "SRC1_COLOR_WEBGL", e[e.SRC1_ALPHA_WEBGL = 34185] = "SRC1_ALPHA_WEBGL", e[e.ONE_MINUS_SRC1_COLOR_WEBGL = 35066] = "ONE_MINUS_SRC1_COLOR_WEBGL", e[e.ONE_MINUS_SRC1_ALPHA_WEBGL = 35067] = "ONE_MINUS_SRC1_ALPHA_WEBGL", e[e.MAX_DUAL_SOURCE_DRAW_BUFFERS_WEBGL = 35068] = "MAX_DUAL_SOURCE_DRAW_BUFFERS_WEBGL", e[e.MIRROR_CLAMP_TO_EDGE_EXT = 34627] = "MIRROR_CLAMP_TO_EDGE_EXT";
|
|
70
|
-
})(
|
|
71
|
-
const
|
|
72
|
-
class
|
|
19
|
+
})(L || (L = {}));
|
|
20
|
+
const K = 1e-3, H = 64, Ce = 4, $ = 2;
|
|
21
|
+
class Pe {
|
|
73
22
|
constructor() {
|
|
74
|
-
this.pointsTextureSize = 0, this.linksTextureSize = 0, this.alpha = 1, this.transform = V.create(), this.screenSize = [0, 0], this.mousePosition = [0, 0], this.screenMousePosition = [0, 0], this.selectedArea = [[0, 0], [0, 0]], this.isSimulationRunning = !1, this.simulationProgress = 0, this.selectedIndices = null, this.maxPointSize = H, this.hoveredPoint = void 0, this.focusedPoint = void 0, this.draggingPointIndex = void 0, this.hoveredLinkIndex = void 0, this.adjustedSpaceSize =
|
|
23
|
+
this.pointsTextureSize = 0, this.linksTextureSize = 0, this.alpha = 1, this.transform = V.create(), this.screenSize = [0, 0], this.mousePosition = [0, 0], this.screenMousePosition = [0, 0], this.selectedArea = [[0, 0], [0, 0]], this.isSimulationRunning = !1, this.simulationProgress = 0, this.selectedIndices = null, this.maxPointSize = H, this.hoveredPoint = void 0, this.focusedPoint = void 0, this.draggingPointIndex = void 0, this.hoveredLinkIndex = void 0, this.adjustedSpaceSize = k.spaceSize, this.isSpaceKeyPressed = !1, this.webglMaxTextureSize = 16384, this.hoveredPointRingColor = [1, 1, 1, Fe], this.focusedPointRingColor = [1, 1, 1, Ee], this.hoveredLinkColor = [-1, -1, -1, -1], this.greyoutPointColor = [-1, -1, -1, -1], this.isDarkenGreyout = !1, this.isLinkHoveringEnabled = !1, this.alphaTarget = 0, this.scalePointX = Q(), this.scalePointY = Q(), this.random = new Se(), this._backgroundColor = [0, 0, 0, 0], this.alphaDecay = (t) => 1 - Math.pow(K, 1 / t);
|
|
75
24
|
}
|
|
76
25
|
get backgroundColor() {
|
|
77
26
|
return this._backgroundColor;
|
|
@@ -192,7 +141,7 @@ class Ee {
|
|
|
192
141
|
}
|
|
193
142
|
set backgroundColor(t) {
|
|
194
143
|
this._backgroundColor = t;
|
|
195
|
-
const i =
|
|
144
|
+
const i = Ae(t[0], t[1], t[2]);
|
|
196
145
|
document.documentElement.style.setProperty("--cosmosgl-attribution-color", i > 0.65 ? "black" : "white"), document.documentElement.style.setProperty("--cosmosgl-error-message-color", i > 0.65 ? "black" : "white"), this.div && (this.div.style.backgroundColor = `rgba(${t[0] * 255}, ${t[1] * 255}, ${t[2] * 255}, ${t[3]})`), this.isDarkenGreyout = i < 0.65;
|
|
197
146
|
}
|
|
198
147
|
addRandomSeed(t) {
|
|
@@ -207,7 +156,7 @@ class Ee {
|
|
|
207
156
|
* Ensures `spaceSize` is always a positive number >= 2 (required for Math.log2).
|
|
208
157
|
*/
|
|
209
158
|
adjustSpaceSize(t, i) {
|
|
210
|
-
(t <= 0 || !isFinite(t)) && (console.error(`Invalid spaceSize value: ${t}. Using default value of ${
|
|
159
|
+
(t <= 0 || !isFinite(t)) && (console.error(`Invalid spaceSize value: ${t}. Using default value of ${k.spaceSize}`), t = k.spaceSize);
|
|
211
160
|
const o = 2;
|
|
212
161
|
if (t < o && (console.warn(`spaceSize (${t}) is too small. Using minimum value of ${o}`), t = o), !Number.isFinite(i) || i <= 0 || i < o) {
|
|
213
162
|
console.warn(`Invalid webglMaxTextureSize: ${i}. Using configSpaceSize without WebGL limit adjustment.`), this.adjustedSpaceSize = t;
|
|
@@ -232,11 +181,11 @@ class Ee {
|
|
|
232
181
|
return this.scalePointY(t);
|
|
233
182
|
}
|
|
234
183
|
setHoveredPointRingColor(t) {
|
|
235
|
-
const i =
|
|
184
|
+
const i = z(t);
|
|
236
185
|
this.hoveredPointRingColor[0] = i[0], this.hoveredPointRingColor[1] = i[1], this.hoveredPointRingColor[2] = i[2];
|
|
237
186
|
}
|
|
238
187
|
setFocusedPointRingColor(t) {
|
|
239
|
-
const i =
|
|
188
|
+
const i = z(t);
|
|
240
189
|
this.focusedPointRingColor[0] = i[0], this.focusedPointRingColor[1] = i[1], this.focusedPointRingColor[2] = i[2];
|
|
241
190
|
}
|
|
242
191
|
setGreyoutPointColor(t) {
|
|
@@ -244,7 +193,7 @@ class Ee {
|
|
|
244
193
|
this.greyoutPointColor = [-1, -1, -1, -1];
|
|
245
194
|
return;
|
|
246
195
|
}
|
|
247
|
-
const i =
|
|
196
|
+
const i = z(t);
|
|
248
197
|
this.greyoutPointColor[0] = i[0], this.greyoutPointColor[1] = i[1], this.greyoutPointColor[2] = i[2], this.greyoutPointColor[3] = i[3];
|
|
249
198
|
}
|
|
250
199
|
updateLinkHoveringEnabled(t) {
|
|
@@ -255,7 +204,7 @@ class Ee {
|
|
|
255
204
|
this.hoveredLinkColor = [-1, -1, -1, -1];
|
|
256
205
|
return;
|
|
257
206
|
}
|
|
258
|
-
const i =
|
|
207
|
+
const i = z(t);
|
|
259
208
|
this.hoveredLinkColor[0] = i[0], this.hoveredLinkColor[1] = i[1], this.hoveredLinkColor[2] = i[2], this.hoveredLinkColor[3] = i[3];
|
|
260
209
|
}
|
|
261
210
|
setFocusedPoint(t) {
|
|
@@ -265,26 +214,26 @@ class Ee {
|
|
|
265
214
|
return (this.alphaTarget - this.alpha) * this.alphaDecay(t);
|
|
266
215
|
}
|
|
267
216
|
}
|
|
268
|
-
const
|
|
269
|
-
function
|
|
217
|
+
const Re = (e) => typeof e == "function", ie = (e) => Array.isArray(e), xe = (e) => e instanceof Object, ve = (e) => e instanceof Object ? e.constructor.name !== "Function" && e.constructor.name !== "Object" : !1, zt = (e) => xe(e) && !ie(e) && !Re(e) && !ve(e);
|
|
218
|
+
function z(e) {
|
|
270
219
|
let t;
|
|
271
|
-
if (
|
|
220
|
+
if (ie(e))
|
|
272
221
|
t = e;
|
|
273
222
|
else {
|
|
274
|
-
const i =
|
|
275
|
-
t = [
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
223
|
+
const i = fe(e), o = i == null ? void 0 : i.rgb();
|
|
224
|
+
t = [
|
|
225
|
+
((o == null ? void 0 : o.r) ?? 0) / 255,
|
|
226
|
+
((o == null ? void 0 : o.g) ?? 0) / 255,
|
|
227
|
+
((o == null ? void 0 : o.b) ?? 0) / 255,
|
|
228
|
+
(i == null ? void 0 : i.opacity) ?? 1
|
|
229
|
+
];
|
|
230
|
+
}
|
|
231
|
+
return t;
|
|
283
232
|
}
|
|
284
|
-
function
|
|
233
|
+
function Ae(e, t, i) {
|
|
285
234
|
return 0.2126 * e + 0.7152 * t + 0.0722 * i;
|
|
286
235
|
}
|
|
287
|
-
function
|
|
236
|
+
function I(e, t, i = 0, o = 0, s, n) {
|
|
288
237
|
return e.readPixelsToArrayWebGL(t, {
|
|
289
238
|
sourceX: i,
|
|
290
239
|
sourceY: o,
|
|
@@ -292,10 +241,10 @@ function N(e, t, i = 0, o = 0, s, n) {
|
|
|
292
241
|
sourceHeight: n
|
|
293
242
|
});
|
|
294
243
|
}
|
|
295
|
-
function
|
|
244
|
+
function J(e, t) {
|
|
296
245
|
switch (e.info.type) {
|
|
297
246
|
case "webgl": {
|
|
298
|
-
const i = e.gl.getParameter(
|
|
247
|
+
const i = e.gl.getParameter(L.ALIASED_POINT_SIZE_RANGE);
|
|
299
248
|
return ((i == null ? void 0 : i[1]) ?? H) / t;
|
|
300
249
|
}
|
|
301
250
|
case "webgpu":
|
|
@@ -304,14 +253,14 @@ function $(e, t) {
|
|
|
304
253
|
return H / t;
|
|
305
254
|
}
|
|
306
255
|
}
|
|
307
|
-
function
|
|
256
|
+
function me(e, t, i) {
|
|
308
257
|
return Math.min(Math.max(e, t), i);
|
|
309
258
|
}
|
|
310
|
-
function
|
|
259
|
+
function N(e) {
|
|
311
260
|
return e != null && !Number.isNaN(e);
|
|
312
261
|
}
|
|
313
|
-
function
|
|
314
|
-
return
|
|
262
|
+
function Ie(e, t) {
|
|
263
|
+
return he.sanitize(e, {
|
|
315
264
|
// Default configuration: allow common safe HTML elements and attributes
|
|
316
265
|
ALLOWED_TAGS: ["a", "b", "i", "em", "strong", "span", "div", "p", "br"],
|
|
317
266
|
ALLOWED_ATTR: ["href", "target", "class", "id", "style"],
|
|
@@ -319,30 +268,331 @@ function Ue(e, t) {
|
|
|
319
268
|
...t
|
|
320
269
|
});
|
|
321
270
|
}
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
271
|
+
var oe = /* @__PURE__ */ ((e) => (e[e.Circle = 0] = "Circle", e[e.Square = 1] = "Square", e[e.Triangle = 2] = "Triangle", e[e.Diamond = 3] = "Diamond", e[e.Pentagon = 4] = "Pentagon", e[e.Hexagon = 5] = "Hexagon", e[e.Star = 6] = "Star", e[e.Cross = 7] = "Cross", e[e.None = 8] = "None", e))(oe || {});
|
|
272
|
+
class ye {
|
|
273
|
+
constructor(t) {
|
|
274
|
+
this._config = t;
|
|
325
275
|
}
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
276
|
+
get pointsNumber() {
|
|
277
|
+
return this.pointPositions && this.pointPositions.length / 2;
|
|
278
|
+
}
|
|
279
|
+
get linksNumber() {
|
|
280
|
+
return this.links && this.links.length / 2;
|
|
281
|
+
}
|
|
282
|
+
updatePoints() {
|
|
283
|
+
this.pointPositions = this.inputPointPositions;
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Updates the point colors based on the input data or default config value.
|
|
287
|
+
*/
|
|
288
|
+
updatePointColor() {
|
|
289
|
+
if (this.pointsNumber === void 0) {
|
|
290
|
+
this.pointColors = void 0;
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
const t = z(this._config.pointDefaultColor);
|
|
294
|
+
if (this.inputPointColors === void 0 || this.inputPointColors.length / 4 !== this.pointsNumber) {
|
|
295
|
+
this.pointColors = new Float32Array(this.pointsNumber * 4);
|
|
296
|
+
for (let i = 0; i < this.pointColors.length / 4; i++)
|
|
297
|
+
this.pointColors[i * 4] = t[0], this.pointColors[i * 4 + 1] = t[1], this.pointColors[i * 4 + 2] = t[2], this.pointColors[i * 4 + 3] = t[3];
|
|
298
|
+
} else {
|
|
299
|
+
this.pointColors = this.inputPointColors;
|
|
300
|
+
for (let i = 0; i < this.pointColors.length / 4; i++)
|
|
301
|
+
N(this.pointColors[i * 4]) || (this.pointColors[i * 4] = t[0]), N(this.pointColors[i * 4 + 1]) || (this.pointColors[i * 4 + 1] = t[1]), N(this.pointColors[i * 4 + 2]) || (this.pointColors[i * 4 + 2] = t[2]), N(this.pointColors[i * 4 + 3]) || (this.pointColors[i * 4 + 3] = t[3]);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Updates the point sizes based on the input data or default config value.
|
|
306
|
+
*/
|
|
307
|
+
updatePointSize() {
|
|
308
|
+
if (this.pointsNumber === void 0) {
|
|
309
|
+
this.pointSizes = void 0;
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
312
|
+
const t = this._config.pointDefaultSize;
|
|
313
|
+
if (this.inputPointSizes === void 0 || this.inputPointSizes.length !== this.pointsNumber)
|
|
314
|
+
this.pointSizes = new Float32Array(this.pointsNumber).fill(t);
|
|
315
|
+
else {
|
|
316
|
+
this.pointSizes = this.inputPointSizes;
|
|
317
|
+
for (let i = 0; i < this.pointSizes.length; i++)
|
|
318
|
+
N(this.pointSizes[i]) || (this.pointSizes[i] = t);
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* Updates the point shapes based on the input data or default config value.
|
|
323
|
+
* Images are rendered above shapes.
|
|
324
|
+
*/
|
|
325
|
+
updatePointShape() {
|
|
326
|
+
if (this.pointsNumber === void 0) {
|
|
327
|
+
this.pointShapes = void 0;
|
|
328
|
+
return;
|
|
329
|
+
}
|
|
330
|
+
const { pointDefaultShape: t } = this._config, i = typeof t == "string" ? Number(t) : t, o = i >= 0 && i <= 8 ? i : k.pointDefaultShape;
|
|
331
|
+
if (this.inputPointShapes === void 0 || this.inputPointShapes.length !== this.pointsNumber)
|
|
332
|
+
this.pointShapes = new Float32Array(this.pointsNumber).fill(o);
|
|
333
|
+
else {
|
|
334
|
+
this.pointShapes = new Float32Array(this.inputPointShapes);
|
|
335
|
+
const s = this.pointShapes;
|
|
336
|
+
for (let n = 0; n < s.length; n++) {
|
|
337
|
+
const r = s[n];
|
|
338
|
+
(r == null || !N(r) || r < 0 || r > 8) && (s[n] = o);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* Updates the point image indices based on the input data or default value (-1 for no image).
|
|
344
|
+
*/
|
|
345
|
+
updatePointImageIndices() {
|
|
346
|
+
if (this.pointsNumber === void 0) {
|
|
347
|
+
this.pointImageIndices = void 0;
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
350
|
+
if (this.inputPointImageIndices === void 0 || this.inputPointImageIndices.length !== this.pointsNumber)
|
|
351
|
+
this.pointImageIndices = new Float32Array(this.pointsNumber).fill(-1);
|
|
352
|
+
else {
|
|
353
|
+
const t = new Float32Array(this.inputPointImageIndices);
|
|
354
|
+
for (let i = 0; i < t.length; i++) {
|
|
355
|
+
const o = t[i], s = o === void 0 ? NaN : o;
|
|
356
|
+
!Number.isFinite(s) || s < 0 ? t[i] = -1 : t[i] = Math.trunc(s);
|
|
357
|
+
}
|
|
358
|
+
this.pointImageIndices = t;
|
|
359
|
+
}
|
|
330
360
|
}
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
361
|
+
/**
|
|
362
|
+
* Updates the point image sizes based on the input data or default to point sizes.
|
|
363
|
+
*/
|
|
364
|
+
updatePointImageSizes() {
|
|
365
|
+
var i;
|
|
366
|
+
if (this.pointsNumber === void 0) {
|
|
367
|
+
this.pointImageSizes = void 0;
|
|
368
|
+
return;
|
|
369
|
+
}
|
|
370
|
+
const t = this._config.pointDefaultSize;
|
|
371
|
+
if (this.inputPointImageSizes === void 0 || this.inputPointImageSizes.length !== this.pointsNumber)
|
|
372
|
+
this.pointImageSizes = this.pointSizes ? new Float32Array(this.pointSizes) : new Float32Array(this.pointsNumber).fill(t);
|
|
373
|
+
else {
|
|
374
|
+
this.pointImageSizes = new Float32Array(this.inputPointImageSizes);
|
|
375
|
+
for (let o = 0; o < this.pointImageSizes.length; o++)
|
|
376
|
+
N(this.pointImageSizes[o]) || (this.pointImageSizes[o] = ((i = this.pointSizes) == null ? void 0 : i[o]) ?? t);
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
updateLinks() {
|
|
380
|
+
this.links = this.inputLinks;
|
|
381
|
+
}
|
|
382
|
+
/**
|
|
383
|
+
* Updates the link colors based on the input data or default config value.
|
|
384
|
+
*/
|
|
385
|
+
updateLinkColor() {
|
|
386
|
+
if (this.linksNumber === void 0) {
|
|
387
|
+
this.linkColors = void 0;
|
|
388
|
+
return;
|
|
389
|
+
}
|
|
390
|
+
const t = z(this._config.linkDefaultColor);
|
|
391
|
+
if (this.inputLinkColors === void 0 || this.inputLinkColors.length / 4 !== this.linksNumber) {
|
|
392
|
+
this.linkColors = new Float32Array(this.linksNumber * 4);
|
|
393
|
+
for (let i = 0; i < this.linkColors.length / 4; i++)
|
|
394
|
+
this.linkColors[i * 4] = t[0], this.linkColors[i * 4 + 1] = t[1], this.linkColors[i * 4 + 2] = t[2], this.linkColors[i * 4 + 3] = t[3];
|
|
395
|
+
} else {
|
|
396
|
+
this.linkColors = this.inputLinkColors;
|
|
397
|
+
for (let i = 0; i < this.linkColors.length / 4; i++)
|
|
398
|
+
N(this.linkColors[i * 4]) || (this.linkColors[i * 4] = t[0]), N(this.linkColors[i * 4 + 1]) || (this.linkColors[i * 4 + 1] = t[1]), N(this.linkColors[i * 4 + 2]) || (this.linkColors[i * 4 + 2] = t[2]), N(this.linkColors[i * 4 + 3]) || (this.linkColors[i * 4 + 3] = t[3]);
|
|
399
|
+
}
|
|
335
400
|
}
|
|
336
|
-
|
|
337
|
-
|
|
401
|
+
/**
|
|
402
|
+
* Updates the link width based on the input data or default config value.
|
|
403
|
+
*/
|
|
404
|
+
updateLinkWidth() {
|
|
405
|
+
if (this.linksNumber === void 0) {
|
|
406
|
+
this.linkWidths = void 0;
|
|
407
|
+
return;
|
|
408
|
+
}
|
|
409
|
+
const t = this._config.linkDefaultWidth;
|
|
410
|
+
if (this.inputLinkWidths === void 0 || this.inputLinkWidths.length !== this.linksNumber)
|
|
411
|
+
this.linkWidths = new Float32Array(this.linksNumber).fill(t);
|
|
412
|
+
else {
|
|
413
|
+
this.linkWidths = this.inputLinkWidths;
|
|
414
|
+
for (let i = 0; i < this.linkWidths.length; i++)
|
|
415
|
+
N(this.linkWidths[i]) || (this.linkWidths[i] = t);
|
|
416
|
+
}
|
|
338
417
|
}
|
|
418
|
+
/**
|
|
419
|
+
* Updates the link arrows based on the input data or default config value.
|
|
420
|
+
*/
|
|
421
|
+
updateArrows() {
|
|
422
|
+
if (this.linksNumber === void 0) {
|
|
423
|
+
this.linkArrows = void 0;
|
|
424
|
+
return;
|
|
425
|
+
}
|
|
426
|
+
const t = this._config.linkDefaultArrows;
|
|
427
|
+
this.linkArrowsBoolean === void 0 || this.linkArrowsBoolean.length !== this.linksNumber ? this.linkArrows = new Array(this.linksNumber).fill(+t) : this.linkArrows = this.linkArrowsBoolean.map((i) => +i);
|
|
428
|
+
}
|
|
429
|
+
updateLinkStrength() {
|
|
430
|
+
this.linksNumber === void 0 && (this.linkStrength = void 0), this.inputLinkStrength === void 0 || this.inputLinkStrength.length !== this.linksNumber ? this.linkStrength = void 0 : this.linkStrength = this.inputLinkStrength;
|
|
431
|
+
}
|
|
432
|
+
updateClusters() {
|
|
433
|
+
if (this.pointsNumber === void 0) {
|
|
434
|
+
this.pointClusters = void 0, this.clusterPositions = void 0;
|
|
435
|
+
return;
|
|
436
|
+
}
|
|
437
|
+
this.inputPointClusters === void 0 || this.inputPointClusters.length !== this.pointsNumber ? this.pointClusters = void 0 : this.pointClusters = this.inputPointClusters, this.inputClusterPositions === void 0 ? this.clusterPositions = void 0 : this.clusterPositions = this.inputClusterPositions, this.inputClusterStrength === void 0 || this.inputClusterStrength.length !== this.pointsNumber ? this.clusterStrength = void 0 : this.clusterStrength = this.inputClusterStrength;
|
|
438
|
+
}
|
|
439
|
+
update() {
|
|
440
|
+
this.updatePoints(), this.updatePointColor(), this.updatePointSize(), this.updatePointShape(), this.updatePointImageIndices(), this.updatePointImageSizes(), this.updateLinks(), this.updateLinkColor(), this.updateLinkWidth(), this.updateArrows(), this.updateLinkStrength(), this.updateClusters(), this._createAdjacencyLists(), this._calculateDegrees();
|
|
441
|
+
}
|
|
442
|
+
getAdjacentIndices(t) {
|
|
443
|
+
var i, o, s, n;
|
|
444
|
+
return [...((o = (i = this.sourceIndexToTargetIndices) == null ? void 0 : i[t]) == null ? void 0 : o.map((r) => r[0])) || [], ...((n = (s = this.targetIndexToSourceIndices) == null ? void 0 : s[t]) == null ? void 0 : n.map((r) => r[0])) || []];
|
|
445
|
+
}
|
|
446
|
+
_createAdjacencyLists() {
|
|
447
|
+
var t, i;
|
|
448
|
+
if (this.linksNumber === void 0 || this.links === void 0) {
|
|
449
|
+
this.sourceIndexToTargetIndices = void 0, this.targetIndexToSourceIndices = void 0;
|
|
450
|
+
return;
|
|
451
|
+
}
|
|
452
|
+
this.sourceIndexToTargetIndices = new Array(this.pointsNumber).fill(void 0), this.targetIndexToSourceIndices = new Array(this.pointsNumber).fill(void 0);
|
|
453
|
+
for (let o = 0; o < this.linksNumber; o++) {
|
|
454
|
+
const s = this.links[o * 2], n = this.links[o * 2 + 1];
|
|
455
|
+
s !== void 0 && n !== void 0 && (this.sourceIndexToTargetIndices[s] === void 0 && (this.sourceIndexToTargetIndices[s] = []), (t = this.sourceIndexToTargetIndices[s]) == null || t.push([n, o]), this.targetIndexToSourceIndices[n] === void 0 && (this.targetIndexToSourceIndices[n] = []), (i = this.targetIndexToSourceIndices[n]) == null || i.push([s, o]));
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
_calculateDegrees() {
|
|
459
|
+
var t, i, o, s;
|
|
460
|
+
if (this.pointsNumber === void 0) {
|
|
461
|
+
this.degree = void 0, this.inDegree = void 0, this.outDegree = void 0;
|
|
462
|
+
return;
|
|
463
|
+
}
|
|
464
|
+
this.degree = new Array(this.pointsNumber).fill(0), this.inDegree = new Array(this.pointsNumber).fill(0), this.outDegree = new Array(this.pointsNumber).fill(0);
|
|
465
|
+
for (let n = 0; n < this.pointsNumber; n++)
|
|
466
|
+
this.inDegree[n] = ((i = (t = this.targetIndexToSourceIndices) == null ? void 0 : t[n]) == null ? void 0 : i.length) ?? 0, this.outDegree[n] = ((s = (o = this.sourceIndexToTargetIndices) == null ? void 0 : o[n]) == null ? void 0 : s.length) ?? 0, this.degree[n] = (this.inDegree[n] ?? 0) + (this.outDegree[n] ?? 0);
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
const k = {
|
|
470
|
+
// General
|
|
471
|
+
enableSimulation: !0,
|
|
472
|
+
backgroundColor: "#222222",
|
|
473
|
+
/** Setting to 4096 because larger values crash the graph on iOS. More info: https://github.com/cosmosgl/graph/issues/203 */
|
|
474
|
+
spaceSize: 4096,
|
|
475
|
+
// Points
|
|
476
|
+
pointDefaultColor: "#b3b3b3",
|
|
477
|
+
pointDefaultSize: 4,
|
|
478
|
+
pointDefaultShape: oe.Circle,
|
|
479
|
+
pointOpacity: 1,
|
|
480
|
+
pointGreyoutOpacity: void 0,
|
|
481
|
+
pointGreyoutColor: void 0,
|
|
482
|
+
pointSizeScale: 1,
|
|
483
|
+
scalePointsOnZoom: !1,
|
|
484
|
+
// Point interaction
|
|
485
|
+
hoveredPointCursor: "auto",
|
|
486
|
+
renderHoveredPointRing: !1,
|
|
487
|
+
hoveredPointRingColor: "white",
|
|
488
|
+
focusedPointRingColor: "white",
|
|
489
|
+
focusedPointIndex: void 0,
|
|
490
|
+
// Links
|
|
491
|
+
renderLinks: !0,
|
|
492
|
+
linkDefaultColor: "#666666",
|
|
493
|
+
linkDefaultWidth: 1,
|
|
494
|
+
linkOpacity: 1,
|
|
495
|
+
linkGreyoutOpacity: 0.1,
|
|
496
|
+
linkWidthScale: 1,
|
|
497
|
+
scaleLinksOnZoom: !1,
|
|
498
|
+
curvedLinks: !1,
|
|
499
|
+
curvedLinkSegments: 19,
|
|
500
|
+
curvedLinkWeight: 0.8,
|
|
501
|
+
curvedLinkControlPointDistance: 0.5,
|
|
502
|
+
linkDefaultArrows: !1,
|
|
503
|
+
linkArrowsSizeScale: 1,
|
|
504
|
+
linkVisibilityDistanceRange: [50, 150],
|
|
505
|
+
linkVisibilityMinTransparency: 0.25,
|
|
506
|
+
// Link interaction
|
|
507
|
+
hoveredLinkCursor: "auto",
|
|
508
|
+
hoveredLinkColor: void 0,
|
|
509
|
+
hoveredLinkWidthIncrease: 5,
|
|
510
|
+
// Simulation
|
|
511
|
+
simulationDecay: 5e3,
|
|
512
|
+
simulationGravity: 0.25,
|
|
513
|
+
simulationCenter: 0,
|
|
514
|
+
simulationRepulsion: 1,
|
|
515
|
+
simulationRepulsionTheta: 1.15,
|
|
516
|
+
simulationLinkSpring: 1,
|
|
517
|
+
simulationLinkDistance: 10,
|
|
518
|
+
simulationLinkDistRandomVariationRange: [1, 1.2],
|
|
519
|
+
simulationRepulsionFromMouse: 2,
|
|
520
|
+
simulationFriction: 0.85,
|
|
521
|
+
simulationCluster: 0.1,
|
|
522
|
+
enableRightClickRepulsion: !1,
|
|
523
|
+
// Simulation callbacks
|
|
524
|
+
onSimulationStart: void 0,
|
|
525
|
+
onSimulationTick: void 0,
|
|
526
|
+
onSimulationEnd: void 0,
|
|
527
|
+
onSimulationPause: void 0,
|
|
528
|
+
onSimulationUnpause: void 0,
|
|
529
|
+
// Interaction callbacks
|
|
530
|
+
onClick: void 0,
|
|
531
|
+
onPointClick: void 0,
|
|
532
|
+
onLinkClick: void 0,
|
|
533
|
+
onBackgroundClick: void 0,
|
|
534
|
+
onContextMenu: void 0,
|
|
535
|
+
onPointContextMenu: void 0,
|
|
536
|
+
onLinkContextMenu: void 0,
|
|
537
|
+
onBackgroundContextMenu: void 0,
|
|
538
|
+
onMouseMove: void 0,
|
|
539
|
+
onPointMouseOver: void 0,
|
|
540
|
+
onPointMouseOut: void 0,
|
|
541
|
+
onLinkMouseOver: void 0,
|
|
542
|
+
onLinkMouseOut: void 0,
|
|
543
|
+
// Zoom and pan callbacks
|
|
544
|
+
onZoomStart: void 0,
|
|
545
|
+
onZoom: void 0,
|
|
546
|
+
onZoomEnd: void 0,
|
|
547
|
+
// Drag callbacks
|
|
548
|
+
onDragStart: void 0,
|
|
549
|
+
onDrag: void 0,
|
|
550
|
+
onDragEnd: void 0,
|
|
551
|
+
// Display
|
|
552
|
+
showFPSMonitor: !1,
|
|
553
|
+
pixelRatio: typeof window < "u" && window.devicePixelRatio || 2,
|
|
554
|
+
// Zoom and pan
|
|
555
|
+
enableZoom: !0,
|
|
556
|
+
enableSimulationDuringZoom: !1,
|
|
557
|
+
initialZoomLevel: void 0,
|
|
558
|
+
// Drag
|
|
559
|
+
enableDrag: !1,
|
|
560
|
+
// Fit view
|
|
561
|
+
fitViewOnInit: !0,
|
|
562
|
+
fitViewDelay: 250,
|
|
563
|
+
fitViewPadding: 0.1,
|
|
564
|
+
fitViewDuration: 250,
|
|
565
|
+
fitViewByPointsInRect: void 0,
|
|
566
|
+
fitViewByPointIndices: void 0,
|
|
567
|
+
// Sampling
|
|
568
|
+
pointSamplingDistance: 100,
|
|
569
|
+
linkSamplingDistance: 100,
|
|
570
|
+
// Miscellaneous
|
|
571
|
+
randomSeed: void 0,
|
|
572
|
+
rescalePositions: void 0,
|
|
573
|
+
attribution: ""
|
|
574
|
+
}, Fe = 0.7, Ee = 0.95, Z = (e) => Array.isArray(e) ? [...e] : e;
|
|
575
|
+
function se() {
|
|
576
|
+
const e = {};
|
|
577
|
+
for (const [t, i] of Object.entries(k))
|
|
578
|
+
e[t] = Z(i);
|
|
579
|
+
return e;
|
|
580
|
+
}
|
|
581
|
+
function Ne(e) {
|
|
582
|
+
Object.assign(e, se());
|
|
583
|
+
}
|
|
584
|
+
function Y(e, t, i = !1) {
|
|
585
|
+
const o = {};
|
|
586
|
+
for (const [s, n] of Object.entries(t))
|
|
587
|
+
n !== void 0 ? o[s] = Z(n) : i && (o[s] = Z(k[s]));
|
|
588
|
+
Object.assign(e, o);
|
|
339
589
|
}
|
|
340
590
|
class w {
|
|
341
591
|
constructor(t, i, o, s, n) {
|
|
342
592
|
this._debugRandomNumber = Math.floor(Math.random() * 1e3), this.device = t, this.config = i, this.store = o, this.data = s, n && (this.points = n);
|
|
343
593
|
}
|
|
344
594
|
}
|
|
345
|
-
const
|
|
595
|
+
const De = `#version 300 es
|
|
346
596
|
precision highp float;
|
|
347
597
|
|
|
348
598
|
in vec4 rgba;
|
|
@@ -350,7 +600,7 @@ out vec4 fragColor;
|
|
|
350
600
|
|
|
351
601
|
void main() {
|
|
352
602
|
fragColor = rgba;
|
|
353
|
-
}`,
|
|
603
|
+
}`, Me = `#version 300 es
|
|
354
604
|
precision highp float;
|
|
355
605
|
|
|
356
606
|
uniform sampler2D positionsTexture;
|
|
@@ -376,7 +626,7 @@ void main() {
|
|
|
376
626
|
gl_Position = vec4(0.0, 0.0, 0.0, 1.0);
|
|
377
627
|
gl_PointSize = 1.0;
|
|
378
628
|
}
|
|
379
|
-
`,
|
|
629
|
+
`, Oe = `#version 300 es
|
|
380
630
|
precision highp float;
|
|
381
631
|
|
|
382
632
|
uniform sampler2D positionsTexture;
|
|
@@ -423,10 +673,10 @@ function X(e) {
|
|
|
423
673
|
return t;
|
|
424
674
|
}
|
|
425
675
|
function T(e, t) {
|
|
426
|
-
const i =
|
|
676
|
+
const i = de.getInfo(e);
|
|
427
677
|
return t * (i.bytesPerPixel ?? 0);
|
|
428
678
|
}
|
|
429
|
-
const
|
|
679
|
+
const D = `#version 300 es
|
|
430
680
|
#ifdef GL_ES
|
|
431
681
|
precision highp float;
|
|
432
682
|
#endif
|
|
@@ -440,7 +690,7 @@ void main() {
|
|
|
440
690
|
gl_Position = vec4(vertexCoord, 0, 1);
|
|
441
691
|
}
|
|
442
692
|
`;
|
|
443
|
-
class
|
|
693
|
+
class Ue extends w {
|
|
444
694
|
create() {
|
|
445
695
|
var s;
|
|
446
696
|
const { device: t, store: i } = this, { pointsTextureSize: o } = i;
|
|
@@ -449,7 +699,7 @@ class we extends w {
|
|
|
449
699
|
width: 1,
|
|
450
700
|
height: 1,
|
|
451
701
|
format: "rgba32float",
|
|
452
|
-
usage:
|
|
702
|
+
usage: g.SAMPLE | g.RENDER | g.COPY_DST
|
|
453
703
|
})), this.centermassTexture.copyImageData({
|
|
454
704
|
data: new Float32Array(4).fill(0),
|
|
455
705
|
bytesPerRow: T("rgba32float", 1),
|
|
@@ -477,22 +727,22 @@ class we extends w {
|
|
|
477
727
|
const { device: t, store: i, points: o } = this;
|
|
478
728
|
!o || !i.pointsTextureSize || !this.centermassFbo || this.centermassFbo.destroyed || !this.centermassTexture || this.centermassTexture.destroyed || (this.forceVertexCoordBuffer || (this.forceVertexCoordBuffer = t.createBuffer({
|
|
479
729
|
data: new Float32Array([-1, -1, 1, -1, -1, 1, 1, 1])
|
|
480
|
-
})), this.calculateUniformStore || (this.calculateUniformStore = new
|
|
730
|
+
})), this.calculateUniformStore || (this.calculateUniformStore = new R({
|
|
481
731
|
calculateCentermassUniforms: {
|
|
482
732
|
uniformTypes: {
|
|
483
733
|
pointsTextureSize: "f32"
|
|
484
734
|
}
|
|
485
735
|
}
|
|
486
|
-
})), this.forceUniformStore || (this.forceUniformStore = new
|
|
736
|
+
})), this.forceUniformStore || (this.forceUniformStore = new R({
|
|
487
737
|
forceCenterUniforms: {
|
|
488
738
|
uniformTypes: {
|
|
489
739
|
centerForce: "f32",
|
|
490
740
|
alpha: "f32"
|
|
491
741
|
}
|
|
492
742
|
}
|
|
493
|
-
})), this.calculateCentermassCommand || (this.calculateCentermassCommand = new
|
|
494
|
-
fs:
|
|
495
|
-
vs:
|
|
743
|
+
})), this.calculateCentermassCommand || (this.calculateCentermassCommand = new x(t, {
|
|
744
|
+
fs: De,
|
|
745
|
+
vs: Me,
|
|
496
746
|
topology: "point-list",
|
|
497
747
|
attributes: {
|
|
498
748
|
...this.pointIndices && { pointIndices: this.pointIndices }
|
|
@@ -520,9 +770,9 @@ class we extends w {
|
|
|
520
770
|
depthWriteEnabled: !1,
|
|
521
771
|
depthCompare: "always"
|
|
522
772
|
}
|
|
523
|
-
})), this.calculateCentermassCommand.setVertexCount(this.data.pointsNumber ?? 0), this.runCommand || (this.runCommand = new
|
|
524
|
-
fs:
|
|
525
|
-
vs:
|
|
773
|
+
})), this.calculateCentermassCommand.setVertexCount(this.data.pointsNumber ?? 0), this.runCommand || (this.runCommand = new x(t, {
|
|
774
|
+
fs: Oe,
|
|
775
|
+
vs: D,
|
|
526
776
|
topology: "triangle-strip",
|
|
527
777
|
vertexCount: 4,
|
|
528
778
|
attributes: {
|
|
@@ -561,7 +811,7 @@ class we extends w {
|
|
|
561
811
|
positionsTexture: o.previousPositionTexture
|
|
562
812
|
}), this.calculateCentermassCommand.draw(s), s.end(), this.forceUniformStore.setUniforms({
|
|
563
813
|
forceCenterUniforms: {
|
|
564
|
-
centerForce: this.config.simulationCenter
|
|
814
|
+
centerForce: this.config.simulationCenter,
|
|
565
815
|
alpha: i.alpha
|
|
566
816
|
}
|
|
567
817
|
}), this.runCommand.setBindings({
|
|
@@ -583,7 +833,7 @@ class we extends w {
|
|
|
583
833
|
(t = this.calculateCentermassCommand) == null || t.destroy(), this.calculateCentermassCommand = void 0, (i = this.runCommand) == null || i.destroy(), this.runCommand = void 0, this.centermassFbo && !this.centermassFbo.destroyed && this.centermassFbo.destroy(), this.centermassFbo = void 0, this.centermassTexture && !this.centermassTexture.destroyed && this.centermassTexture.destroy(), this.centermassTexture = void 0, (o = this.calculateUniformStore) == null || o.destroy(), this.calculateUniformStore = void 0, (s = this.forceUniformStore) == null || s.destroy(), this.forceUniformStore = void 0, this.pointIndices && !this.pointIndices.destroyed && this.pointIndices.destroy(), this.pointIndices = void 0, this.forceVertexCoordBuffer && !this.forceVertexCoordBuffer.destroyed && this.forceVertexCoordBuffer.destroy(), this.forceVertexCoordBuffer = void 0, this.previousPointsTextureSize = void 0;
|
|
584
834
|
}
|
|
585
835
|
}
|
|
586
|
-
const
|
|
836
|
+
const Be = `#version 300 es
|
|
587
837
|
precision highp float;
|
|
588
838
|
|
|
589
839
|
uniform sampler2D positionsTexture;
|
|
@@ -623,12 +873,12 @@ void main() {
|
|
|
623
873
|
|
|
624
874
|
fragColor = velocity;
|
|
625
875
|
}`;
|
|
626
|
-
class
|
|
876
|
+
class be extends w {
|
|
627
877
|
initPrograms() {
|
|
628
878
|
const { device: t, points: i, store: o } = this;
|
|
629
879
|
!i || !o.pointsTextureSize || (this.vertexCoordBuffer || (this.vertexCoordBuffer = t.createBuffer({
|
|
630
880
|
data: new Float32Array([-1, -1, 1, -1, -1, 1, 1, 1])
|
|
631
|
-
})), this.uniformStore || (this.uniformStore = new
|
|
881
|
+
})), this.uniformStore || (this.uniformStore = new R({
|
|
632
882
|
forceGravityUniforms: {
|
|
633
883
|
uniformTypes: {
|
|
634
884
|
gravity: "f32",
|
|
@@ -636,9 +886,9 @@ class He extends w {
|
|
|
636
886
|
alpha: "f32"
|
|
637
887
|
}
|
|
638
888
|
}
|
|
639
|
-
})), this.runCommand || (this.runCommand = new
|
|
640
|
-
fs:
|
|
641
|
-
vs:
|
|
889
|
+
})), this.runCommand || (this.runCommand = new x(t, {
|
|
890
|
+
fs: Be,
|
|
891
|
+
vs: D,
|
|
642
892
|
topology: "triangle-strip",
|
|
643
893
|
vertexCount: 4,
|
|
644
894
|
attributes: {
|
|
@@ -667,8 +917,8 @@ class He extends w {
|
|
|
667
917
|
if (!i || !this.runCommand || !this.uniformStore || !i.previousPositionTexture || i.previousPositionTexture.destroyed || !i.velocityFbo || i.velocityFbo.destroyed) return;
|
|
668
918
|
this.uniformStore.setUniforms({
|
|
669
919
|
forceGravityUniforms: {
|
|
670
|
-
gravity: this.config.simulationGravity
|
|
671
|
-
spaceSize: o.adjustedSpaceSize
|
|
920
|
+
gravity: this.config.simulationGravity,
|
|
921
|
+
spaceSize: o.adjustedSpaceSize,
|
|
672
922
|
alpha: o.alpha
|
|
673
923
|
}
|
|
674
924
|
}), this.runCommand.setBindings({
|
|
@@ -689,7 +939,7 @@ class He extends w {
|
|
|
689
939
|
(t = this.runCommand) == null || t.destroy(), this.runCommand = void 0, (i = this.uniformStore) == null || i.destroy(), this.uniformStore = void 0, this.vertexCoordBuffer && !this.vertexCoordBuffer.destroyed && this.vertexCoordBuffer.destroy(), this.vertexCoordBuffer = void 0;
|
|
690
940
|
}
|
|
691
941
|
}
|
|
692
|
-
function
|
|
942
|
+
function ze(e) {
|
|
693
943
|
return `#version 300 es
|
|
694
944
|
precision highp float;
|
|
695
945
|
|
|
@@ -778,40 +1028,40 @@ void main() {
|
|
|
778
1028
|
}
|
|
779
1029
|
`;
|
|
780
1030
|
}
|
|
781
|
-
function
|
|
1031
|
+
function _(e, t) {
|
|
782
1032
|
return !e || e.length !== 2 ? t : [e[0], e[1]];
|
|
783
1033
|
}
|
|
784
|
-
function
|
|
1034
|
+
function A(e, t) {
|
|
785
1035
|
return !e || e.length !== 4 ? t : [e[0], e[1], e[2], e[3]];
|
|
786
1036
|
}
|
|
787
|
-
var
|
|
788
|
-
class
|
|
1037
|
+
var j = /* @__PURE__ */ ((e) => (e.OUTGOING = "outgoing", e.INCOMING = "incoming", e))(j || {});
|
|
1038
|
+
class G extends w {
|
|
789
1039
|
constructor() {
|
|
790
1040
|
super(...arguments), this.linkFirstIndicesAndAmount = new Float32Array(), this.indices = new Float32Array(), this.maxPointDegree = 0;
|
|
791
1041
|
}
|
|
792
1042
|
create(t) {
|
|
793
|
-
var
|
|
1043
|
+
var u;
|
|
794
1044
|
const { device: i, store: { pointsTextureSize: o, linksTextureSize: s }, data: n } = this;
|
|
795
1045
|
if (!o || !s) return;
|
|
796
1046
|
this.linkFirstIndicesAndAmount = new Float32Array(o * o * 4), this.indices = new Float32Array(s * s * 4);
|
|
797
|
-
const r = new Float32Array(s * s * 4), a = new Float32Array(s * s * 4),
|
|
1047
|
+
const r = new Float32Array(s * s * 4), a = new Float32Array(s * s * 4), d = t === "incoming" ? n.sourceIndexToTargetIndices : n.targetIndexToSourceIndices;
|
|
798
1048
|
this.maxPointDegree = 0;
|
|
799
|
-
let
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
var
|
|
803
|
-
this.indices[
|
|
804
|
-
const
|
|
805
|
-
let
|
|
806
|
-
|
|
807
|
-
}), this.maxPointDegree = Math.max(this.maxPointDegree,
|
|
1049
|
+
let l = 0;
|
|
1050
|
+
d == null || d.forEach((h, p) => {
|
|
1051
|
+
h && (this.linkFirstIndicesAndAmount[p * 4 + 0] = l % s, this.linkFirstIndicesAndAmount[p * 4 + 1] = Math.floor(l / s), this.linkFirstIndicesAndAmount[p * 4 + 2] = h.length ?? 0, h.forEach(([P, m]) => {
|
|
1052
|
+
var M, U, B;
|
|
1053
|
+
this.indices[l * 4 + 0] = P % o, this.indices[l * 4 + 1] = Math.floor(P / o);
|
|
1054
|
+
const C = ((M = n.degree) == null ? void 0 : M[P]) ?? 0, v = ((U = n.degree) == null ? void 0 : U[p]) ?? 0, y = C + v, O = y !== 0 ? C / y : 0.5, F = Math.min(C, v);
|
|
1055
|
+
let E = ((B = n.linkStrength) == null ? void 0 : B[m]) ?? 1 / Math.max(F, 1);
|
|
1056
|
+
E = Math.sqrt(E), r[l * 4 + 0] = O, r[l * 4 + 1] = E, a[l * 4] = this.store.getRandomFloat(0, 1), l += 1;
|
|
1057
|
+
}), this.maxPointDegree = Math.max(this.maxPointDegree, h.length ?? 0));
|
|
808
1058
|
});
|
|
809
1059
|
const c = !this.linkFirstIndicesAndAmountTexture || this.linkFirstIndicesAndAmountTexture.width !== o || this.linkFirstIndicesAndAmountTexture.height !== o, f = !this.indicesTexture || this.indicesTexture.width !== s || this.indicesTexture.height !== s;
|
|
810
1060
|
c && (this.linkFirstIndicesAndAmountTexture && !this.linkFirstIndicesAndAmountTexture.destroyed && this.linkFirstIndicesAndAmountTexture.destroy(), this.linkFirstIndicesAndAmountTexture = i.createTexture({
|
|
811
1061
|
width: o,
|
|
812
1062
|
height: o,
|
|
813
1063
|
format: "rgba32float",
|
|
814
|
-
usage:
|
|
1064
|
+
usage: g.SAMPLE | g.COPY_DST
|
|
815
1065
|
})), this.linkFirstIndicesAndAmountTexture.copyImageData({
|
|
816
1066
|
data: this.linkFirstIndicesAndAmount,
|
|
817
1067
|
bytesPerRow: T("rgba32float", o),
|
|
@@ -822,17 +1072,17 @@ class J extends w {
|
|
|
822
1072
|
width: s,
|
|
823
1073
|
height: s,
|
|
824
1074
|
format: "rgba32float",
|
|
825
|
-
usage:
|
|
1075
|
+
usage: g.SAMPLE | g.COPY_DST
|
|
826
1076
|
}), this.biasAndStrengthTexture = i.createTexture({
|
|
827
1077
|
width: s,
|
|
828
1078
|
height: s,
|
|
829
1079
|
format: "rgba32float",
|
|
830
|
-
usage:
|
|
1080
|
+
usage: g.SAMPLE | g.COPY_DST
|
|
831
1081
|
}), this.randomDistanceTexture = i.createTexture({
|
|
832
1082
|
width: s,
|
|
833
1083
|
height: s,
|
|
834
1084
|
format: "rgba32float",
|
|
835
|
-
usage:
|
|
1085
|
+
usage: g.SAMPLE | g.COPY_DST
|
|
836
1086
|
})), this.indicesTexture.copyImageData({
|
|
837
1087
|
data: this.indices,
|
|
838
1088
|
bytesPerRow: T("rgba32float", s),
|
|
@@ -851,13 +1101,13 @@ class J extends w {
|
|
|
851
1101
|
mipLevel: 0,
|
|
852
1102
|
x: 0,
|
|
853
1103
|
y: 0
|
|
854
|
-
}), this.previousMaxPointDegree !== void 0 && this.previousMaxPointDegree !== this.maxPointDegree && ((
|
|
1104
|
+
}), this.previousMaxPointDegree !== void 0 && this.previousMaxPointDegree !== this.maxPointDegree && ((u = this.runCommand) == null || u.destroy(), this.runCommand = void 0), this.previousMaxPointDegree = this.maxPointDegree, this.previousPointsTextureSize = o, this.previousLinksTextureSize = s;
|
|
855
1105
|
}
|
|
856
1106
|
initPrograms() {
|
|
857
1107
|
const { device: t, store: i, points: o } = this;
|
|
858
1108
|
!o || !i.pointsTextureSize || !i.linksTextureSize || !this.linkFirstIndicesAndAmountTexture || !this.indicesTexture || !this.biasAndStrengthTexture || !this.randomDistanceTexture || (this.vertexCoordBuffer || (this.vertexCoordBuffer = t.createBuffer({
|
|
859
1109
|
data: new Float32Array([-1, -1, 1, -1, -1, 1, 1, 1])
|
|
860
|
-
})), this.uniformStore || (this.uniformStore = new
|
|
1110
|
+
})), this.uniformStore || (this.uniformStore = new R({
|
|
861
1111
|
forceLinkUniforms: {
|
|
862
1112
|
uniformTypes: {
|
|
863
1113
|
linkSpring: "f32",
|
|
@@ -868,9 +1118,9 @@ class J extends w {
|
|
|
868
1118
|
alpha: "f32"
|
|
869
1119
|
}
|
|
870
1120
|
}
|
|
871
|
-
})), this.runCommand || (this.runCommand = new
|
|
872
|
-
fs:
|
|
873
|
-
vs:
|
|
1121
|
+
})), this.runCommand || (this.runCommand = new x(t, {
|
|
1122
|
+
fs: ze(this.maxPointDegree),
|
|
1123
|
+
vs: D,
|
|
874
1124
|
topology: "triangle-strip",
|
|
875
1125
|
vertexCount: 4,
|
|
876
1126
|
attributes: {
|
|
@@ -900,9 +1150,9 @@ class J extends w {
|
|
|
900
1150
|
return;
|
|
901
1151
|
this.uniformStore.setUniforms({
|
|
902
1152
|
forceLinkUniforms: {
|
|
903
|
-
linkSpring: this.config.simulationLinkSpring
|
|
904
|
-
linkDistance: this.config.simulationLinkDistance
|
|
905
|
-
linkDistRandomVariationRange:
|
|
1153
|
+
linkSpring: this.config.simulationLinkSpring,
|
|
1154
|
+
linkDistance: this.config.simulationLinkDistance,
|
|
1155
|
+
linkDistRandomVariationRange: _(this.config.simulationLinkDistRandomVariationRange, [0, 0]),
|
|
906
1156
|
pointsTextureSize: i.pointsTextureSize,
|
|
907
1157
|
linksTextureSize: i.linksTextureSize,
|
|
908
1158
|
alpha: i.alpha
|
|
@@ -929,7 +1179,7 @@ class J extends w {
|
|
|
929
1179
|
(t = this.runCommand) == null || t.destroy(), this.runCommand = void 0, this.linkFirstIndicesAndAmountTexture && !this.linkFirstIndicesAndAmountTexture.destroyed && this.linkFirstIndicesAndAmountTexture.destroy(), this.linkFirstIndicesAndAmountTexture = void 0, this.indicesTexture && !this.indicesTexture.destroyed && this.indicesTexture.destroy(), this.indicesTexture = void 0, this.biasAndStrengthTexture && !this.biasAndStrengthTexture.destroyed && this.biasAndStrengthTexture.destroy(), this.biasAndStrengthTexture = void 0, this.randomDistanceTexture && !this.randomDistanceTexture.destroyed && this.randomDistanceTexture.destroy(), this.randomDistanceTexture = void 0, (i = this.uniformStore) == null || i.destroy(), this.uniformStore = void 0, this.vertexCoordBuffer && !this.vertexCoordBuffer.destroyed && this.vertexCoordBuffer.destroy(), this.vertexCoordBuffer = void 0;
|
|
930
1180
|
}
|
|
931
1181
|
}
|
|
932
|
-
const
|
|
1182
|
+
const ke = `#version 300 es
|
|
933
1183
|
precision highp float;
|
|
934
1184
|
|
|
935
1185
|
in vec4 vColor;
|
|
@@ -937,7 +1187,7 @@ out vec4 fragColor;
|
|
|
937
1187
|
|
|
938
1188
|
void main() {
|
|
939
1189
|
fragColor = vColor;
|
|
940
|
-
}`,
|
|
1190
|
+
}`, we = `#version 300 es
|
|
941
1191
|
precision highp float;
|
|
942
1192
|
|
|
943
1193
|
uniform sampler2D positionsTexture;
|
|
@@ -973,7 +1223,7 @@ void main() {
|
|
|
973
1223
|
|
|
974
1224
|
gl_Position = vec4(levelPosition, 0.0, 1.0);
|
|
975
1225
|
gl_PointSize = 1.0;
|
|
976
|
-
}`,
|
|
1226
|
+
}`, Ve = `#version 300 es
|
|
977
1227
|
precision highp float;
|
|
978
1228
|
|
|
979
1229
|
uniform sampler2D positionsTexture;
|
|
@@ -1110,7 +1360,7 @@ void main() {
|
|
|
1110
1360
|
}
|
|
1111
1361
|
|
|
1112
1362
|
fragColor = velocity;
|
|
1113
|
-
}`,
|
|
1363
|
+
}`, He = `#version 300 es
|
|
1114
1364
|
precision highp float;
|
|
1115
1365
|
|
|
1116
1366
|
uniform sampler2D positionsTexture;
|
|
@@ -1171,7 +1421,7 @@ void main() {
|
|
|
1171
1421
|
|
|
1172
1422
|
fragColor = velocity;
|
|
1173
1423
|
}`;
|
|
1174
|
-
class
|
|
1424
|
+
class Xe extends w {
|
|
1175
1425
|
constructor() {
|
|
1176
1426
|
super(...arguments), this.levels = 0, this.levelTargets = /* @__PURE__ */ new Map();
|
|
1177
1427
|
}
|
|
@@ -1181,40 +1431,40 @@ class Le extends w {
|
|
|
1181
1431
|
if (!i.pointsTextureSize) return;
|
|
1182
1432
|
this.levels = Math.log2(i.adjustedSpaceSize);
|
|
1183
1433
|
for (let a = 0; a < this.levels; a += 1) {
|
|
1184
|
-
const
|
|
1185
|
-
if (
|
|
1186
|
-
|
|
1187
|
-
data: new Float32Array(
|
|
1188
|
-
bytesPerRow: T("rgba32float",
|
|
1434
|
+
const d = Math.pow(2, a + 1), l = this.levelTargets.get(a);
|
|
1435
|
+
if (l && l.texture.width === d && l.texture.height === d) {
|
|
1436
|
+
l.texture.copyImageData({
|
|
1437
|
+
data: new Float32Array(d * d * 4).fill(0),
|
|
1438
|
+
bytesPerRow: T("rgba32float", d),
|
|
1189
1439
|
mipLevel: 0,
|
|
1190
1440
|
x: 0,
|
|
1191
1441
|
y: 0
|
|
1192
1442
|
});
|
|
1193
1443
|
continue;
|
|
1194
1444
|
}
|
|
1195
|
-
|
|
1445
|
+
l && (l.fbo.destroyed || l.fbo.destroy(), l.texture.destroyed || l.texture.destroy());
|
|
1196
1446
|
const c = t.createTexture({
|
|
1197
|
-
width:
|
|
1198
|
-
height:
|
|
1447
|
+
width: d,
|
|
1448
|
+
height: d,
|
|
1199
1449
|
format: "rgba32float",
|
|
1200
|
-
usage:
|
|
1450
|
+
usage: g.SAMPLE | g.RENDER | g.COPY_DST
|
|
1201
1451
|
});
|
|
1202
1452
|
c.copyImageData({
|
|
1203
|
-
data: new Float32Array(
|
|
1204
|
-
bytesPerRow: T("rgba32float",
|
|
1453
|
+
data: new Float32Array(d * d * 4).fill(0),
|
|
1454
|
+
bytesPerRow: T("rgba32float", d),
|
|
1205
1455
|
mipLevel: 0,
|
|
1206
1456
|
x: 0,
|
|
1207
1457
|
y: 0
|
|
1208
1458
|
});
|
|
1209
1459
|
const f = t.createFramebuffer({
|
|
1210
|
-
width:
|
|
1211
|
-
height:
|
|
1460
|
+
width: d,
|
|
1461
|
+
height: d,
|
|
1212
1462
|
colorAttachments: [c]
|
|
1213
1463
|
});
|
|
1214
1464
|
this.levelTargets.set(a, { texture: c, fbo: f });
|
|
1215
1465
|
}
|
|
1216
|
-
for (const [a,
|
|
1217
|
-
a >= this.levels && (
|
|
1466
|
+
for (const [a, d] of Array.from(this.levelTargets.entries()))
|
|
1467
|
+
a >= this.levels && (d.fbo.destroyed || d.fbo.destroy(), d.texture.destroyed || d.texture.destroy(), this.levelTargets.delete(a));
|
|
1218
1468
|
const o = i.pointsTextureSize * i.pointsTextureSize, s = new Float32Array(o * 4);
|
|
1219
1469
|
for (let a = 0; a < o; ++a)
|
|
1220
1470
|
s[a * 4] = i.getRandomFloat(-1, 1) * 1e-5, s[a * 4 + 1] = i.getRandomFloat(-1, 1) * 1e-5;
|
|
@@ -1222,7 +1472,7 @@ class Le extends w {
|
|
|
1222
1472
|
width: i.pointsTextureSize,
|
|
1223
1473
|
height: i.pointsTextureSize,
|
|
1224
1474
|
format: "rgba32float",
|
|
1225
|
-
usage:
|
|
1475
|
+
usage: g.SAMPLE | g.COPY_DST
|
|
1226
1476
|
})), this.randomValuesTexture.copyImageData({
|
|
1227
1477
|
data: s,
|
|
1228
1478
|
bytesPerRow: T("rgba32float", i.pointsTextureSize),
|
|
@@ -1243,7 +1493,7 @@ class Le extends w {
|
|
|
1243
1493
|
}
|
|
1244
1494
|
initPrograms() {
|
|
1245
1495
|
const { device: t, store: i, data: o, points: s } = this;
|
|
1246
|
-
!o.pointsNumber || !s || !i.pointsTextureSize || (this.calculateLevelsUniformStore || (this.calculateLevelsUniformStore = new
|
|
1496
|
+
!o.pointsNumber || !s || !i.pointsTextureSize || (this.calculateLevelsUniformStore || (this.calculateLevelsUniformStore = new R({
|
|
1247
1497
|
calculateLevelsUniforms: {
|
|
1248
1498
|
uniformTypes: {
|
|
1249
1499
|
pointsTextureSize: "f32",
|
|
@@ -1256,9 +1506,9 @@ class Le extends w {
|
|
|
1256
1506
|
cellSize: 0
|
|
1257
1507
|
}
|
|
1258
1508
|
}
|
|
1259
|
-
})), this.calculateLevelsCommand || (this.calculateLevelsCommand = new
|
|
1260
|
-
fs:
|
|
1261
|
-
vs:
|
|
1509
|
+
})), this.calculateLevelsCommand || (this.calculateLevelsCommand = new x(t, {
|
|
1510
|
+
fs: ke,
|
|
1511
|
+
vs: we,
|
|
1262
1512
|
topology: "point-list",
|
|
1263
1513
|
vertexCount: o.pointsNumber,
|
|
1264
1514
|
attributes: {
|
|
@@ -1287,7 +1537,7 @@ class Le extends w {
|
|
|
1287
1537
|
depthWriteEnabled: !1,
|
|
1288
1538
|
depthCompare: "always"
|
|
1289
1539
|
}
|
|
1290
|
-
})), this.forceUniformStore || (this.forceUniformStore = new
|
|
1540
|
+
})), this.forceUniformStore || (this.forceUniformStore = new R({
|
|
1291
1541
|
forceUniforms: {
|
|
1292
1542
|
uniformTypes: {
|
|
1293
1543
|
level: "f32",
|
|
@@ -1303,16 +1553,16 @@ class Le extends w {
|
|
|
1303
1553
|
levels: this.levels,
|
|
1304
1554
|
levelTextureSize: 0,
|
|
1305
1555
|
alpha: i.alpha,
|
|
1306
|
-
repulsion: this.config.simulationRepulsion
|
|
1307
|
-
spaceSize: i.adjustedSpaceSize
|
|
1308
|
-
theta: this.config.simulationRepulsionTheta
|
|
1556
|
+
repulsion: this.config.simulationRepulsion,
|
|
1557
|
+
spaceSize: i.adjustedSpaceSize,
|
|
1558
|
+
theta: this.config.simulationRepulsionTheta
|
|
1309
1559
|
}
|
|
1310
1560
|
}
|
|
1311
1561
|
})), this.forceVertexCoordBuffer || (this.forceVertexCoordBuffer = t.createBuffer({
|
|
1312
1562
|
data: new Float32Array([-1, -1, 1, -1, -1, 1, 1, 1])
|
|
1313
|
-
})), this.forceCommand || (this.forceCommand = new
|
|
1314
|
-
fs:
|
|
1315
|
-
vs:
|
|
1563
|
+
})), this.forceCommand || (this.forceCommand = new x(t, {
|
|
1564
|
+
fs: Ve,
|
|
1565
|
+
vs: D,
|
|
1316
1566
|
topology: "triangle-strip",
|
|
1317
1567
|
vertexCount: 4,
|
|
1318
1568
|
attributes: {
|
|
@@ -1341,7 +1591,7 @@ class Le extends w {
|
|
|
1341
1591
|
depthWriteEnabled: !1,
|
|
1342
1592
|
depthCompare: "always"
|
|
1343
1593
|
}
|
|
1344
|
-
})), this.forceCenterUniformStore || (this.forceCenterUniformStore = new
|
|
1594
|
+
})), this.forceCenterUniformStore || (this.forceCenterUniformStore = new R({
|
|
1345
1595
|
forceCenterUniforms: {
|
|
1346
1596
|
uniformTypes: {
|
|
1347
1597
|
levelTextureSize: "f32",
|
|
@@ -1351,12 +1601,12 @@ class Le extends w {
|
|
|
1351
1601
|
defaultUniforms: {
|
|
1352
1602
|
levelTextureSize: 0,
|
|
1353
1603
|
alpha: i.alpha,
|
|
1354
|
-
repulsion: this.config.simulationRepulsion
|
|
1604
|
+
repulsion: this.config.simulationRepulsion
|
|
1355
1605
|
}
|
|
1356
1606
|
}
|
|
1357
|
-
})), this.forceFromItsOwnCentermassCommand || (this.forceFromItsOwnCentermassCommand = new
|
|
1358
|
-
fs:
|
|
1359
|
-
vs:
|
|
1607
|
+
})), this.forceFromItsOwnCentermassCommand || (this.forceFromItsOwnCentermassCommand = new x(t, {
|
|
1608
|
+
fs: He,
|
|
1609
|
+
vs: D,
|
|
1360
1610
|
topology: "triangle-strip",
|
|
1361
1611
|
vertexCount: 4,
|
|
1362
1612
|
attributes: {
|
|
@@ -1410,21 +1660,21 @@ class Le extends w {
|
|
|
1410
1660
|
for (let n = 0; n < this.levels; n += 1) {
|
|
1411
1661
|
const r = this.levelTargets.get(n);
|
|
1412
1662
|
if (!r || r.fbo.destroyed || r.texture.destroyed) continue;
|
|
1413
|
-
const a = Math.pow(2, n + 1),
|
|
1663
|
+
const a = Math.pow(2, n + 1), d = i.adjustedSpaceSize / a;
|
|
1414
1664
|
this.calculateLevelsUniformStore.setUniforms({
|
|
1415
1665
|
calculateLevelsUniforms: {
|
|
1416
1666
|
pointsTextureSize: i.pointsTextureSize ?? 0,
|
|
1417
1667
|
levelTextureSize: a,
|
|
1418
|
-
cellSize:
|
|
1668
|
+
cellSize: d
|
|
1419
1669
|
}
|
|
1420
1670
|
}), this.calculateLevelsCommand.setVertexCount(o.pointsNumber), this.calculateLevelsCommand.setBindings({
|
|
1421
1671
|
positionsTexture: s.previousPositionTexture
|
|
1422
1672
|
});
|
|
1423
|
-
const
|
|
1673
|
+
const l = t.beginRenderPass({
|
|
1424
1674
|
framebuffer: r.fbo,
|
|
1425
1675
|
clearColor: [0, 0, 0, 0]
|
|
1426
1676
|
});
|
|
1427
|
-
this.calculateLevelsCommand.draw(
|
|
1677
|
+
this.calculateLevelsCommand.draw(l), l.end();
|
|
1428
1678
|
}
|
|
1429
1679
|
}
|
|
1430
1680
|
drawForces() {
|
|
@@ -1444,9 +1694,9 @@ class Le extends w {
|
|
|
1444
1694
|
levels: this.levels,
|
|
1445
1695
|
levelTextureSize: a,
|
|
1446
1696
|
alpha: i.alpha,
|
|
1447
|
-
repulsion: this.config.simulationRepulsion
|
|
1448
|
-
spaceSize: i.adjustedSpaceSize
|
|
1449
|
-
theta: this.config.simulationRepulsionTheta
|
|
1697
|
+
repulsion: this.config.simulationRepulsion,
|
|
1698
|
+
spaceSize: i.adjustedSpaceSize,
|
|
1699
|
+
theta: this.config.simulationRepulsionTheta
|
|
1450
1700
|
}
|
|
1451
1701
|
}), this.forceCommand.setBindings({
|
|
1452
1702
|
positionsTexture: o.previousPositionTexture,
|
|
@@ -1455,7 +1705,7 @@ class Le extends w {
|
|
|
1455
1705
|
forceCenterUniforms: {
|
|
1456
1706
|
levelTextureSize: a,
|
|
1457
1707
|
alpha: i.alpha,
|
|
1458
|
-
repulsion: this.config.simulationRepulsion
|
|
1708
|
+
repulsion: this.config.simulationRepulsion
|
|
1459
1709
|
}
|
|
1460
1710
|
}), this.forceFromItsOwnCentermassCommand.setBindings({
|
|
1461
1711
|
positionsTexture: o.previousPositionTexture,
|
|
@@ -1466,7 +1716,7 @@ class Le extends w {
|
|
|
1466
1716
|
s.end();
|
|
1467
1717
|
}
|
|
1468
1718
|
}
|
|
1469
|
-
const
|
|
1719
|
+
const We = `#version 300 es
|
|
1470
1720
|
precision highp float;
|
|
1471
1721
|
|
|
1472
1722
|
uniform sampler2D positionsTexture;
|
|
@@ -1501,21 +1751,21 @@ void main() {
|
|
|
1501
1751
|
|
|
1502
1752
|
fragColor = velocity;
|
|
1503
1753
|
}`;
|
|
1504
|
-
class
|
|
1754
|
+
class Ye extends w {
|
|
1505
1755
|
initPrograms() {
|
|
1506
1756
|
const { device: t, points: i } = this;
|
|
1507
1757
|
i && (this.vertexCoordBuffer || (this.vertexCoordBuffer = t.createBuffer({
|
|
1508
1758
|
data: new Float32Array([-1, -1, 1, -1, -1, 1, 1, 1])
|
|
1509
|
-
})), this.uniformStore || (this.uniformStore = new
|
|
1759
|
+
})), this.uniformStore || (this.uniformStore = new R({
|
|
1510
1760
|
forceMouseUniforms: {
|
|
1511
1761
|
uniformTypes: {
|
|
1512
1762
|
repulsion: "f32",
|
|
1513
1763
|
mousePos: "vec2<f32>"
|
|
1514
1764
|
}
|
|
1515
1765
|
}
|
|
1516
|
-
})), this.runCommand || (this.runCommand = new
|
|
1517
|
-
fs:
|
|
1518
|
-
vs:
|
|
1766
|
+
})), this.runCommand || (this.runCommand = new x(t, {
|
|
1767
|
+
fs: We,
|
|
1768
|
+
vs: D,
|
|
1519
1769
|
topology: "triangle-strip",
|
|
1520
1770
|
vertexCount: 4,
|
|
1521
1771
|
attributes: {
|
|
@@ -1544,8 +1794,8 @@ class qe extends w {
|
|
|
1544
1794
|
if (!i || !this.runCommand || !this.uniformStore || !i.previousPositionTexture || i.previousPositionTexture.destroyed || !i.velocityFbo || i.velocityFbo.destroyed) return;
|
|
1545
1795
|
this.uniformStore.setUniforms({
|
|
1546
1796
|
forceMouseUniforms: {
|
|
1547
|
-
repulsion: this.config.simulationRepulsionFromMouse
|
|
1548
|
-
mousePos:
|
|
1797
|
+
repulsion: this.config.simulationRepulsionFromMouse,
|
|
1798
|
+
mousePos: _(o.mousePosition, [0, 0])
|
|
1549
1799
|
}
|
|
1550
1800
|
}), this.runCommand.setBindings({
|
|
1551
1801
|
positionsTexture: i.previousPositionTexture
|
|
@@ -1565,7 +1815,7 @@ class qe extends w {
|
|
|
1565
1815
|
(t = this.runCommand) == null || t.destroy(), this.runCommand = void 0, (i = this.uniformStore) == null || i.destroy(), this.uniformStore = void 0, this.vertexCoordBuffer && !this.vertexCoordBuffer.destroyed && this.vertexCoordBuffer.destroy(), this.vertexCoordBuffer = void 0;
|
|
1566
1816
|
}
|
|
1567
1817
|
}
|
|
1568
|
-
const
|
|
1818
|
+
const Le = `#version 300 es
|
|
1569
1819
|
#ifdef GL_ES
|
|
1570
1820
|
precision highp float;
|
|
1571
1821
|
#endif
|
|
@@ -1576,7 +1826,7 @@ out vec4 fragColor;
|
|
|
1576
1826
|
|
|
1577
1827
|
void main() {
|
|
1578
1828
|
fragColor = rgba;
|
|
1579
|
-
}`,
|
|
1829
|
+
}`, Ke = `#version 300 es
|
|
1580
1830
|
#ifdef GL_ES
|
|
1581
1831
|
precision highp float;
|
|
1582
1832
|
#endif
|
|
@@ -1614,7 +1864,7 @@ void main() {
|
|
|
1614
1864
|
gl_Position = vec4(xy, 0.0, 1.0);
|
|
1615
1865
|
gl_PointSize = 1.0;
|
|
1616
1866
|
}
|
|
1617
|
-
`,
|
|
1867
|
+
`, Ze = `#version 300 es
|
|
1618
1868
|
#ifdef GL_ES
|
|
1619
1869
|
precision highp float;
|
|
1620
1870
|
#endif
|
|
@@ -1669,33 +1919,37 @@ void main() {
|
|
|
1669
1919
|
|
|
1670
1920
|
fragColor = velocity;
|
|
1671
1921
|
}`;
|
|
1672
|
-
class
|
|
1922
|
+
class je extends w {
|
|
1923
|
+
constructor() {
|
|
1924
|
+
super(...arguments), this.cachedCentroidPositions = null;
|
|
1925
|
+
}
|
|
1673
1926
|
create() {
|
|
1674
|
-
var f,
|
|
1927
|
+
var f, u;
|
|
1928
|
+
this.cachedCentroidPositions = null;
|
|
1675
1929
|
const { device: t, store: i, data: o } = this, { pointsTextureSize: s } = i;
|
|
1676
1930
|
if (o.pointsNumber === void 0 || !o.pointClusters && !o.clusterPositions) return;
|
|
1677
|
-
this.clusterCount = (o.pointClusters ?? []).reduce((
|
|
1678
|
-
const n = this.previousPointsTextureSize !== s || this.previousClustersTextureSize !== this.clustersTextureSize || this.previousClusterCount !== this.clusterCount, r = s * s * 4, a = this.clustersTextureSize * this.clustersTextureSize * 4,
|
|
1931
|
+
this.clusterCount = (o.pointClusters ?? []).reduce((h, p) => p === void 0 || p < 0 ? h : Math.max(h, p), 0) + 1, this.clustersTextureSize = Math.ceil(Math.sqrt(this.clusterCount));
|
|
1932
|
+
const n = this.previousPointsTextureSize !== s || this.previousClustersTextureSize !== this.clustersTextureSize || this.previousClusterCount !== this.clusterCount, r = s * s * 4, a = this.clustersTextureSize * this.clustersTextureSize * 4, d = new Float32Array(r), l = new Float32Array(a).fill(-1), c = new Float32Array(r).fill(1);
|
|
1679
1933
|
if (o.clusterPositions)
|
|
1680
|
-
for (let
|
|
1681
|
-
|
|
1682
|
-
for (let
|
|
1683
|
-
const
|
|
1684
|
-
|
|
1934
|
+
for (let h = 0; h < this.clusterCount; ++h)
|
|
1935
|
+
l[h * 4 + 0] = o.clusterPositions[h * 2 + 0] ?? -1, l[h * 4 + 1] = o.clusterPositions[h * 2 + 1] ?? -1;
|
|
1936
|
+
for (let h = 0; h < o.pointsNumber; ++h) {
|
|
1937
|
+
const p = (f = o.pointClusters) == null ? void 0 : f[h];
|
|
1938
|
+
p === void 0 ? (d[h * 4 + 0] = -1, d[h * 4 + 1] = -1) : (d[h * 4 + 0] = p % this.clustersTextureSize, d[h * 4 + 1] = Math.floor(p / this.clustersTextureSize)), o.clusterStrength && (c[h * 4 + 0] = o.clusterStrength[h] ?? 1);
|
|
1685
1939
|
}
|
|
1686
1940
|
if (!this.clusterTexture || n ? (this.clusterTexture && !this.clusterTexture.destroyed && this.clusterTexture.destroy(), this.clusterTexture = t.createTexture({
|
|
1687
1941
|
width: s,
|
|
1688
1942
|
height: s,
|
|
1689
1943
|
format: "rgba32float",
|
|
1690
|
-
usage:
|
|
1944
|
+
usage: g.SAMPLE | g.RENDER | g.COPY_DST
|
|
1691
1945
|
}), this.clusterTexture.copyImageData({
|
|
1692
|
-
data:
|
|
1946
|
+
data: d,
|
|
1693
1947
|
bytesPerRow: T("rgba32float", s),
|
|
1694
1948
|
mipLevel: 0,
|
|
1695
1949
|
x: 0,
|
|
1696
1950
|
y: 0
|
|
1697
1951
|
})) : this.clusterTexture.copyImageData({
|
|
1698
|
-
data:
|
|
1952
|
+
data: d,
|
|
1699
1953
|
bytesPerRow: T("rgba32float", s),
|
|
1700
1954
|
mipLevel: 0,
|
|
1701
1955
|
x: 0,
|
|
@@ -1704,15 +1958,15 @@ class Ge extends w {
|
|
|
1704
1958
|
width: this.clustersTextureSize,
|
|
1705
1959
|
height: this.clustersTextureSize,
|
|
1706
1960
|
format: "rgba32float",
|
|
1707
|
-
usage:
|
|
1961
|
+
usage: g.SAMPLE | g.RENDER | g.COPY_DST
|
|
1708
1962
|
}), this.clusterPositionsTexture.copyImageData({
|
|
1709
|
-
data:
|
|
1963
|
+
data: l,
|
|
1710
1964
|
bytesPerRow: T("rgba32float", this.clustersTextureSize),
|
|
1711
1965
|
mipLevel: 0,
|
|
1712
1966
|
x: 0,
|
|
1713
1967
|
y: 0
|
|
1714
1968
|
})) : this.clusterPositionsTexture.copyImageData({
|
|
1715
|
-
data:
|
|
1969
|
+
data: l,
|
|
1716
1970
|
bytesPerRow: T("rgba32float", this.clustersTextureSize),
|
|
1717
1971
|
mipLevel: 0,
|
|
1718
1972
|
x: 0,
|
|
@@ -1721,7 +1975,7 @@ class Ge extends w {
|
|
|
1721
1975
|
width: s,
|
|
1722
1976
|
height: s,
|
|
1723
1977
|
format: "rgba32float",
|
|
1724
|
-
usage:
|
|
1978
|
+
usage: g.SAMPLE | g.RENDER | g.COPY_DST
|
|
1725
1979
|
}), this.clusterForceCoefficientTexture.copyImageData({
|
|
1726
1980
|
data: c,
|
|
1727
1981
|
bytesPerRow: T("rgba32float", s),
|
|
@@ -1738,7 +1992,7 @@ class Ge extends w {
|
|
|
1738
1992
|
width: this.clustersTextureSize,
|
|
1739
1993
|
height: this.clustersTextureSize,
|
|
1740
1994
|
format: "rgba32float",
|
|
1741
|
-
usage:
|
|
1995
|
+
usage: g.SAMPLE | g.RENDER | g.COPY_DST
|
|
1742
1996
|
}), this.centermassTexture.copyImageData({
|
|
1743
1997
|
data: new Float32Array(a).fill(0),
|
|
1744
1998
|
bytesPerRow: T("rgba32float", this.clustersTextureSize),
|
|
@@ -1757,11 +2011,11 @@ class Ge extends w {
|
|
|
1757
2011
|
y: 0
|
|
1758
2012
|
}), !this.pointIndices || this.previousPointsTextureSize !== s) {
|
|
1759
2013
|
this.pointIndices && !this.pointIndices.destroyed && this.pointIndices.destroy();
|
|
1760
|
-
const
|
|
2014
|
+
const h = X(i.pointsTextureSize);
|
|
1761
2015
|
this.pointIndices = t.createBuffer({
|
|
1762
|
-
data:
|
|
2016
|
+
data: h,
|
|
1763
2017
|
usage: S.VERTEX | S.COPY_DST
|
|
1764
|
-
}), (
|
|
2018
|
+
}), (u = this.calculateCentermassCommand) == null || u.setAttributes({
|
|
1765
2019
|
pointIndices: this.pointIndices
|
|
1766
2020
|
});
|
|
1767
2021
|
}
|
|
@@ -1769,7 +2023,7 @@ class Ge extends w {
|
|
|
1769
2023
|
}
|
|
1770
2024
|
initPrograms() {
|
|
1771
2025
|
const { device: t, store: i, data: o } = this;
|
|
1772
|
-
o.pointsNumber === void 0 || !o.pointClusters && !o.clusterPositions || (this.calculateCentermassUniformStore || (this.calculateCentermassUniformStore = new
|
|
2026
|
+
o.pointsNumber === void 0 || !o.pointClusters && !o.clusterPositions || (this.calculateCentermassUniformStore || (this.calculateCentermassUniformStore = new R({
|
|
1773
2027
|
calculateCentermassUniforms: {
|
|
1774
2028
|
uniformTypes: {
|
|
1775
2029
|
pointsTextureSize: "f32",
|
|
@@ -1780,9 +2034,9 @@ class Ge extends w {
|
|
|
1780
2034
|
clustersTextureSize: this.clustersTextureSize ?? 0
|
|
1781
2035
|
}
|
|
1782
2036
|
}
|
|
1783
|
-
})), this.calculateCentermassCommand || (this.calculateCentermassCommand = new
|
|
1784
|
-
fs:
|
|
1785
|
-
vs:
|
|
2037
|
+
})), this.calculateCentermassCommand || (this.calculateCentermassCommand = new x(t, {
|
|
2038
|
+
fs: Le,
|
|
2039
|
+
vs: Ke,
|
|
1786
2040
|
topology: "point-list",
|
|
1787
2041
|
vertexCount: o.pointsNumber ?? 0,
|
|
1788
2042
|
attributes: {
|
|
@@ -1813,7 +2067,7 @@ class Ge extends w {
|
|
|
1813
2067
|
depthWriteEnabled: !1,
|
|
1814
2068
|
depthCompare: "always"
|
|
1815
2069
|
}
|
|
1816
|
-
})), this.applyForcesUniformStore || (this.applyForcesUniformStore = new
|
|
2070
|
+
})), this.applyForcesUniformStore || (this.applyForcesUniformStore = new R({
|
|
1817
2071
|
applyForcesUniforms: {
|
|
1818
2072
|
uniformTypes: {
|
|
1819
2073
|
alpha: "f32",
|
|
@@ -1823,14 +2077,14 @@ class Ge extends w {
|
|
|
1823
2077
|
defaultUniforms: {
|
|
1824
2078
|
alpha: i.alpha,
|
|
1825
2079
|
clustersTextureSize: this.clustersTextureSize ?? 0,
|
|
1826
|
-
clusterCoefficient: this.config.simulationCluster
|
|
2080
|
+
clusterCoefficient: this.config.simulationCluster
|
|
1827
2081
|
}
|
|
1828
2082
|
}
|
|
1829
2083
|
})), this.applyForcesVertexCoordBuffer || (this.applyForcesVertexCoordBuffer = t.createBuffer({
|
|
1830
2084
|
data: new Float32Array([-1, -1, 1, -1, -1, 1, 1, 1])
|
|
1831
|
-
})), this.applyForcesCommand || (this.applyForcesCommand = new
|
|
1832
|
-
fs:
|
|
1833
|
-
vs:
|
|
2085
|
+
})), this.applyForcesCommand || (this.applyForcesCommand = new x(t, {
|
|
2086
|
+
fs: Ze,
|
|
2087
|
+
vs: D,
|
|
1834
2088
|
topology: "triangle-strip",
|
|
1835
2089
|
vertexCount: 4,
|
|
1836
2090
|
attributes: {
|
|
@@ -1870,6 +2124,21 @@ class Ge extends w {
|
|
|
1870
2124
|
});
|
|
1871
2125
|
this.calculateCentermassCommand.draw(o), o.end();
|
|
1872
2126
|
}
|
|
2127
|
+
/** Do not mutate the returned array; it may be the internal cache. */
|
|
2128
|
+
getCentroidPositions() {
|
|
2129
|
+
var r;
|
|
2130
|
+
const { config: { enableSimulation: t }, store: { isSimulationRunning: i } } = this, o = !t || !i;
|
|
2131
|
+
if (o && ((r = this.points) != null && r.areClusterCentroidsUpToDate) && this.cachedCentroidPositions)
|
|
2132
|
+
return this.cachedCentroidPositions;
|
|
2133
|
+
if (this.calculateCentermass(), !this.centermassFbo || this.centermassFbo.destroyed || this.clusterCount === void 0) return [];
|
|
2134
|
+
const s = I(this.device, this.centermassFbo), n = [];
|
|
2135
|
+
n.length = this.clusterCount * 2;
|
|
2136
|
+
for (let a = 0; a < n.length / 2; a += 1) {
|
|
2137
|
+
const d = s[a * 4 + 0], l = s[a * 4 + 1], c = s[a * 4 + 2];
|
|
2138
|
+
d !== void 0 && l !== void 0 && c !== void 0 && (n[a * 2] = d / c, n[a * 2 + 1] = l / c);
|
|
2139
|
+
}
|
|
2140
|
+
return o && this.points && (this.cachedCentroidPositions = n, this.points.areClusterCentroidsUpToDate = !0), n;
|
|
2141
|
+
}
|
|
1873
2142
|
run() {
|
|
1874
2143
|
var i;
|
|
1875
2144
|
if (!this.data.pointClusters && !this.data.clusterPositions || (this.calculateCentermass(), !this.applyForcesCommand || !this.applyForcesUniformStore) || !this.clusterTexture || this.clusterTexture.destroyed || !this.centermassTexture || this.centermassTexture.destroyed || !this.clusterPositionsTexture || this.clusterPositionsTexture.destroyed || !this.clusterForceCoefficientTexture || this.clusterForceCoefficientTexture.destroyed || !((i = this.points) != null && i.previousPositionTexture) || this.points.previousPositionTexture.destroyed || !this.points.velocityFbo || this.points.velocityFbo.destroyed) return;
|
|
@@ -1877,7 +2146,7 @@ class Ge extends w {
|
|
|
1877
2146
|
applyForcesUniforms: {
|
|
1878
2147
|
alpha: this.store.alpha,
|
|
1879
2148
|
clustersTextureSize: this.clustersTextureSize ?? 0,
|
|
1880
|
-
clusterCoefficient: this.config.simulationCluster
|
|
2149
|
+
clusterCoefficient: this.config.simulationCluster
|
|
1881
2150
|
}
|
|
1882
2151
|
}), this.applyForcesCommand.setBindings({
|
|
1883
2152
|
clusterTexture: this.clusterTexture,
|
|
@@ -1898,10 +2167,10 @@ class Ge extends w {
|
|
|
1898
2167
|
*/
|
|
1899
2168
|
destroy() {
|
|
1900
2169
|
var t, i, o, s;
|
|
1901
|
-
(t = this.calculateCentermassCommand) == null || t.destroy(), this.calculateCentermassCommand = void 0, (i = this.applyForcesCommand) == null || i.destroy(), this.applyForcesCommand = void 0, this.centermassFbo && !this.centermassFbo.destroyed && this.centermassFbo.destroy(), this.centermassFbo = void 0, this.clusterTexture && !this.clusterTexture.destroyed && this.clusterTexture.destroy(), this.clusterTexture = void 0, this.clusterPositionsTexture && !this.clusterPositionsTexture.destroyed && this.clusterPositionsTexture.destroy(), this.clusterPositionsTexture = void 0, this.clusterForceCoefficientTexture && !this.clusterForceCoefficientTexture.destroyed && this.clusterForceCoefficientTexture.destroy(), this.clusterForceCoefficientTexture = void 0, this.centermassTexture && !this.centermassTexture.destroyed && this.centermassTexture.destroy(), this.centermassTexture = void 0, (o = this.calculateCentermassUniformStore) == null || o.destroy(), this.calculateCentermassUniformStore = void 0, (s = this.applyForcesUniformStore) == null || s.destroy(), this.applyForcesUniformStore = void 0, this.pointIndices && !this.pointIndices.destroyed && this.pointIndices.destroy(), this.pointIndices = void 0, this.applyForcesVertexCoordBuffer && !this.applyForcesVertexCoordBuffer.destroyed && this.applyForcesVertexCoordBuffer.destroy(), this.applyForcesVertexCoordBuffer = void 0;
|
|
2170
|
+
this.cachedCentroidPositions = null, (t = this.calculateCentermassCommand) == null || t.destroy(), this.calculateCentermassCommand = void 0, (i = this.applyForcesCommand) == null || i.destroy(), this.applyForcesCommand = void 0, this.centermassFbo && !this.centermassFbo.destroyed && this.centermassFbo.destroy(), this.centermassFbo = void 0, this.clusterTexture && !this.clusterTexture.destroyed && this.clusterTexture.destroy(), this.clusterTexture = void 0, this.clusterPositionsTexture && !this.clusterPositionsTexture.destroyed && this.clusterPositionsTexture.destroy(), this.clusterPositionsTexture = void 0, this.clusterForceCoefficientTexture && !this.clusterForceCoefficientTexture.destroyed && this.clusterForceCoefficientTexture.destroy(), this.clusterForceCoefficientTexture = void 0, this.centermassTexture && !this.centermassTexture.destroyed && this.centermassTexture.destroy(), this.centermassTexture = void 0, (o = this.calculateCentermassUniformStore) == null || o.destroy(), this.calculateCentermassUniformStore = void 0, (s = this.applyForcesUniformStore) == null || s.destroy(), this.applyForcesUniformStore = void 0, this.pointIndices && !this.pointIndices.destroyed && this.pointIndices.destroy(), this.pointIndices = void 0, this.applyForcesVertexCoordBuffer && !this.applyForcesVertexCoordBuffer.destroyed && this.applyForcesVertexCoordBuffer.destroy(), this.applyForcesVertexCoordBuffer = void 0;
|
|
1902
2171
|
}
|
|
1903
2172
|
}
|
|
1904
|
-
const
|
|
2173
|
+
const qe = `
|
|
1905
2174
|
#gl-bench {
|
|
1906
2175
|
position:absolute;
|
|
1907
2176
|
right:0;
|
|
@@ -1954,224 +2223,37 @@ const et = `
|
|
|
1954
2223
|
stroke: #8288e4;
|
|
1955
2224
|
}
|
|
1956
2225
|
`;
|
|
1957
|
-
class
|
|
2226
|
+
class ee {
|
|
1958
2227
|
constructor(t) {
|
|
1959
2228
|
this.destroy();
|
|
1960
2229
|
const i = t.getContext("webgl") || t.getContext("experimental-webgl");
|
|
1961
|
-
this.bench = new
|
|
1962
|
-
}
|
|
1963
|
-
begin() {
|
|
1964
|
-
var t;
|
|
1965
|
-
(t = this.bench) == null || t.begin("frame");
|
|
1966
|
-
}
|
|
1967
|
-
end(t) {
|
|
1968
|
-
var i, o;
|
|
1969
|
-
(i = this.bench) == null || i.end("frame"), (o = this.bench) == null || o.nextFrame(t);
|
|
1970
|
-
}
|
|
1971
|
-
destroy() {
|
|
1972
|
-
this.bench = void 0, z("#gl-bench").remove();
|
|
1973
|
-
}
|
|
1974
|
-
}
|
|
1975
|
-
var tt = /* @__PURE__ */ ((e) => (e[e.Circle = 0] = "Circle", e[e.Square = 1] = "Square", e[e.Triangle = 2] = "Triangle", e[e.Diamond = 3] = "Diamond", e[e.Pentagon = 4] = "Pentagon", e[e.Hexagon = 5] = "Hexagon", e[e.Star = 6] = "Star", e[e.Cross = 7] = "Cross", e[e.None = 8] = "None", e))(tt || {});
|
|
1976
|
-
class it {
|
|
1977
|
-
constructor(t) {
|
|
1978
|
-
this._config = t;
|
|
1979
|
-
}
|
|
1980
|
-
get pointsNumber() {
|
|
1981
|
-
return this.pointPositions && this.pointPositions.length / 2;
|
|
1982
|
-
}
|
|
1983
|
-
get linksNumber() {
|
|
1984
|
-
return this.links && this.links.length / 2;
|
|
1985
|
-
}
|
|
1986
|
-
updatePoints() {
|
|
1987
|
-
this.pointPositions = this.inputPointPositions;
|
|
1988
|
-
}
|
|
1989
|
-
/**
|
|
1990
|
-
* Updates the point colors based on the input data or default config value.
|
|
1991
|
-
*/
|
|
1992
|
-
updatePointColor() {
|
|
1993
|
-
if (this.pointsNumber === void 0) {
|
|
1994
|
-
this.pointColors = void 0;
|
|
1995
|
-
return;
|
|
1996
|
-
}
|
|
1997
|
-
const t = k(this._config.pointDefaultColor ?? this._config.pointColor);
|
|
1998
|
-
if (this.inputPointColors === void 0 || this.inputPointColors.length / 4 !== this.pointsNumber) {
|
|
1999
|
-
this.pointColors = new Float32Array(this.pointsNumber * 4);
|
|
2000
|
-
for (let i = 0; i < this.pointColors.length / 4; i++)
|
|
2001
|
-
this.pointColors[i * 4] = t[0], this.pointColors[i * 4 + 1] = t[1], this.pointColors[i * 4 + 2] = t[2], this.pointColors[i * 4 + 3] = t[3];
|
|
2002
|
-
} else {
|
|
2003
|
-
this.pointColors = this.inputPointColors;
|
|
2004
|
-
for (let i = 0; i < this.pointColors.length / 4; i++)
|
|
2005
|
-
D(this.pointColors[i * 4]) || (this.pointColors[i * 4] = t[0]), D(this.pointColors[i * 4 + 1]) || (this.pointColors[i * 4 + 1] = t[1]), D(this.pointColors[i * 4 + 2]) || (this.pointColors[i * 4 + 2] = t[2]), D(this.pointColors[i * 4 + 3]) || (this.pointColors[i * 4 + 3] = t[3]);
|
|
2006
|
-
}
|
|
2007
|
-
}
|
|
2008
|
-
/**
|
|
2009
|
-
* Updates the point sizes based on the input data or default config value.
|
|
2010
|
-
*/
|
|
2011
|
-
updatePointSize() {
|
|
2012
|
-
if (this.pointsNumber === void 0) {
|
|
2013
|
-
this.pointSizes = void 0;
|
|
2014
|
-
return;
|
|
2015
|
-
}
|
|
2016
|
-
const t = this._config.pointDefaultSize ?? this._config.pointSize;
|
|
2017
|
-
if (this.inputPointSizes === void 0 || this.inputPointSizes.length !== this.pointsNumber)
|
|
2018
|
-
this.pointSizes = new Float32Array(this.pointsNumber).fill(t);
|
|
2019
|
-
else {
|
|
2020
|
-
this.pointSizes = this.inputPointSizes;
|
|
2021
|
-
for (let i = 0; i < this.pointSizes.length; i++)
|
|
2022
|
-
D(this.pointSizes[i]) || (this.pointSizes[i] = t);
|
|
2023
|
-
}
|
|
2024
|
-
}
|
|
2025
|
-
/**
|
|
2026
|
-
* Updates the point shapes based on the input data or default shape.
|
|
2027
|
-
* Default behavior: Circle (0).
|
|
2028
|
-
* Images are rendered above shapes.
|
|
2029
|
-
*/
|
|
2030
|
-
updatePointShape() {
|
|
2031
|
-
if (this.pointsNumber === void 0) {
|
|
2032
|
-
this.pointShapes = void 0;
|
|
2033
|
-
return;
|
|
2034
|
-
}
|
|
2035
|
-
const t = 0;
|
|
2036
|
-
if (this.inputPointShapes === void 0 || this.inputPointShapes.length !== this.pointsNumber)
|
|
2037
|
-
this.pointShapes = new Float32Array(this.pointsNumber).fill(t);
|
|
2038
|
-
else {
|
|
2039
|
-
this.pointShapes = new Float32Array(this.inputPointShapes);
|
|
2040
|
-
const i = this.pointShapes;
|
|
2041
|
-
for (let o = 0; o < i.length; o++) {
|
|
2042
|
-
const s = i[o];
|
|
2043
|
-
(s == null || !D(s) || s < 0 || s > 8) && (i[o] = t);
|
|
2044
|
-
}
|
|
2045
|
-
}
|
|
2046
|
-
}
|
|
2047
|
-
/**
|
|
2048
|
-
* Updates the point image indices based on the input data or default value (-1 for no image).
|
|
2049
|
-
*/
|
|
2050
|
-
updatePointImageIndices() {
|
|
2051
|
-
if (this.pointsNumber === void 0) {
|
|
2052
|
-
this.pointImageIndices = void 0;
|
|
2053
|
-
return;
|
|
2054
|
-
}
|
|
2055
|
-
if (this.inputPointImageIndices === void 0 || this.inputPointImageIndices.length !== this.pointsNumber)
|
|
2056
|
-
this.pointImageIndices = new Float32Array(this.pointsNumber).fill(-1);
|
|
2057
|
-
else {
|
|
2058
|
-
const t = new Float32Array(this.inputPointImageIndices);
|
|
2059
|
-
for (let i = 0; i < t.length; i++) {
|
|
2060
|
-
const o = t[i], s = o === void 0 ? NaN : o;
|
|
2061
|
-
!Number.isFinite(s) || s < 0 ? t[i] = -1 : t[i] = Math.trunc(s);
|
|
2062
|
-
}
|
|
2063
|
-
this.pointImageIndices = t;
|
|
2064
|
-
}
|
|
2065
|
-
}
|
|
2066
|
-
/**
|
|
2067
|
-
* Updates the point image sizes based on the input data or default to point sizes.
|
|
2068
|
-
*/
|
|
2069
|
-
updatePointImageSizes() {
|
|
2070
|
-
var i;
|
|
2071
|
-
if (this.pointsNumber === void 0) {
|
|
2072
|
-
this.pointImageSizes = void 0;
|
|
2073
|
-
return;
|
|
2074
|
-
}
|
|
2075
|
-
const t = this._config.pointDefaultSize ?? this._config.pointSize;
|
|
2076
|
-
if (this.inputPointImageSizes === void 0 || this.inputPointImageSizes.length !== this.pointsNumber)
|
|
2077
|
-
this.pointImageSizes = this.pointSizes ? new Float32Array(this.pointSizes) : new Float32Array(this.pointsNumber).fill(t);
|
|
2078
|
-
else {
|
|
2079
|
-
this.pointImageSizes = new Float32Array(this.inputPointImageSizes);
|
|
2080
|
-
for (let o = 0; o < this.pointImageSizes.length; o++)
|
|
2081
|
-
D(this.pointImageSizes[o]) || (this.pointImageSizes[o] = ((i = this.pointSizes) == null ? void 0 : i[o]) ?? t);
|
|
2082
|
-
}
|
|
2230
|
+
this.bench = new pe(i, { css: qe });
|
|
2083
2231
|
}
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
/**
|
|
2088
|
-
* Updates the link colors based on the input data or default config value.
|
|
2089
|
-
*/
|
|
2090
|
-
updateLinkColor() {
|
|
2091
|
-
if (this.linksNumber === void 0) {
|
|
2092
|
-
this.linkColors = void 0;
|
|
2093
|
-
return;
|
|
2094
|
-
}
|
|
2095
|
-
const t = k(this._config.linkDefaultColor ?? this._config.linkColor);
|
|
2096
|
-
if (this.inputLinkColors === void 0 || this.inputLinkColors.length / 4 !== this.linksNumber) {
|
|
2097
|
-
this.linkColors = new Float32Array(this.linksNumber * 4);
|
|
2098
|
-
for (let i = 0; i < this.linkColors.length / 4; i++)
|
|
2099
|
-
this.linkColors[i * 4] = t[0], this.linkColors[i * 4 + 1] = t[1], this.linkColors[i * 4 + 2] = t[2], this.linkColors[i * 4 + 3] = t[3];
|
|
2100
|
-
} else {
|
|
2101
|
-
this.linkColors = this.inputLinkColors;
|
|
2102
|
-
for (let i = 0; i < this.linkColors.length / 4; i++)
|
|
2103
|
-
D(this.linkColors[i * 4]) || (this.linkColors[i * 4] = t[0]), D(this.linkColors[i * 4 + 1]) || (this.linkColors[i * 4 + 1] = t[1]), D(this.linkColors[i * 4 + 2]) || (this.linkColors[i * 4 + 2] = t[2]), D(this.linkColors[i * 4 + 3]) || (this.linkColors[i * 4 + 3] = t[3]);
|
|
2104
|
-
}
|
|
2105
|
-
}
|
|
2106
|
-
/**
|
|
2107
|
-
* Updates the link width based on the input data or default config value.
|
|
2108
|
-
*/
|
|
2109
|
-
updateLinkWidth() {
|
|
2110
|
-
if (this.linksNumber === void 0) {
|
|
2111
|
-
this.linkWidths = void 0;
|
|
2112
|
-
return;
|
|
2113
|
-
}
|
|
2114
|
-
const t = this._config.linkDefaultWidth ?? this._config.linkWidth;
|
|
2115
|
-
if (this.inputLinkWidths === void 0 || this.inputLinkWidths.length !== this.linksNumber)
|
|
2116
|
-
this.linkWidths = new Float32Array(this.linksNumber).fill(t);
|
|
2117
|
-
else {
|
|
2118
|
-
this.linkWidths = this.inputLinkWidths;
|
|
2119
|
-
for (let i = 0; i < this.linkWidths.length; i++)
|
|
2120
|
-
D(this.linkWidths[i]) || (this.linkWidths[i] = t);
|
|
2121
|
-
}
|
|
2122
|
-
}
|
|
2123
|
-
/**
|
|
2124
|
-
* Updates the link arrows based on the input data or default config value.
|
|
2125
|
-
*/
|
|
2126
|
-
updateArrows() {
|
|
2127
|
-
if (this.linksNumber === void 0) {
|
|
2128
|
-
this.linkArrows = void 0;
|
|
2129
|
-
return;
|
|
2130
|
-
}
|
|
2131
|
-
const t = this._config.linkDefaultArrows ?? this._config.linkArrows;
|
|
2132
|
-
this.linkArrowsBoolean === void 0 || this.linkArrowsBoolean.length !== this.linksNumber ? this.linkArrows = new Array(this.linksNumber).fill(+t) : this.linkArrows = this.linkArrowsBoolean.map((i) => +i);
|
|
2133
|
-
}
|
|
2134
|
-
updateLinkStrength() {
|
|
2135
|
-
this.linksNumber === void 0 && (this.linkStrength = void 0), this.inputLinkStrength === void 0 || this.inputLinkStrength.length !== this.linksNumber ? this.linkStrength = void 0 : this.linkStrength = this.inputLinkStrength;
|
|
2136
|
-
}
|
|
2137
|
-
updateClusters() {
|
|
2138
|
-
if (this.pointsNumber === void 0) {
|
|
2139
|
-
this.pointClusters = void 0, this.clusterPositions = void 0;
|
|
2140
|
-
return;
|
|
2141
|
-
}
|
|
2142
|
-
this.inputPointClusters === void 0 || this.inputPointClusters.length !== this.pointsNumber ? this.pointClusters = void 0 : this.pointClusters = this.inputPointClusters, this.inputClusterPositions === void 0 ? this.clusterPositions = void 0 : this.clusterPositions = this.inputClusterPositions, this.inputClusterStrength === void 0 || this.inputClusterStrength.length !== this.pointsNumber ? this.clusterStrength = void 0 : this.clusterStrength = this.inputClusterStrength;
|
|
2143
|
-
}
|
|
2144
|
-
update() {
|
|
2145
|
-
this.updatePoints(), this.updatePointColor(), this.updatePointSize(), this.updatePointShape(), this.updatePointImageIndices(), this.updatePointImageSizes(), this.updateLinks(), this.updateLinkColor(), this.updateLinkWidth(), this.updateArrows(), this.updateLinkStrength(), this.updateClusters(), this._createAdjacencyLists(), this._calculateDegrees();
|
|
2146
|
-
}
|
|
2147
|
-
getAdjacentIndices(t) {
|
|
2148
|
-
var i, o, s, n;
|
|
2149
|
-
return [...((o = (i = this.sourceIndexToTargetIndices) == null ? void 0 : i[t]) == null ? void 0 : o.map((r) => r[0])) || [], ...((n = (s = this.targetIndexToSourceIndices) == null ? void 0 : s[t]) == null ? void 0 : n.map((r) => r[0])) || []];
|
|
2150
|
-
}
|
|
2151
|
-
_createAdjacencyLists() {
|
|
2152
|
-
var t, i;
|
|
2153
|
-
if (this.linksNumber === void 0 || this.links === void 0) {
|
|
2154
|
-
this.sourceIndexToTargetIndices = void 0, this.targetIndexToSourceIndices = void 0;
|
|
2155
|
-
return;
|
|
2156
|
-
}
|
|
2157
|
-
this.sourceIndexToTargetIndices = new Array(this.pointsNumber).fill(void 0), this.targetIndexToSourceIndices = new Array(this.pointsNumber).fill(void 0);
|
|
2158
|
-
for (let o = 0; o < this.linksNumber; o++) {
|
|
2159
|
-
const s = this.links[o * 2], n = this.links[o * 2 + 1];
|
|
2160
|
-
s !== void 0 && n !== void 0 && (this.sourceIndexToTargetIndices[s] === void 0 && (this.sourceIndexToTargetIndices[s] = []), (t = this.sourceIndexToTargetIndices[s]) == null || t.push([n, o]), this.targetIndexToSourceIndices[n] === void 0 && (this.targetIndexToSourceIndices[n] = []), (i = this.targetIndexToSourceIndices[n]) == null || i.push([s, o]));
|
|
2161
|
-
}
|
|
2232
|
+
begin() {
|
|
2233
|
+
var t;
|
|
2234
|
+
(t = this.bench) == null || t.begin("frame");
|
|
2162
2235
|
}
|
|
2163
|
-
|
|
2164
|
-
var
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
this.degree = new Array(this.pointsNumber).fill(0), this.inDegree = new Array(this.pointsNumber).fill(0), this.outDegree = new Array(this.pointsNumber).fill(0);
|
|
2170
|
-
for (let n = 0; n < this.pointsNumber; n++)
|
|
2171
|
-
this.inDegree[n] = ((i = (t = this.targetIndexToSourceIndices) == null ? void 0 : t[n]) == null ? void 0 : i.length) ?? 0, this.outDegree[n] = ((s = (o = this.sourceIndexToTargetIndices) == null ? void 0 : o[n]) == null ? void 0 : s.length) ?? 0, this.degree[n] = (this.inDegree[n] ?? 0) + (this.outDegree[n] ?? 0);
|
|
2236
|
+
end(t) {
|
|
2237
|
+
var i, o;
|
|
2238
|
+
(i = this.bench) == null || i.end("frame"), (o = this.bench) == null || o.nextFrame(t);
|
|
2239
|
+
}
|
|
2240
|
+
destroy() {
|
|
2241
|
+
this.bench = void 0, b("#gl-bench").remove();
|
|
2172
2242
|
}
|
|
2173
2243
|
}
|
|
2174
|
-
const
|
|
2244
|
+
const Qe = (
|
|
2245
|
+
/* glsl */
|
|
2246
|
+
`
|
|
2247
|
+
vec2 conicParametricCurve(vec2 A, vec2 B, vec2 ControlPoint, float t, float w) {
|
|
2248
|
+
vec2 divident = (1.0 - t) * (1.0 - t) * A + 2.0 * (1.0 - t) * t * w * ControlPoint + t * t * B;
|
|
2249
|
+
float divisor = (1.0 - t) * (1.0 - t) + 2.0 * (1.0 - t) * t * w + t * t;
|
|
2250
|
+
return divident / divisor;
|
|
2251
|
+
}
|
|
2252
|
+
`
|
|
2253
|
+
), te = {
|
|
2254
|
+
name: "conicParametricCurve",
|
|
2255
|
+
vs: Qe
|
|
2256
|
+
}, $e = `#version 300 es
|
|
2175
2257
|
#ifdef GL_ES
|
|
2176
2258
|
precision highp float;
|
|
2177
2259
|
#endif
|
|
@@ -2229,7 +2311,7 @@ void main() {
|
|
|
2229
2311
|
}
|
|
2230
2312
|
} else fragColor = vec4(color, opacity);
|
|
2231
2313
|
|
|
2232
|
-
}`,
|
|
2314
|
+
}`, Je = `#version 300 es
|
|
2233
2315
|
#ifdef GL_ES
|
|
2234
2316
|
precision highp float;
|
|
2235
2317
|
#endif
|
|
@@ -2320,12 +2402,6 @@ float map(float value, float min1, float max1, float min2, float max2) {
|
|
|
2320
2402
|
return min2 + (value - min1) * (max2 - min2) / (max1 - min1);
|
|
2321
2403
|
}
|
|
2322
2404
|
|
|
2323
|
-
vec2 conicParametricCurve(vec2 A, vec2 B, vec2 ControlPoint, float t, float w) {
|
|
2324
|
-
vec2 divident = (1.0 - t) * (1.0 - t) * A + 2.0 * (1.0 - t) * t * w * ControlPoint + t * t * B;
|
|
2325
|
-
float divisor = (1.0 - t) * (1.0 - t) + 2.0 * (1.0 - t) * t * w + t * t;
|
|
2326
|
-
return divident / divisor;
|
|
2327
|
-
}
|
|
2328
|
-
|
|
2329
2405
|
float calculateLinkWidth(float width) {
|
|
2330
2406
|
float linkWidth;
|
|
2331
2407
|
if (scaleLinksOnZoom > 0.0) {
|
|
@@ -2476,7 +2552,100 @@ void main() {
|
|
|
2476
2552
|
#endif
|
|
2477
2553
|
|
|
2478
2554
|
gl_Position = vec4(final.rg, 0, 1);
|
|
2479
|
-
}`,
|
|
2555
|
+
}`, Ge = `#version 300 es
|
|
2556
|
+
#ifdef GL_ES
|
|
2557
|
+
precision highp float;
|
|
2558
|
+
#endif
|
|
2559
|
+
|
|
2560
|
+
in vec4 rgba;
|
|
2561
|
+
|
|
2562
|
+
out vec4 fragColor;
|
|
2563
|
+
|
|
2564
|
+
void main() {
|
|
2565
|
+
fragColor = rgba;
|
|
2566
|
+
}
|
|
2567
|
+
`, et = `#version 300 es
|
|
2568
|
+
#ifdef GL_ES
|
|
2569
|
+
precision highp float;
|
|
2570
|
+
#endif
|
|
2571
|
+
|
|
2572
|
+
in vec2 pointA;
|
|
2573
|
+
in vec2 pointB;
|
|
2574
|
+
in float linkIndices;
|
|
2575
|
+
|
|
2576
|
+
uniform sampler2D positionsTexture;
|
|
2577
|
+
|
|
2578
|
+
#ifdef USE_UNIFORM_BUFFERS
|
|
2579
|
+
layout(std140) uniform fillSampledLinksUniforms {
|
|
2580
|
+
float pointsTextureSize;
|
|
2581
|
+
mat4 transformationMatrix;
|
|
2582
|
+
float spaceSize;
|
|
2583
|
+
vec2 screenSize;
|
|
2584
|
+
float curvedWeight;
|
|
2585
|
+
float curvedLinkControlPointDistance;
|
|
2586
|
+
float curvedLinkSegments;
|
|
2587
|
+
} fillSampledLinks;
|
|
2588
|
+
|
|
2589
|
+
#define pointsTextureSize fillSampledLinks.pointsTextureSize
|
|
2590
|
+
#define transformationMatrix fillSampledLinks.transformationMatrix
|
|
2591
|
+
#define spaceSize fillSampledLinks.spaceSize
|
|
2592
|
+
#define screenSize fillSampledLinks.screenSize
|
|
2593
|
+
#define curvedWeight fillSampledLinks.curvedWeight
|
|
2594
|
+
#define curvedLinkControlPointDistance fillSampledLinks.curvedLinkControlPointDistance
|
|
2595
|
+
#define curvedLinkSegments fillSampledLinks.curvedLinkSegments
|
|
2596
|
+
#else
|
|
2597
|
+
uniform float pointsTextureSize;
|
|
2598
|
+
uniform float spaceSize;
|
|
2599
|
+
uniform vec2 screenSize;
|
|
2600
|
+
uniform float curvedWeight;
|
|
2601
|
+
uniform float curvedLinkControlPointDistance;
|
|
2602
|
+
uniform float curvedLinkSegments;
|
|
2603
|
+
uniform mat3 transformationMatrix;
|
|
2604
|
+
#endif
|
|
2605
|
+
|
|
2606
|
+
out vec4 rgba;
|
|
2607
|
+
|
|
2608
|
+
void main() {
|
|
2609
|
+
vec4 posA = texture(positionsTexture, (pointA + 0.5) / pointsTextureSize);
|
|
2610
|
+
vec4 posB = texture(positionsTexture, (pointB + 0.5) / pointsTextureSize);
|
|
2611
|
+
vec2 a = posA.rg;
|
|
2612
|
+
vec2 b = posB.rg;
|
|
2613
|
+
|
|
2614
|
+
vec2 tangent = b - a;
|
|
2615
|
+
float angle = -atan(tangent.y, tangent.x);
|
|
2616
|
+
|
|
2617
|
+
vec2 mid;
|
|
2618
|
+
if (curvedLinkSegments <= 1.0) {
|
|
2619
|
+
mid = (a + b) * 0.5;
|
|
2620
|
+
} else if (curvedLinkControlPointDistance != 0.0 && curvedWeight != 0.0) {
|
|
2621
|
+
vec2 xBasis = b - a;
|
|
2622
|
+
vec2 yBasis = normalize(vec2(-xBasis.y, xBasis.x));
|
|
2623
|
+
float linkDist = length(xBasis);
|
|
2624
|
+
float h = curvedLinkControlPointDistance;
|
|
2625
|
+
vec2 controlPoint = (a + b) / 2.0 + yBasis * linkDist * h;
|
|
2626
|
+
mid = conicParametricCurve(a, b, controlPoint, 0.5, curvedWeight);
|
|
2627
|
+
} else {
|
|
2628
|
+
mid = (a + b) * 0.5;
|
|
2629
|
+
}
|
|
2630
|
+
|
|
2631
|
+
vec2 p = 2.0 * mid / spaceSize - 1.0;
|
|
2632
|
+
p *= spaceSize / screenSize;
|
|
2633
|
+
#ifdef USE_UNIFORM_BUFFERS
|
|
2634
|
+
mat3 transformMat3 = mat3(transformationMatrix);
|
|
2635
|
+
vec3 final = transformMat3 * vec3(p, 1);
|
|
2636
|
+
#else
|
|
2637
|
+
vec3 final = transformationMatrix * vec3(p, 1);
|
|
2638
|
+
#endif
|
|
2639
|
+
|
|
2640
|
+
vec2 pointScreenPosition = (final.xy + 1.0) * screenSize / 2.0;
|
|
2641
|
+
rgba = vec4(linkIndices, mid.x, mid.y, angle);
|
|
2642
|
+
float i = (pointScreenPosition.x + 0.5) / screenSize.x;
|
|
2643
|
+
float j = (pointScreenPosition.y + 0.5) / screenSize.y;
|
|
2644
|
+
gl_Position = vec4(2.0 * vec2(i, j) - 1.0, 0.0, 1.0);
|
|
2645
|
+
|
|
2646
|
+
gl_PointSize = 1.0;
|
|
2647
|
+
}
|
|
2648
|
+
`, tt = `#version 300 es
|
|
2480
2649
|
#ifdef GL_ES
|
|
2481
2650
|
precision highp float;
|
|
2482
2651
|
#endif
|
|
@@ -2516,7 +2685,7 @@ void main() {
|
|
|
2516
2685
|
// No link at this position, output -1 to indicate no hover
|
|
2517
2686
|
fragColor = vec4(-1.0, 0.0, 0.0, 0.0);
|
|
2518
2687
|
}
|
|
2519
|
-
} `,
|
|
2688
|
+
} `, it = `#version 300 es
|
|
2520
2689
|
#ifdef GL_ES
|
|
2521
2690
|
precision highp float;
|
|
2522
2691
|
#endif
|
|
@@ -2525,49 +2694,49 @@ in vec2 vertexCoord;
|
|
|
2525
2694
|
|
|
2526
2695
|
void main() {
|
|
2527
2696
|
gl_Position = vec4(vertexCoord, 0.0, 1.0);
|
|
2528
|
-
} `,
|
|
2529
|
-
const t =
|
|
2697
|
+
} `, ot = (e) => {
|
|
2698
|
+
const t = ue().exponent(2).range([0, 1]).domain([-1, 1]), i = _e(0, e).map((s) => -0.5 + s / e);
|
|
2530
2699
|
i.push(0.5);
|
|
2531
2700
|
const o = new Array(i.length * 2);
|
|
2532
2701
|
return i.forEach((s, n) => {
|
|
2533
2702
|
o[n * 2] = [t(s * 2), 0.5], o[n * 2 + 1] = [t(s * 2), -0.5];
|
|
2534
2703
|
}), o;
|
|
2535
2704
|
};
|
|
2536
|
-
class
|
|
2705
|
+
class st extends w {
|
|
2537
2706
|
initPrograms() {
|
|
2538
|
-
var
|
|
2539
|
-
const { device: t, config: i, store: o } = this;
|
|
2707
|
+
var r;
|
|
2708
|
+
const { device: t, config: i, store: o, data: s } = this;
|
|
2540
2709
|
this.updateLinkIndexFbo(), this.hoveredLineIndexTexture || (this.hoveredLineIndexTexture = t.createTexture({
|
|
2541
2710
|
width: 1,
|
|
2542
2711
|
height: 1,
|
|
2543
2712
|
format: "rgba32float",
|
|
2544
|
-
usage:
|
|
2713
|
+
usage: g.SAMPLE | g.RENDER | g.COPY_DST,
|
|
2545
2714
|
data: new Float32Array(4).fill(0)
|
|
2546
2715
|
})), this.hoveredLineIndexFbo || (this.hoveredLineIndexFbo = t.createFramebuffer({
|
|
2547
2716
|
width: 1,
|
|
2548
2717
|
height: 1,
|
|
2549
2718
|
colorAttachments: [this.hoveredLineIndexTexture]
|
|
2550
2719
|
})), this.curveLineGeometry || this.updateCurveLineGeometry();
|
|
2551
|
-
const
|
|
2720
|
+
const n = this.data.linksNumber ?? 0;
|
|
2552
2721
|
this.pointABuffer || (this.pointABuffer = t.createBuffer({
|
|
2553
|
-
data: new Float32Array(
|
|
2722
|
+
data: new Float32Array(n * 2),
|
|
2554
2723
|
usage: S.VERTEX | S.COPY_DST
|
|
2555
2724
|
})), this.pointBBuffer || (this.pointBBuffer = t.createBuffer({
|
|
2556
|
-
data: new Float32Array(
|
|
2725
|
+
data: new Float32Array(n * 2),
|
|
2557
2726
|
usage: S.VERTEX | S.COPY_DST
|
|
2558
2727
|
})), this.colorBuffer || (this.colorBuffer = t.createBuffer({
|
|
2559
|
-
data: new Float32Array(
|
|
2728
|
+
data: new Float32Array(n * 4),
|
|
2560
2729
|
usage: S.VERTEX | S.COPY_DST
|
|
2561
2730
|
})), this.widthBuffer || (this.widthBuffer = t.createBuffer({
|
|
2562
|
-
data: new Float32Array(
|
|
2731
|
+
data: new Float32Array(n),
|
|
2563
2732
|
usage: S.VERTEX | S.COPY_DST
|
|
2564
2733
|
})), this.arrowBuffer || (this.arrowBuffer = t.createBuffer({
|
|
2565
|
-
data: new Float32Array(
|
|
2734
|
+
data: new Float32Array(n),
|
|
2566
2735
|
usage: S.VERTEX | S.COPY_DST
|
|
2567
2736
|
})), this.linkIndexBuffer || (this.linkIndexBuffer = t.createBuffer({
|
|
2568
|
-
data: new Float32Array(
|
|
2737
|
+
data: new Float32Array(n),
|
|
2569
2738
|
usage: S.VERTEX | S.COPY_DST
|
|
2570
|
-
})), this.drawLineUniformStore || (this.drawLineUniformStore = new
|
|
2739
|
+
})), this.drawLineUniformStore || (this.drawLineUniformStore = new R({
|
|
2571
2740
|
drawLineUniforms: {
|
|
2572
2741
|
uniformTypes: {
|
|
2573
2742
|
transformationMatrix: "mat4x4<f32>",
|
|
@@ -2593,23 +2762,23 @@ class dt extends w {
|
|
|
2593
2762
|
defaultUniforms: {
|
|
2594
2763
|
transformationMatrix: o.transformationMatrix4x4,
|
|
2595
2764
|
pointsTextureSize: o.pointsTextureSize,
|
|
2596
|
-
widthScale: i.linkWidthScale
|
|
2597
|
-
linkArrowsSizeScale: i.linkArrowsSizeScale
|
|
2598
|
-
spaceSize: o.adjustedSpaceSize
|
|
2599
|
-
screenSize:
|
|
2600
|
-
linkVisibilityDistanceRange:
|
|
2601
|
-
linkVisibilityMinTransparency: i.linkVisibilityMinTransparency
|
|
2602
|
-
linkOpacity: i.linkOpacity
|
|
2603
|
-
greyoutOpacity: i.linkGreyoutOpacity
|
|
2604
|
-
curvedWeight: i.curvedLinkWeight
|
|
2605
|
-
curvedLinkControlPointDistance: i.curvedLinkControlPointDistance
|
|
2606
|
-
curvedLinkSegments: i.curvedLinks ? i.curvedLinkSegments
|
|
2607
|
-
scaleLinksOnZoom: i.scaleLinksOnZoom
|
|
2608
|
-
maxPointSize: o.maxPointSize
|
|
2765
|
+
widthScale: i.linkWidthScale,
|
|
2766
|
+
linkArrowsSizeScale: i.linkArrowsSizeScale,
|
|
2767
|
+
spaceSize: o.adjustedSpaceSize,
|
|
2768
|
+
screenSize: _(o.screenSize, [0, 0]),
|
|
2769
|
+
linkVisibilityDistanceRange: _(i.linkVisibilityDistanceRange, [0, 0]),
|
|
2770
|
+
linkVisibilityMinTransparency: i.linkVisibilityMinTransparency,
|
|
2771
|
+
linkOpacity: i.linkOpacity,
|
|
2772
|
+
greyoutOpacity: i.linkGreyoutOpacity,
|
|
2773
|
+
curvedWeight: i.curvedLinkWeight,
|
|
2774
|
+
curvedLinkControlPointDistance: i.curvedLinkControlPointDistance,
|
|
2775
|
+
curvedLinkSegments: i.curvedLinks ? i.curvedLinkSegments : 1,
|
|
2776
|
+
scaleLinksOnZoom: i.scaleLinksOnZoom ? 1 : 0,
|
|
2777
|
+
maxPointSize: o.maxPointSize,
|
|
2609
2778
|
renderMode: 0,
|
|
2610
2779
|
hoveredLinkIndex: o.hoveredLinkIndex ?? -1,
|
|
2611
|
-
hoveredLinkColor:
|
|
2612
|
-
hoveredLinkWidthIncrease: i.hoveredLinkWidthIncrease
|
|
2780
|
+
hoveredLinkColor: A(o.hoveredLinkColor, [-1, -1, -1, -1]),
|
|
2781
|
+
hoveredLinkWidthIncrease: i.hoveredLinkWidthIncrease
|
|
2613
2782
|
}
|
|
2614
2783
|
},
|
|
2615
2784
|
drawLineFragmentUniforms: {
|
|
@@ -2620,11 +2789,12 @@ class dt extends w {
|
|
|
2620
2789
|
renderMode: 0
|
|
2621
2790
|
}
|
|
2622
2791
|
}
|
|
2623
|
-
})), this.drawCurveCommand || (this.drawCurveCommand = new
|
|
2624
|
-
vs:
|
|
2625
|
-
fs:
|
|
2792
|
+
})), this.drawCurveCommand || (this.drawCurveCommand = new x(t, {
|
|
2793
|
+
vs: Je,
|
|
2794
|
+
fs: $e,
|
|
2795
|
+
modules: [te],
|
|
2626
2796
|
topology: "triangle-strip",
|
|
2627
|
-
vertexCount: ((
|
|
2797
|
+
vertexCount: ((r = this.curveLineGeometry) == null ? void 0 : r.length) ?? 0,
|
|
2628
2798
|
attributes: {
|
|
2629
2799
|
...this.curveLineBuffer && { position: this.curveLineBuffer },
|
|
2630
2800
|
...this.pointABuffer && { pointA: this.pointABuffer },
|
|
@@ -2677,20 +2847,20 @@ class dt extends w {
|
|
|
2677
2847
|
})), this.quadBuffer || (this.quadBuffer = t.createBuffer({
|
|
2678
2848
|
data: new Float32Array([-1, -1, 1, -1, -1, 1, 1, 1]),
|
|
2679
2849
|
usage: S.VERTEX | S.COPY_DST
|
|
2680
|
-
})), this.hoveredLineIndexUniformStore || (this.hoveredLineIndexUniformStore = new
|
|
2850
|
+
})), this.hoveredLineIndexUniformStore || (this.hoveredLineIndexUniformStore = new R({
|
|
2681
2851
|
hoveredLineIndexUniforms: {
|
|
2682
2852
|
uniformTypes: {
|
|
2683
2853
|
mousePosition: "vec2<f32>",
|
|
2684
2854
|
screenSize: "vec2<f32>"
|
|
2685
2855
|
},
|
|
2686
2856
|
defaultUniforms: {
|
|
2687
|
-
mousePosition:
|
|
2688
|
-
screenSize:
|
|
2857
|
+
mousePosition: _(o.screenMousePosition, [0, 0]),
|
|
2858
|
+
screenSize: _(o.screenSize, [0, 0])
|
|
2689
2859
|
}
|
|
2690
2860
|
}
|
|
2691
|
-
})), this.hoveredLineIndexCommand || (this.hoveredLineIndexCommand = new
|
|
2692
|
-
vs:
|
|
2693
|
-
fs:
|
|
2861
|
+
})), this.hoveredLineIndexCommand || (this.hoveredLineIndexCommand = new x(t, {
|
|
2862
|
+
vs: it,
|
|
2863
|
+
fs: tt,
|
|
2694
2864
|
topology: "triangle-strip",
|
|
2695
2865
|
vertexCount: 4,
|
|
2696
2866
|
attributes: {
|
|
@@ -2708,7 +2878,55 @@ class dt extends w {
|
|
|
2708
2878
|
hoveredLineIndexUniforms: this.hoveredLineIndexUniformStore.getManagedUniformBuffer(t, "hoveredLineIndexUniforms")
|
|
2709
2879
|
// All texture bindings will be set dynamically in findHoveredLine() method
|
|
2710
2880
|
}
|
|
2711
|
-
}))
|
|
2881
|
+
})), this.fillSampledLinksUniformStore || (this.fillSampledLinksUniformStore = new R({
|
|
2882
|
+
fillSampledLinksUniforms: {
|
|
2883
|
+
uniformTypes: {
|
|
2884
|
+
pointsTextureSize: "f32",
|
|
2885
|
+
transformationMatrix: "mat4x4<f32>",
|
|
2886
|
+
spaceSize: "f32",
|
|
2887
|
+
screenSize: "vec2<f32>",
|
|
2888
|
+
curvedWeight: "f32",
|
|
2889
|
+
curvedLinkControlPointDistance: "f32",
|
|
2890
|
+
curvedLinkSegments: "f32"
|
|
2891
|
+
},
|
|
2892
|
+
defaultUniforms: {
|
|
2893
|
+
pointsTextureSize: o.pointsTextureSize ?? 0,
|
|
2894
|
+
transformationMatrix: o.transformationMatrix4x4,
|
|
2895
|
+
spaceSize: o.adjustedSpaceSize,
|
|
2896
|
+
screenSize: _(o.screenSize, [0, 0]),
|
|
2897
|
+
curvedWeight: i.curvedLinkWeight,
|
|
2898
|
+
curvedLinkControlPointDistance: i.curvedLinkControlPointDistance,
|
|
2899
|
+
curvedLinkSegments: i.curvedLinks ? i.curvedLinkSegments : 1
|
|
2900
|
+
}
|
|
2901
|
+
}
|
|
2902
|
+
})), this.fillSampledLinksFboCommand || (this.fillSampledLinksFboCommand = new x(t, {
|
|
2903
|
+
fs: Ge,
|
|
2904
|
+
vs: et,
|
|
2905
|
+
modules: [te],
|
|
2906
|
+
topology: "point-list",
|
|
2907
|
+
vertexCount: s.linksNumber ?? 0,
|
|
2908
|
+
attributes: {
|
|
2909
|
+
...this.pointABuffer && { pointA: this.pointABuffer },
|
|
2910
|
+
...this.pointBBuffer && { pointB: this.pointBBuffer },
|
|
2911
|
+
...this.linkIndexBuffer && { linkIndices: this.linkIndexBuffer }
|
|
2912
|
+
},
|
|
2913
|
+
bufferLayout: [
|
|
2914
|
+
{ name: "pointA", format: "float32x2" },
|
|
2915
|
+
{ name: "pointB", format: "float32x2" },
|
|
2916
|
+
{ name: "linkIndices", format: "float32" }
|
|
2917
|
+
],
|
|
2918
|
+
defines: {
|
|
2919
|
+
USE_UNIFORM_BUFFERS: !0
|
|
2920
|
+
},
|
|
2921
|
+
bindings: {
|
|
2922
|
+
fillSampledLinksUniforms: this.fillSampledLinksUniformStore.getManagedUniformBuffer(t, "fillSampledLinksUniforms")
|
|
2923
|
+
},
|
|
2924
|
+
parameters: {
|
|
2925
|
+
depthWriteEnabled: !1,
|
|
2926
|
+
depthCompare: "always",
|
|
2927
|
+
blend: !1
|
|
2928
|
+
}
|
|
2929
|
+
})), this.updateSampledLinksGrid();
|
|
2712
2930
|
}
|
|
2713
2931
|
draw(t) {
|
|
2714
2932
|
const { config: i, points: o, store: s } = this;
|
|
@@ -2716,24 +2934,24 @@ class dt extends w {
|
|
|
2716
2934
|
drawLineUniforms: {
|
|
2717
2935
|
transformationMatrix: s.transformationMatrix4x4,
|
|
2718
2936
|
pointsTextureSize: s.pointsTextureSize,
|
|
2719
|
-
widthScale: i.linkWidthScale
|
|
2720
|
-
linkArrowsSizeScale: i.linkArrowsSizeScale
|
|
2721
|
-
spaceSize: s.adjustedSpaceSize
|
|
2722
|
-
screenSize:
|
|
2723
|
-
linkVisibilityDistanceRange:
|
|
2724
|
-
linkVisibilityMinTransparency: i.linkVisibilityMinTransparency
|
|
2725
|
-
linkOpacity: i.linkOpacity
|
|
2726
|
-
greyoutOpacity: i.linkGreyoutOpacity
|
|
2727
|
-
curvedWeight: i.curvedLinkWeight
|
|
2728
|
-
curvedLinkControlPointDistance: i.curvedLinkControlPointDistance
|
|
2729
|
-
curvedLinkSegments: i.curvedLinks ? i.curvedLinkSegments
|
|
2730
|
-
scaleLinksOnZoom: i.scaleLinksOnZoom
|
|
2731
|
-
maxPointSize: s.maxPointSize
|
|
2937
|
+
widthScale: i.linkWidthScale,
|
|
2938
|
+
linkArrowsSizeScale: i.linkArrowsSizeScale,
|
|
2939
|
+
spaceSize: s.adjustedSpaceSize,
|
|
2940
|
+
screenSize: _(s.screenSize, [0, 0]),
|
|
2941
|
+
linkVisibilityDistanceRange: _(i.linkVisibilityDistanceRange, [0, 0]),
|
|
2942
|
+
linkVisibilityMinTransparency: i.linkVisibilityMinTransparency,
|
|
2943
|
+
linkOpacity: i.linkOpacity,
|
|
2944
|
+
greyoutOpacity: i.linkGreyoutOpacity,
|
|
2945
|
+
curvedWeight: i.curvedLinkWeight,
|
|
2946
|
+
curvedLinkControlPointDistance: i.curvedLinkControlPointDistance,
|
|
2947
|
+
curvedLinkSegments: i.curvedLinks ? i.curvedLinkSegments : 1,
|
|
2948
|
+
scaleLinksOnZoom: i.scaleLinksOnZoom ? 1 : 0,
|
|
2949
|
+
maxPointSize: s.maxPointSize,
|
|
2732
2950
|
renderMode: 0,
|
|
2733
2951
|
// Normal rendering
|
|
2734
2952
|
hoveredLinkIndex: s.hoveredLinkIndex ?? -1,
|
|
2735
|
-
hoveredLinkColor:
|
|
2736
|
-
hoveredLinkWidthIncrease: i.hoveredLinkWidthIncrease
|
|
2953
|
+
hoveredLinkColor: A(s.hoveredLinkColor, [-1, -1, -1, -1]),
|
|
2954
|
+
hoveredLinkWidthIncrease: i.hoveredLinkWidthIncrease
|
|
2737
2955
|
},
|
|
2738
2956
|
drawLineFragmentUniforms: {
|
|
2739
2957
|
renderMode: 0
|
|
@@ -2745,17 +2963,17 @@ class dt extends w {
|
|
|
2745
2963
|
}), this.drawCurveCommand.setInstanceCount(this.data.linksNumber ?? 0), this.drawCurveCommand.draw(t))));
|
|
2746
2964
|
}
|
|
2747
2965
|
updateLinkIndexFbo() {
|
|
2748
|
-
var a,
|
|
2966
|
+
var a, d;
|
|
2749
2967
|
const { device: t, store: i } = this;
|
|
2750
2968
|
if (!this.store.isLinkHoveringEnabled) return;
|
|
2751
2969
|
const o = i.screenSize ?? [0, 0], s = o[0], n = o[1];
|
|
2752
2970
|
if (!s || !n) return;
|
|
2753
|
-
const r = ((a = this.previousScreenSize) == null ? void 0 : a[0]) !== s || ((
|
|
2971
|
+
const r = ((a = this.previousScreenSize) == null ? void 0 : a[0]) !== s || ((d = this.previousScreenSize) == null ? void 0 : d[1]) !== n;
|
|
2754
2972
|
(!this.linkIndexTexture || r) && (this.linkIndexFbo && !this.linkIndexFbo.destroyed && this.linkIndexFbo.destroy(), this.linkIndexTexture && !this.linkIndexTexture.destroyed && this.linkIndexTexture.destroy(), this.linkIndexTexture = t.createTexture({
|
|
2755
2973
|
width: s,
|
|
2756
2974
|
height: n,
|
|
2757
2975
|
format: "rgba32float",
|
|
2758
|
-
usage:
|
|
2976
|
+
usage: g.SAMPLE | g.RENDER | g.COPY_DST
|
|
2759
2977
|
}), this.linkIndexTexture.copyImageData({
|
|
2760
2978
|
data: new Float32Array(s * n * 4).fill(0),
|
|
2761
2979
|
bytesPerRow: T("rgba32float", s),
|
|
@@ -2768,16 +2986,27 @@ class dt extends w {
|
|
|
2768
2986
|
colorAttachments: [this.linkIndexTexture]
|
|
2769
2987
|
}), this.previousScreenSize = [s, n]);
|
|
2770
2988
|
}
|
|
2989
|
+
updateSampledLinksGrid() {
|
|
2990
|
+
const { store: { screenSize: t }, config: { linkSamplingDistance: i }, device: o } = this;
|
|
2991
|
+
let s = i ?? Math.min(...t) / 2;
|
|
2992
|
+
s === 0 && (s = k.linkSamplingDistance);
|
|
2993
|
+
const n = Math.ceil(t[0] / s), r = Math.ceil(t[1] / s);
|
|
2994
|
+
n === 0 || r === 0 || (!this.sampledLinksFbo || this.sampledLinksFbo.width !== n || this.sampledLinksFbo.height !== r) && (this.sampledLinksFbo && !this.sampledLinksFbo.destroyed && this.sampledLinksFbo.destroy(), this.sampledLinksFbo = o.createFramebuffer({
|
|
2995
|
+
width: n,
|
|
2996
|
+
height: r,
|
|
2997
|
+
colorAttachments: ["rgba32float"]
|
|
2998
|
+
}));
|
|
2999
|
+
}
|
|
2771
3000
|
updatePointsBuffer() {
|
|
2772
|
-
var
|
|
3001
|
+
var d;
|
|
2773
3002
|
const { device: t, data: i, store: o } = this;
|
|
2774
3003
|
if (i.linksNumber === void 0 || i.links === void 0 || !o.pointsTextureSize) return;
|
|
2775
3004
|
const s = new Float32Array(i.linksNumber * 2), n = new Float32Array(i.linksNumber * 2);
|
|
2776
|
-
for (let
|
|
2777
|
-
const c = i.links[
|
|
2778
|
-
s[
|
|
3005
|
+
for (let l = 0; l < i.linksNumber; l++) {
|
|
3006
|
+
const c = i.links[l * 2], f = i.links[l * 2 + 1], u = c % o.pointsTextureSize, h = Math.floor(c / o.pointsTextureSize), p = f % o.pointsTextureSize, P = Math.floor(f / o.pointsTextureSize);
|
|
3007
|
+
s[l * 2] = u, s[l * 2 + 1] = h, n[l * 2] = p, n[l * 2 + 1] = P;
|
|
2779
3008
|
}
|
|
2780
|
-
const r = (((
|
|
3009
|
+
const r = (((d = this.pointABuffer) == null ? void 0 : d.byteLength) ?? 0) / (Float32Array.BYTES_PER_ELEMENT * 2);
|
|
2781
3010
|
!this.pointABuffer || r !== i.linksNumber ? (this.pointABuffer && !this.pointABuffer.destroyed && this.pointABuffer.destroy(), this.pointABuffer = t.createBuffer({
|
|
2782
3011
|
data: s,
|
|
2783
3012
|
usage: S.VERTEX | S.COPY_DST
|
|
@@ -2786,8 +3015,8 @@ class dt extends w {
|
|
|
2786
3015
|
usage: S.VERTEX | S.COPY_DST
|
|
2787
3016
|
})) : this.pointBBuffer.write(n);
|
|
2788
3017
|
const a = new Float32Array(i.linksNumber);
|
|
2789
|
-
for (let
|
|
2790
|
-
a[
|
|
3018
|
+
for (let l = 0; l < i.linksNumber; l++)
|
|
3019
|
+
a[l] = l;
|
|
2791
3020
|
!this.linkIndexBuffer || r !== i.linksNumber ? (this.linkIndexBuffer && !this.linkIndexBuffer.destroyed && this.linkIndexBuffer.destroy(), this.linkIndexBuffer = t.createBuffer({
|
|
2792
3021
|
data: a,
|
|
2793
3022
|
usage: S.VERTEX | S.COPY_DST
|
|
@@ -2795,7 +3024,11 @@ class dt extends w {
|
|
|
2795
3024
|
pointA: this.pointABuffer,
|
|
2796
3025
|
pointB: this.pointBBuffer,
|
|
2797
3026
|
linkIndices: this.linkIndexBuffer
|
|
2798
|
-
})
|
|
3027
|
+
}), this.fillSampledLinksFboCommand && this.fillSampledLinksFboCommand.setAttributes({
|
|
3028
|
+
pointA: this.pointABuffer,
|
|
3029
|
+
pointB: this.pointBBuffer,
|
|
3030
|
+
linkIndices: this.linkIndexBuffer
|
|
3031
|
+
}), this.updateSampledLinksGrid();
|
|
2799
3032
|
}
|
|
2800
3033
|
updateColor() {
|
|
2801
3034
|
const { device: t, data: i } = this, o = i.linksNumber ?? 0, s = i.linkColors ?? new Float32Array(o * 4).fill(0);
|
|
@@ -2835,7 +3068,7 @@ class dt extends w {
|
|
|
2835
3068
|
}
|
|
2836
3069
|
updateCurveLineGeometry() {
|
|
2837
3070
|
const { device: t, config: { curvedLinks: i, curvedLinkSegments: o } } = this;
|
|
2838
|
-
this.curveLineGeometry =
|
|
3071
|
+
this.curveLineGeometry = ot(i ? o : 1);
|
|
2839
3072
|
const s = new Float32Array(this.curveLineGeometry.length * 2);
|
|
2840
3073
|
for (let n = 0; n < this.curveLineGeometry.length; n++)
|
|
2841
3074
|
s[n * 2] = this.curveLineGeometry[n][0], s[n * 2 + 1] = this.curveLineGeometry[n][1];
|
|
@@ -2846,6 +3079,70 @@ class dt extends w {
|
|
|
2846
3079
|
position: this.curveLineBuffer
|
|
2847
3080
|
}), this.drawCurveCommand.setVertexCount(this.curveLineGeometry.length));
|
|
2848
3081
|
}
|
|
3082
|
+
getSampledLinkPositionsMap() {
|
|
3083
|
+
const t = /* @__PURE__ */ new Map();
|
|
3084
|
+
if (!this.sampledLinksFbo || this.sampledLinksFbo.destroyed) return t;
|
|
3085
|
+
const i = this.points;
|
|
3086
|
+
if (!(i != null && i.currentPositionTexture) || i.currentPositionTexture.destroyed) return t;
|
|
3087
|
+
if (this.fillSampledLinksFboCommand && this.fillSampledLinksUniformStore && this.sampledLinksFbo) {
|
|
3088
|
+
this.fillSampledLinksFboCommand.setVertexCount(this.data.linksNumber ?? 0), this.fillSampledLinksUniformStore.setUniforms({
|
|
3089
|
+
fillSampledLinksUniforms: {
|
|
3090
|
+
pointsTextureSize: this.store.pointsTextureSize ?? 0,
|
|
3091
|
+
transformationMatrix: this.store.transformationMatrix4x4,
|
|
3092
|
+
spaceSize: this.store.adjustedSpaceSize,
|
|
3093
|
+
screenSize: _(this.store.screenSize, [0, 0]),
|
|
3094
|
+
curvedWeight: this.config.curvedLinkWeight,
|
|
3095
|
+
curvedLinkControlPointDistance: this.config.curvedLinkControlPointDistance,
|
|
3096
|
+
curvedLinkSegments: this.config.curvedLinks ? this.config.curvedLinkSegments : 1
|
|
3097
|
+
}
|
|
3098
|
+
}), this.fillSampledLinksFboCommand.setBindings({
|
|
3099
|
+
positionsTexture: i.currentPositionTexture
|
|
3100
|
+
});
|
|
3101
|
+
const s = this.device.beginRenderPass({
|
|
3102
|
+
framebuffer: this.sampledLinksFbo,
|
|
3103
|
+
clearColor: [-1, -1, -1, -1]
|
|
3104
|
+
});
|
|
3105
|
+
this.fillSampledLinksFboCommand.draw(s), s.end();
|
|
3106
|
+
}
|
|
3107
|
+
const o = I(this.device, this.sampledLinksFbo);
|
|
3108
|
+
for (let s = 0; s < o.length / 4; s++) {
|
|
3109
|
+
const n = o[s * 4], r = o[s * 4 + 1], a = o[s * 4 + 2], d = o[s * 4 + 3];
|
|
3110
|
+
n !== void 0 && n >= 0 && r !== void 0 && a !== void 0 && d !== void 0 && t.set(Math.round(n), [r, a, d]);
|
|
3111
|
+
}
|
|
3112
|
+
return t;
|
|
3113
|
+
}
|
|
3114
|
+
getSampledLinks() {
|
|
3115
|
+
const t = [], i = [], o = [];
|
|
3116
|
+
if (!this.sampledLinksFbo || this.sampledLinksFbo.destroyed) return { indices: t, positions: i, angles: o };
|
|
3117
|
+
const s = this.points;
|
|
3118
|
+
if (!(s != null && s.currentPositionTexture) || s.currentPositionTexture.destroyed) return { indices: t, positions: i, angles: o };
|
|
3119
|
+
if (this.fillSampledLinksFboCommand && this.fillSampledLinksUniformStore && this.sampledLinksFbo) {
|
|
3120
|
+
this.fillSampledLinksFboCommand.setVertexCount(this.data.linksNumber ?? 0), this.fillSampledLinksUniformStore.setUniforms({
|
|
3121
|
+
fillSampledLinksUniforms: {
|
|
3122
|
+
pointsTextureSize: this.store.pointsTextureSize ?? 0,
|
|
3123
|
+
transformationMatrix: this.store.transformationMatrix4x4,
|
|
3124
|
+
spaceSize: this.store.adjustedSpaceSize,
|
|
3125
|
+
screenSize: _(this.store.screenSize, [0, 0]),
|
|
3126
|
+
curvedWeight: this.config.curvedLinkWeight,
|
|
3127
|
+
curvedLinkControlPointDistance: this.config.curvedLinkControlPointDistance,
|
|
3128
|
+
curvedLinkSegments: this.config.curvedLinks ? this.config.curvedLinkSegments : 1
|
|
3129
|
+
}
|
|
3130
|
+
}), this.fillSampledLinksFboCommand.setBindings({
|
|
3131
|
+
positionsTexture: s.currentPositionTexture
|
|
3132
|
+
});
|
|
3133
|
+
const r = this.device.beginRenderPass({
|
|
3134
|
+
framebuffer: this.sampledLinksFbo,
|
|
3135
|
+
clearColor: [-1, -1, -1, -1]
|
|
3136
|
+
});
|
|
3137
|
+
this.fillSampledLinksFboCommand.draw(r), r.end();
|
|
3138
|
+
}
|
|
3139
|
+
const n = I(this.device, this.sampledLinksFbo);
|
|
3140
|
+
for (let r = 0; r < n.length / 4; r++) {
|
|
3141
|
+
const a = n[r * 4], d = n[r * 4 + 1], l = n[r * 4 + 2], c = n[r * 4 + 3];
|
|
3142
|
+
a !== void 0 && a >= 0 && d !== void 0 && l !== void 0 && c !== void 0 && (t.push(Math.round(a)), i.push(d, l), o.push(c));
|
|
3143
|
+
}
|
|
3144
|
+
return { indices: t, positions: i, angles: o };
|
|
3145
|
+
}
|
|
2849
3146
|
findHoveredLine() {
|
|
2850
3147
|
const { config: t, points: i, store: o } = this;
|
|
2851
3148
|
if (!i || !i.currentPositionTexture || i.currentPositionTexture.destroyed || !i.greyoutStatusTexture || i.greyoutStatusTexture.destroyed || !this.data.linksNumber || !this.store.isLinkHoveringEnabled || !this.linkIndexFbo || !this.drawCurveCommand || !this.drawLineUniformStore || !this.linkIndexTexture || this.linkIndexTexture.destroyed) return;
|
|
@@ -2853,24 +3150,24 @@ class dt extends w {
|
|
|
2853
3150
|
drawLineUniforms: {
|
|
2854
3151
|
transformationMatrix: o.transformationMatrix4x4,
|
|
2855
3152
|
pointsTextureSize: o.pointsTextureSize,
|
|
2856
|
-
widthScale: t.linkWidthScale
|
|
2857
|
-
linkArrowsSizeScale: t.linkArrowsSizeScale
|
|
2858
|
-
spaceSize: o.adjustedSpaceSize
|
|
2859
|
-
screenSize:
|
|
2860
|
-
linkVisibilityDistanceRange:
|
|
2861
|
-
linkVisibilityMinTransparency: t.linkVisibilityMinTransparency
|
|
2862
|
-
linkOpacity: t.linkOpacity
|
|
2863
|
-
greyoutOpacity: t.linkGreyoutOpacity
|
|
2864
|
-
curvedWeight: t.curvedLinkWeight
|
|
2865
|
-
curvedLinkControlPointDistance: t.curvedLinkControlPointDistance
|
|
2866
|
-
curvedLinkSegments: t.curvedLinks ? t.curvedLinkSegments
|
|
2867
|
-
scaleLinksOnZoom: t.scaleLinksOnZoom
|
|
2868
|
-
maxPointSize: o.maxPointSize
|
|
3153
|
+
widthScale: t.linkWidthScale,
|
|
3154
|
+
linkArrowsSizeScale: t.linkArrowsSizeScale,
|
|
3155
|
+
spaceSize: o.adjustedSpaceSize,
|
|
3156
|
+
screenSize: _(o.screenSize, [0, 0]),
|
|
3157
|
+
linkVisibilityDistanceRange: _(t.linkVisibilityDistanceRange, [0, 0]),
|
|
3158
|
+
linkVisibilityMinTransparency: t.linkVisibilityMinTransparency,
|
|
3159
|
+
linkOpacity: t.linkOpacity,
|
|
3160
|
+
greyoutOpacity: t.linkGreyoutOpacity,
|
|
3161
|
+
curvedWeight: t.curvedLinkWeight,
|
|
3162
|
+
curvedLinkControlPointDistance: t.curvedLinkControlPointDistance,
|
|
3163
|
+
curvedLinkSegments: t.curvedLinks ? t.curvedLinkSegments : 1,
|
|
3164
|
+
scaleLinksOnZoom: t.scaleLinksOnZoom ? 1 : 0,
|
|
3165
|
+
maxPointSize: o.maxPointSize,
|
|
2869
3166
|
renderMode: 1,
|
|
2870
3167
|
// Index rendering for picking
|
|
2871
3168
|
hoveredLinkIndex: o.hoveredLinkIndex ?? -1,
|
|
2872
|
-
hoveredLinkColor:
|
|
2873
|
-
hoveredLinkWidthIncrease: t.hoveredLinkWidthIncrease
|
|
3169
|
+
hoveredLinkColor: A(o.hoveredLinkColor, [-1, -1, -1, -1]),
|
|
3170
|
+
hoveredLinkWidthIncrease: t.hoveredLinkWidthIncrease
|
|
2874
3171
|
},
|
|
2875
3172
|
drawLineFragmentUniforms: {
|
|
2876
3173
|
renderMode: 1
|
|
@@ -2888,8 +3185,8 @@ class dt extends w {
|
|
|
2888
3185
|
if (this.drawCurveCommand.draw(s), s.end(), this.hoveredLineIndexCommand && this.hoveredLineIndexFbo && this.hoveredLineIndexUniformStore) {
|
|
2889
3186
|
this.hoveredLineIndexUniformStore.setUniforms({
|
|
2890
3187
|
hoveredLineIndexUniforms: {
|
|
2891
|
-
mousePosition:
|
|
2892
|
-
screenSize:
|
|
3188
|
+
mousePosition: _(o.screenMousePosition, [0, 0]),
|
|
3189
|
+
screenSize: _(o.screenSize, [0, 0])
|
|
2893
3190
|
}
|
|
2894
3191
|
}), this.hoveredLineIndexCommand.setBindings({
|
|
2895
3192
|
linkIndexTexture: this.linkIndexTexture
|
|
@@ -2905,11 +3202,11 @@ class dt extends w {
|
|
|
2905
3202
|
* Models -> Framebuffers -> Textures -> UniformStores -> Buffers
|
|
2906
3203
|
*/
|
|
2907
3204
|
destroy() {
|
|
2908
|
-
var t, i, o, s;
|
|
2909
|
-
(t = this.drawCurveCommand) == null || t.destroy(), this.drawCurveCommand = void 0, (i = this.hoveredLineIndexCommand) == null || i.destroy(), this.hoveredLineIndexCommand = void 0, this.linkIndexFbo && !this.linkIndexFbo.destroyed && this.linkIndexFbo.destroy(), this.linkIndexFbo = void 0, this.hoveredLineIndexFbo && !this.hoveredLineIndexFbo.destroyed && this.hoveredLineIndexFbo.destroy(), this.hoveredLineIndexFbo = void 0, this.linkIndexTexture && !this.linkIndexTexture.destroyed && this.linkIndexTexture.destroy(), this.linkIndexTexture = void 0, this.hoveredLineIndexTexture && !this.hoveredLineIndexTexture.destroyed && this.hoveredLineIndexTexture.destroy(), this.hoveredLineIndexTexture = void 0, (
|
|
3205
|
+
var t, i, o, s, n, r;
|
|
3206
|
+
(t = this.drawCurveCommand) == null || t.destroy(), this.drawCurveCommand = void 0, (i = this.hoveredLineIndexCommand) == null || i.destroy(), this.hoveredLineIndexCommand = void 0, (o = this.fillSampledLinksFboCommand) == null || o.destroy(), this.fillSampledLinksFboCommand = void 0, this.linkIndexFbo && !this.linkIndexFbo.destroyed && this.linkIndexFbo.destroy(), this.linkIndexFbo = void 0, this.sampledLinksFbo && !this.sampledLinksFbo.destroyed && this.sampledLinksFbo.destroy(), this.sampledLinksFbo = void 0, this.hoveredLineIndexFbo && !this.hoveredLineIndexFbo.destroyed && this.hoveredLineIndexFbo.destroy(), this.hoveredLineIndexFbo = void 0, this.linkIndexTexture && !this.linkIndexTexture.destroyed && this.linkIndexTexture.destroy(), this.linkIndexTexture = void 0, this.hoveredLineIndexTexture && !this.hoveredLineIndexTexture.destroyed && this.hoveredLineIndexTexture.destroy(), this.hoveredLineIndexTexture = void 0, (s = this.drawLineUniformStore) == null || s.destroy(), this.drawLineUniformStore = void 0, (n = this.hoveredLineIndexUniformStore) == null || n.destroy(), this.hoveredLineIndexUniformStore = void 0, (r = this.fillSampledLinksUniformStore) == null || r.destroy(), this.fillSampledLinksUniformStore = void 0, this.pointABuffer && !this.pointABuffer.destroyed && this.pointABuffer.destroy(), this.pointABuffer = void 0, this.pointBBuffer && !this.pointBBuffer.destroyed && this.pointBBuffer.destroy(), this.pointBBuffer = void 0, this.colorBuffer && !this.colorBuffer.destroyed && this.colorBuffer.destroy(), this.colorBuffer = void 0, this.widthBuffer && !this.widthBuffer.destroyed && this.widthBuffer.destroy(), this.widthBuffer = void 0, this.arrowBuffer && !this.arrowBuffer.destroyed && this.arrowBuffer.destroy(), this.arrowBuffer = void 0, this.curveLineBuffer && !this.curveLineBuffer.destroyed && this.curveLineBuffer.destroy(), this.curveLineBuffer = void 0, this.linkIndexBuffer && !this.linkIndexBuffer.destroyed && this.linkIndexBuffer.destroy(), this.linkIndexBuffer = void 0, this.quadBuffer && !this.quadBuffer.destroyed && this.quadBuffer.destroy(), this.quadBuffer = void 0;
|
|
2910
3207
|
}
|
|
2911
3208
|
}
|
|
2912
|
-
const
|
|
3209
|
+
const nt = `#version 300 es
|
|
2913
3210
|
#ifdef GL_ES
|
|
2914
3211
|
precision highp float;
|
|
2915
3212
|
#endif
|
|
@@ -3168,7 +3465,7 @@ void main() {
|
|
|
3168
3465
|
finalPointAlpha
|
|
3169
3466
|
);
|
|
3170
3467
|
}
|
|
3171
|
-
`,
|
|
3468
|
+
`, rt = `#version 300 es
|
|
3172
3469
|
#ifdef GL_ES
|
|
3173
3470
|
precision highp float;
|
|
3174
3471
|
#endif
|
|
@@ -3370,7 +3667,7 @@ void main() {
|
|
|
3370
3667
|
imageAtlasUV = atlasCoords;
|
|
3371
3668
|
}
|
|
3372
3669
|
#endif
|
|
3373
|
-
} `,
|
|
3670
|
+
} `, at = `#version 300 es
|
|
3374
3671
|
#ifdef GL_ES
|
|
3375
3672
|
precision highp float;
|
|
3376
3673
|
#endif
|
|
@@ -3458,7 +3755,7 @@ void main() {
|
|
|
3458
3755
|
}
|
|
3459
3756
|
}
|
|
3460
3757
|
|
|
3461
|
-
`,
|
|
3758
|
+
`, dt = `#version 300 es
|
|
3462
3759
|
#ifdef GL_ES
|
|
3463
3760
|
precision highp float;
|
|
3464
3761
|
#endif
|
|
@@ -3546,7 +3843,7 @@ void main() {
|
|
|
3546
3843
|
if (pointInPolygon(screenPos, polygonPathTexture, polygonPathLength)) {
|
|
3547
3844
|
fragColor.r = 1.0;
|
|
3548
3845
|
}
|
|
3549
|
-
} `,
|
|
3846
|
+
} `, lt = `#version 300 es
|
|
3550
3847
|
#ifdef GL_ES
|
|
3551
3848
|
precision highp float;
|
|
3552
3849
|
#endif
|
|
@@ -3589,7 +3886,7 @@ void main () {
|
|
|
3589
3886
|
float opacity = smoothstep(r, r * smoothing, 1.0);
|
|
3590
3887
|
float stroke = smoothstep(width, width * smoothing, r);
|
|
3591
3888
|
fragColor = vec4(rgbColor, opacity * stroke * pointOpacity);
|
|
3592
|
-
}`,
|
|
3889
|
+
}`, ct = `#version 300 es
|
|
3593
3890
|
#ifdef GL_ES
|
|
3594
3891
|
precision highp float;
|
|
3595
3892
|
#endif
|
|
@@ -3733,7 +4030,7 @@ void main () {
|
|
|
3733
4030
|
#endif
|
|
3734
4031
|
|
|
3735
4032
|
gl_Position = vec4(final.rg, 0, 1);
|
|
3736
|
-
}`,
|
|
4033
|
+
}`, ft = `#version 300 es
|
|
3737
4034
|
#ifdef GL_ES
|
|
3738
4035
|
precision highp float;
|
|
3739
4036
|
#endif
|
|
@@ -3747,13 +4044,14 @@ void main() {
|
|
|
3747
4044
|
discard;
|
|
3748
4045
|
}
|
|
3749
4046
|
fragColor = rgba;
|
|
3750
|
-
}`,
|
|
4047
|
+
}`, ht = `#version 300 es
|
|
3751
4048
|
#ifdef GL_ES
|
|
3752
4049
|
precision highp float;
|
|
3753
4050
|
#endif
|
|
3754
4051
|
|
|
3755
4052
|
in vec2 pointIndices;
|
|
3756
4053
|
in float size;
|
|
4054
|
+
in float imageSize;
|
|
3757
4055
|
|
|
3758
4056
|
uniform sampler2D positionsTexture;
|
|
3759
4057
|
uniform sampler2D pointGreyoutStatus;
|
|
@@ -3846,7 +4144,9 @@ void main() {
|
|
|
3846
4144
|
vec3 finalPosition = transformationMatrix * vec3(normalizedPosition, 1);
|
|
3847
4145
|
#endif
|
|
3848
4146
|
|
|
3849
|
-
float
|
|
4147
|
+
float shapeSizeValue = calculatePointSize(size * sizeScale);
|
|
4148
|
+
float imageSizeValue = calculatePointSize(imageSize * sizeScale);
|
|
4149
|
+
float pointRadius = 0.5 * max(shapeSizeValue, imageSizeValue);
|
|
3850
4150
|
vec2 pointScreenPosition = (finalPosition.xy + 1.0) * screenSize / 2.0;
|
|
3851
4151
|
|
|
3852
4152
|
rgba = vec4(0.0);
|
|
@@ -3854,12 +4154,12 @@ void main() {
|
|
|
3854
4154
|
|
|
3855
4155
|
if (euclideanDistance(pointScreenPosition.x, mousePosition.x, pointScreenPosition.y, mousePosition.y) < pointRadius / ratio) {
|
|
3856
4156
|
float index = pointIndices.g * pointsTextureSize + pointIndices.r;
|
|
3857
|
-
rgba = vec4(index, size, pointPosition.xy);
|
|
4157
|
+
rgba = vec4(index, max(size, imageSize), pointPosition.xy);
|
|
3858
4158
|
gl_Position = vec4(-0.5, -0.5, 0.0, 1.0);
|
|
3859
4159
|
}
|
|
3860
4160
|
|
|
3861
4161
|
gl_PointSize = 1.0;
|
|
3862
|
-
}`,
|
|
4162
|
+
}`, ut = `#version 300 es
|
|
3863
4163
|
#ifdef GL_ES
|
|
3864
4164
|
precision highp float;
|
|
3865
4165
|
#endif
|
|
@@ -3870,7 +4170,7 @@ out vec4 fragColor;
|
|
|
3870
4170
|
|
|
3871
4171
|
void main() {
|
|
3872
4172
|
fragColor = rgba;
|
|
3873
|
-
}`,
|
|
4173
|
+
}`, St = `#version 300 es
|
|
3874
4174
|
#ifdef GL_ES
|
|
3875
4175
|
precision highp float;
|
|
3876
4176
|
#endif
|
|
@@ -3920,7 +4220,7 @@ void main() {
|
|
|
3920
4220
|
gl_Position = vec4(2.0 * vec2(i, j) - 1.0, 0.0, 1.0);
|
|
3921
4221
|
|
|
3922
4222
|
gl_PointSize = 1.0;
|
|
3923
|
-
}`,
|
|
4223
|
+
}`, pt = `#version 300 es
|
|
3924
4224
|
#ifdef GL_ES
|
|
3925
4225
|
precision highp float;
|
|
3926
4226
|
#endif
|
|
@@ -3970,7 +4270,7 @@ void main() {
|
|
|
3970
4270
|
pointPosition.g = clamp(pointPosition.g, 0.0, spaceSize);
|
|
3971
4271
|
|
|
3972
4272
|
fragColor = pointPosition;
|
|
3973
|
-
}`,
|
|
4273
|
+
}`, _t = `#version 300 es
|
|
3974
4274
|
#ifdef GL_ES
|
|
3975
4275
|
precision highp float;
|
|
3976
4276
|
#endif
|
|
@@ -4000,7 +4300,7 @@ void main() {
|
|
|
4000
4300
|
fragColor = vec4(pointPosition.rg, 1.0, 1.0);
|
|
4001
4301
|
}
|
|
4002
4302
|
|
|
4003
|
-
`,
|
|
4303
|
+
`, Tt = `#version 300 es
|
|
4004
4304
|
#ifdef GL_ES
|
|
4005
4305
|
precision highp float;
|
|
4006
4306
|
#endif
|
|
@@ -4034,12 +4334,12 @@ void main() {
|
|
|
4034
4334
|
|
|
4035
4335
|
fragColor = pointPosition;
|
|
4036
4336
|
}`;
|
|
4037
|
-
function
|
|
4337
|
+
function gt(e, t = 16384) {
|
|
4038
4338
|
if (!(e != null && e.length))
|
|
4039
4339
|
return null;
|
|
4040
4340
|
let i = 0;
|
|
4041
|
-
for (const
|
|
4042
|
-
const c = Math.max(
|
|
4341
|
+
for (const l of e) {
|
|
4342
|
+
const c = Math.max(l.width, l.height);
|
|
4043
4343
|
c > i && (i = c);
|
|
4044
4344
|
}
|
|
4045
4345
|
if (i === 0)
|
|
@@ -4049,51 +4349,51 @@ function xt(e, t = 16384) {
|
|
|
4049
4349
|
n > t && (r = t / n, i = Math.max(1, Math.floor(i * r)), n = Math.max(1, Math.floor(n * r)), console.warn(
|
|
4050
4350
|
`🖼️ Atlas scaling required: Original size ${(o * s).toLocaleString()}px exceeds WebGL limit ${t.toLocaleString()}px. Scaling down to ${n.toLocaleString()}px (${Math.round(r * 100)}% of original quality)`
|
|
4051
4351
|
));
|
|
4052
|
-
const a = new Uint8Array(n * n * 4).fill(0),
|
|
4053
|
-
for (const [
|
|
4054
|
-
const f = c.width,
|
|
4055
|
-
if (f === 0 ||
|
|
4352
|
+
const a = new Uint8Array(n * n * 4).fill(0), d = new Float32Array(s * s * 4).fill(-1);
|
|
4353
|
+
for (const [l, c] of e.entries()) {
|
|
4354
|
+
const f = c.width, u = c.height;
|
|
4355
|
+
if (f === 0 || u === 0)
|
|
4056
4356
|
continue;
|
|
4057
|
-
const
|
|
4058
|
-
l
|
|
4059
|
-
for (let
|
|
4060
|
-
for (let
|
|
4061
|
-
const
|
|
4062
|
-
a[
|
|
4357
|
+
const h = Math.min(1, i / Math.max(f, u)), p = Math.floor(f * h), P = Math.floor(u * h), m = Math.floor(l / s), v = l % s * i, y = m * i;
|
|
4358
|
+
d[l * 4] = v / n, d[l * 4 + 1] = y / n, d[l * 4 + 2] = (v + p) / n, d[l * 4 + 3] = (y + P) / n;
|
|
4359
|
+
for (let O = 0; O < P; O++)
|
|
4360
|
+
for (let F = 0; F < p; F++) {
|
|
4361
|
+
const E = Math.floor(F * (f / p)), U = (Math.floor(O * (u / P)) * f + E) * 4, B = ((y + O) * n + (v + F)) * 4;
|
|
4362
|
+
a[B] = c.data[U] ?? 0, a[B + 1] = c.data[U + 1] ?? 0, a[B + 2] = c.data[U + 2] ?? 0, a[B + 3] = c.data[U + 3] ?? 255;
|
|
4063
4363
|
}
|
|
4064
4364
|
}
|
|
4065
4365
|
return {
|
|
4066
4366
|
atlasData: a,
|
|
4067
4367
|
atlasSize: n,
|
|
4068
|
-
atlasCoords:
|
|
4368
|
+
atlasCoords: d,
|
|
4069
4369
|
atlasCoordsSize: s
|
|
4070
4370
|
};
|
|
4071
4371
|
}
|
|
4072
|
-
class
|
|
4372
|
+
class Ct extends w {
|
|
4073
4373
|
constructor() {
|
|
4074
|
-
super(...arguments), this.imageCount = 0, this.isPositionsUpToDate = !1, this.polygonPathLength = 0;
|
|
4374
|
+
super(...arguments), this.imageCount = 0, this.areClusterCentroidsUpToDate = !1, this.isPositionsUpToDate = !1, this.polygonPathLength = 0;
|
|
4075
4375
|
}
|
|
4076
4376
|
updatePositions() {
|
|
4077
4377
|
const { device: t, store: i, data: o, config: { rescalePositions: s, enableSimulation: n } } = this, { pointsTextureSize: r } = i;
|
|
4078
4378
|
if (!r || !o.pointPositions || o.pointsNumber === void 0) return;
|
|
4079
|
-
const a = r * r * 4,
|
|
4080
|
-
c !==
|
|
4379
|
+
const a = r * r * 4, d = new Float32Array(a), l = r * r * 4 * 4, c = d.byteLength;
|
|
4380
|
+
c !== l && console.error("Texture data size mismatch:", {
|
|
4081
4381
|
pointsTextureSize: r,
|
|
4082
|
-
expectedBytes:
|
|
4382
|
+
expectedBytes: l,
|
|
4083
4383
|
actualBytes: c,
|
|
4084
4384
|
textureDataSize: a,
|
|
4085
|
-
dataLength:
|
|
4385
|
+
dataLength: d.length
|
|
4086
4386
|
});
|
|
4087
4387
|
let f = s;
|
|
4088
4388
|
s === void 0 && !n && (f = !0), this.shouldSkipRescale && (f = !1), f ? this.rescaleInitialNodePositions() : this.shouldSkipRescale || (this.scaleX = void 0, this.scaleY = void 0), this.shouldSkipRescale = void 0;
|
|
4089
|
-
for (let
|
|
4090
|
-
|
|
4389
|
+
for (let p = 0; p < o.pointsNumber; ++p)
|
|
4390
|
+
d[p * 4 + 0] = o.pointPositions[p * 2 + 0], d[p * 4 + 1] = o.pointPositions[p * 2 + 1], d[p * 4 + 2] = p;
|
|
4091
4391
|
if (!this.currentPositionTexture || this.currentPositionTexture.width !== r || this.currentPositionTexture.height !== r ? (this.currentPositionTexture && !this.currentPositionTexture.destroyed && this.currentPositionTexture.destroy(), this.currentPositionFbo && !this.currentPositionFbo.destroyed && this.currentPositionFbo.destroy(), this.currentPositionTexture = t.createTexture({
|
|
4092
4392
|
width: r,
|
|
4093
4393
|
height: r,
|
|
4094
4394
|
format: "rgba32float"
|
|
4095
4395
|
}), this.currentPositionTexture.copyImageData({
|
|
4096
|
-
data:
|
|
4396
|
+
data: d,
|
|
4097
4397
|
bytesPerRow: T("rgba32float", r),
|
|
4098
4398
|
mipLevel: 0,
|
|
4099
4399
|
x: 0,
|
|
@@ -4103,7 +4403,7 @@ class At extends w {
|
|
|
4103
4403
|
height: r,
|
|
4104
4404
|
colorAttachments: [this.currentPositionTexture]
|
|
4105
4405
|
})) : this.currentPositionTexture.copyImageData({
|
|
4106
|
-
data:
|
|
4406
|
+
data: d,
|
|
4107
4407
|
bytesPerRow: T("rgba32float", r),
|
|
4108
4408
|
mipLevel: 0,
|
|
4109
4409
|
x: 0,
|
|
@@ -4113,7 +4413,7 @@ class At extends w {
|
|
|
4113
4413
|
height: r,
|
|
4114
4414
|
format: "rgba32float"
|
|
4115
4415
|
}), this.previousPositionTexture.copyImageData({
|
|
4116
|
-
data:
|
|
4416
|
+
data: d,
|
|
4117
4417
|
bytesPerRow: T("rgba32float", r),
|
|
4118
4418
|
mipLevel: 0,
|
|
4119
4419
|
x: 0,
|
|
@@ -4123,19 +4423,19 @@ class At extends w {
|
|
|
4123
4423
|
height: r,
|
|
4124
4424
|
colorAttachments: [this.previousPositionTexture]
|
|
4125
4425
|
})) : this.previousPositionTexture.copyImageData({
|
|
4126
|
-
data:
|
|
4426
|
+
data: d,
|
|
4127
4427
|
bytesPerRow: T("rgba32float", r),
|
|
4128
4428
|
mipLevel: 0,
|
|
4129
4429
|
x: 0,
|
|
4130
4430
|
y: 0
|
|
4131
4431
|
}), this.config.enableSimulation) {
|
|
4132
|
-
const
|
|
4432
|
+
const p = new Float32Array(r * r * 4).fill(0);
|
|
4133
4433
|
!this.velocityTexture || this.velocityTexture.width !== r || this.velocityTexture.height !== r ? (this.velocityTexture && !this.velocityTexture.destroyed && this.velocityTexture.destroy(), this.velocityFbo && !this.velocityFbo.destroyed && this.velocityFbo.destroy(), this.velocityTexture = t.createTexture({
|
|
4134
4434
|
width: r,
|
|
4135
4435
|
height: r,
|
|
4136
4436
|
format: "rgba32float"
|
|
4137
4437
|
}), this.velocityTexture.copyImageData({
|
|
4138
|
-
data:
|
|
4438
|
+
data: p,
|
|
4139
4439
|
bytesPerRow: T("rgba32float", r),
|
|
4140
4440
|
mipLevel: 0,
|
|
4141
4441
|
x: 0,
|
|
@@ -4145,7 +4445,7 @@ class At extends w {
|
|
|
4145
4445
|
height: r,
|
|
4146
4446
|
colorAttachments: [this.velocityTexture]
|
|
4147
4447
|
})) : this.velocityTexture.copyImageData({
|
|
4148
|
-
data:
|
|
4448
|
+
data: p,
|
|
4149
4449
|
bytesPerRow: T("rgba32float", r),
|
|
4150
4450
|
mipLevel: 0,
|
|
4151
4451
|
x: 0,
|
|
@@ -4157,7 +4457,7 @@ class At extends w {
|
|
|
4157
4457
|
height: r,
|
|
4158
4458
|
format: "rgba32float"
|
|
4159
4459
|
}), this.selectedTexture.copyImageData({
|
|
4160
|
-
data:
|
|
4460
|
+
data: d,
|
|
4161
4461
|
bytesPerRow: T("rgba32float", r),
|
|
4162
4462
|
mipLevel: 0,
|
|
4163
4463
|
x: 0,
|
|
@@ -4167,7 +4467,7 @@ class At extends w {
|
|
|
4167
4467
|
height: r,
|
|
4168
4468
|
colorAttachments: [this.selectedTexture]
|
|
4169
4469
|
})) : this.selectedTexture.copyImageData({
|
|
4170
|
-
data:
|
|
4470
|
+
data: d,
|
|
4171
4471
|
bytesPerRow: T("rgba32float", r),
|
|
4172
4472
|
mipLevel: 0,
|
|
4173
4473
|
x: 0,
|
|
@@ -4177,19 +4477,19 @@ class At extends w {
|
|
|
4177
4477
|
height: 2,
|
|
4178
4478
|
colorAttachments: ["rgba32float"]
|
|
4179
4479
|
}));
|
|
4180
|
-
const
|
|
4181
|
-
!this.drawPointIndices || this.drawPointIndices.byteLength !==
|
|
4182
|
-
data:
|
|
4480
|
+
const u = X(i.pointsTextureSize), h = u.byteLength;
|
|
4481
|
+
!this.drawPointIndices || this.drawPointIndices.byteLength !== h ? (this.drawPointIndices && !this.drawPointIndices.destroyed && this.drawPointIndices.destroy(), this.drawPointIndices = t.createBuffer({
|
|
4482
|
+
data: u,
|
|
4183
4483
|
usage: S.VERTEX | S.COPY_DST
|
|
4184
|
-
})) : this.drawPointIndices.write(
|
|
4484
|
+
})) : this.drawPointIndices.write(u), this.drawCommand && this.drawCommand.setAttributes({
|
|
4185
4485
|
pointIndices: this.drawPointIndices
|
|
4186
|
-
}), !this.hoveredPointIndices || this.hoveredPointIndices.byteLength !==
|
|
4187
|
-
data:
|
|
4486
|
+
}), !this.hoveredPointIndices || this.hoveredPointIndices.byteLength !== h ? (this.hoveredPointIndices && !this.hoveredPointIndices.destroyed && this.hoveredPointIndices.destroy(), this.hoveredPointIndices = t.createBuffer({
|
|
4487
|
+
data: u,
|
|
4188
4488
|
usage: S.VERTEX | S.COPY_DST
|
|
4189
|
-
})) : this.hoveredPointIndices.write(
|
|
4190
|
-
data:
|
|
4489
|
+
})) : this.hoveredPointIndices.write(u), !this.sampledPointIndices || this.sampledPointIndices.byteLength !== h ? (this.sampledPointIndices && !this.sampledPointIndices.destroyed && this.sampledPointIndices.destroy(), this.sampledPointIndices = t.createBuffer({
|
|
4490
|
+
data: u,
|
|
4191
4491
|
usage: S.VERTEX | S.COPY_DST
|
|
4192
|
-
})) : this.sampledPointIndices.write(
|
|
4492
|
+
})) : this.sampledPointIndices.write(u), this.fillSampledPointsFboCommand && this.fillSampledPointsFboCommand.setAttributes({
|
|
4193
4493
|
pointIndices: this.sampledPointIndices
|
|
4194
4494
|
}), this.updateGreyoutStatus(), this.updatePinnedStatus(), this.updateSampledPointsGrid(), this.trackPointsByIndices();
|
|
4195
4495
|
}
|
|
@@ -4198,7 +4498,7 @@ class At extends w {
|
|
|
4198
4498
|
const { device: t, config: i, store: o, data: s } = this;
|
|
4199
4499
|
(!this.imageAtlasCoordsTexture || !this.imageAtlasTexture) && this.createAtlas(), this.colorBuffer || this.updateColor(), this.sizeBuffer || this.updateSize(), this.shapeBuffer || this.updateShape(), this.imageIndicesBuffer || this.updateImageIndices(), this.imageSizesBuffer || this.updateImageSizes(), this.greyoutStatusTexture || this.updateGreyoutStatus(), i.enableSimulation && (this.updatePositionVertexCoordBuffer || (this.updatePositionVertexCoordBuffer = t.createBuffer({
|
|
4200
4500
|
data: new Float32Array([-1, -1, 1, -1, -1, 1, 1, 1])
|
|
4201
|
-
})), this.updatePositionUniformStore || (this.updatePositionUniformStore = new
|
|
4501
|
+
})), this.updatePositionUniformStore || (this.updatePositionUniformStore = new R({
|
|
4202
4502
|
updatePositionUniforms: {
|
|
4203
4503
|
uniformTypes: {
|
|
4204
4504
|
// Order MUST match shader declaration order (std140 layout)
|
|
@@ -4206,13 +4506,13 @@ class At extends w {
|
|
|
4206
4506
|
spaceSize: "f32"
|
|
4207
4507
|
},
|
|
4208
4508
|
defaultUniforms: {
|
|
4209
|
-
friction: i.simulationFriction
|
|
4210
|
-
spaceSize: o.adjustedSpaceSize
|
|
4509
|
+
friction: i.simulationFriction,
|
|
4510
|
+
spaceSize: o.adjustedSpaceSize
|
|
4211
4511
|
}
|
|
4212
4512
|
}
|
|
4213
|
-
})), this.updatePositionCommand || (this.updatePositionCommand = new
|
|
4214
|
-
fs:
|
|
4215
|
-
vs:
|
|
4513
|
+
})), this.updatePositionCommand || (this.updatePositionCommand = new x(t, {
|
|
4514
|
+
fs: pt,
|
|
4515
|
+
vs: D,
|
|
4216
4516
|
topology: "triangle-strip",
|
|
4217
4517
|
vertexCount: 4,
|
|
4218
4518
|
attributes: {
|
|
@@ -4232,7 +4532,7 @@ class At extends w {
|
|
|
4232
4532
|
}
|
|
4233
4533
|
}))), this.dragPointVertexCoordBuffer || (this.dragPointVertexCoordBuffer = t.createBuffer({
|
|
4234
4534
|
data: new Float32Array([-1, -1, 1, -1, -1, 1, 1, 1])
|
|
4235
|
-
})), this.dragPointUniformStore || (this.dragPointUniformStore = new
|
|
4535
|
+
})), this.dragPointUniformStore || (this.dragPointUniformStore = new R({
|
|
4236
4536
|
dragPointUniforms: {
|
|
4237
4537
|
uniformTypes: {
|
|
4238
4538
|
// Order MUST match shader declaration order (std140 layout)
|
|
@@ -4240,13 +4540,13 @@ class At extends w {
|
|
|
4240
4540
|
index: "f32"
|
|
4241
4541
|
},
|
|
4242
4542
|
defaultUniforms: {
|
|
4243
|
-
mousePos:
|
|
4543
|
+
mousePos: _(o.mousePosition, [0, 0]),
|
|
4244
4544
|
index: ((n = o.hoveredPoint) == null ? void 0 : n.index) ?? -1
|
|
4245
4545
|
}
|
|
4246
4546
|
}
|
|
4247
|
-
})), this.dragPointCommand || (this.dragPointCommand = new
|
|
4248
|
-
fs:
|
|
4249
|
-
vs:
|
|
4547
|
+
})), this.dragPointCommand || (this.dragPointCommand = new x(t, {
|
|
4548
|
+
fs: Tt,
|
|
4549
|
+
vs: D,
|
|
4250
4550
|
topology: "triangle-strip",
|
|
4251
4551
|
vertexCount: 4,
|
|
4252
4552
|
attributes: {
|
|
@@ -4264,7 +4564,7 @@ class At extends w {
|
|
|
4264
4564
|
dragPointUniforms: this.dragPointUniformStore.getManagedUniformBuffer(t, "dragPointUniforms")
|
|
4265
4565
|
// All texture bindings will be set dynamically in drag() method
|
|
4266
4566
|
}
|
|
4267
|
-
})), this.drawUniformStore || (this.drawUniformStore = new
|
|
4567
|
+
})), this.drawUniformStore || (this.drawUniformStore = new R({
|
|
4268
4568
|
drawVertexUniforms: {
|
|
4269
4569
|
uniformTypes: {
|
|
4270
4570
|
// Order MUST match shader declaration order (std140 layout)
|
|
@@ -4287,21 +4587,21 @@ class At extends w {
|
|
|
4287
4587
|
},
|
|
4288
4588
|
defaultUniforms: {
|
|
4289
4589
|
// Order MUST match uniformTypes and shader declaration
|
|
4290
|
-
ratio: i.pixelRatio
|
|
4590
|
+
ratio: i.pixelRatio,
|
|
4291
4591
|
transformationMatrix: (() => {
|
|
4292
|
-
const
|
|
4592
|
+
const d = o.transform ?? [1, 0, 0, 0, 1, 0, 0, 0, 1];
|
|
4293
4593
|
return [
|
|
4294
|
-
|
|
4295
|
-
|
|
4296
|
-
|
|
4594
|
+
d[0],
|
|
4595
|
+
d[1],
|
|
4596
|
+
d[2],
|
|
4297
4597
|
0,
|
|
4298
|
-
|
|
4299
|
-
|
|
4300
|
-
|
|
4598
|
+
d[3],
|
|
4599
|
+
d[4],
|
|
4600
|
+
d[5],
|
|
4301
4601
|
0,
|
|
4302
|
-
|
|
4303
|
-
|
|
4304
|
-
|
|
4602
|
+
d[6],
|
|
4603
|
+
d[7],
|
|
4604
|
+
d[8],
|
|
4305
4605
|
0,
|
|
4306
4606
|
0,
|
|
4307
4607
|
0,
|
|
@@ -4310,14 +4610,14 @@ class At extends w {
|
|
|
4310
4610
|
];
|
|
4311
4611
|
})(),
|
|
4312
4612
|
pointsTextureSize: o.pointsTextureSize ?? 0,
|
|
4313
|
-
sizeScale: i.pointSizeScale
|
|
4314
|
-
spaceSize: o.adjustedSpaceSize
|
|
4315
|
-
screenSize:
|
|
4316
|
-
greyoutColor:
|
|
4317
|
-
backgroundColor:
|
|
4318
|
-
scalePointsOnZoom: i.scalePointsOnZoom
|
|
4613
|
+
sizeScale: i.pointSizeScale,
|
|
4614
|
+
spaceSize: o.adjustedSpaceSize,
|
|
4615
|
+
screenSize: _(o.screenSize, [0, 0]),
|
|
4616
|
+
greyoutColor: A(o.greyoutPointColor, [0, 0, 0, 1]),
|
|
4617
|
+
backgroundColor: A(o.backgroundColor, [0, 0, 0, 1]),
|
|
4618
|
+
scalePointsOnZoom: i.scalePointsOnZoom ? 1 : 0,
|
|
4319
4619
|
// Convert boolean to float
|
|
4320
|
-
maxPointSize: o.maxPointSize
|
|
4620
|
+
maxPointSize: o.maxPointSize,
|
|
4321
4621
|
isDarkenGreyout: o.isDarkenGreyout ?? !1 ? 1 : 0,
|
|
4322
4622
|
// Convert boolean to float
|
|
4323
4623
|
skipSelected: 0,
|
|
@@ -4338,16 +4638,17 @@ class At extends w {
|
|
|
4338
4638
|
backgroundColor: "vec4<f32>"
|
|
4339
4639
|
},
|
|
4340
4640
|
defaultUniforms: {
|
|
4641
|
+
// -1 is a sentinel value for the shader: when greyoutOpacity is -1, the shader skips opacity override (i.e. "not set")
|
|
4341
4642
|
greyoutOpacity: i.pointGreyoutOpacity ?? -1,
|
|
4342
|
-
pointOpacity: i.pointOpacity
|
|
4643
|
+
pointOpacity: i.pointOpacity,
|
|
4343
4644
|
isDarkenGreyout: o.isDarkenGreyout ?? !1 ? 1 : 0,
|
|
4344
4645
|
// Convert boolean to float
|
|
4345
|
-
backgroundColor:
|
|
4646
|
+
backgroundColor: A(o.backgroundColor, [0, 0, 0, 1])
|
|
4346
4647
|
}
|
|
4347
4648
|
}
|
|
4348
|
-
})), this.drawCommand || (this.drawCommand = new
|
|
4349
|
-
fs:
|
|
4350
|
-
vs:
|
|
4649
|
+
})), this.drawCommand || (this.drawCommand = new x(t, {
|
|
4650
|
+
fs: nt,
|
|
4651
|
+
vs: rt,
|
|
4351
4652
|
topology: "point-list",
|
|
4352
4653
|
vertexCount: s.pointsNumber ?? 0,
|
|
4353
4654
|
attributes: {
|
|
@@ -4389,7 +4690,7 @@ class At extends w {
|
|
|
4389
4690
|
}
|
|
4390
4691
|
})), this.findPointsOnAreaSelectionVertexCoordBuffer || (this.findPointsOnAreaSelectionVertexCoordBuffer = t.createBuffer({
|
|
4391
4692
|
data: new Float32Array([-1, -1, 1, -1, -1, 1, 1, 1])
|
|
4392
|
-
})), this.findPointsOnAreaSelectionUniformStore || (this.findPointsOnAreaSelectionUniformStore = new
|
|
4693
|
+
})), this.findPointsOnAreaSelectionUniformStore || (this.findPointsOnAreaSelectionUniformStore = new R({
|
|
4393
4694
|
findPointsOnAreaSelectionUniforms: {
|
|
4394
4695
|
uniformTypes: {
|
|
4395
4696
|
// Order MUST match shader declaration order (std140 layout)
|
|
@@ -4404,20 +4705,20 @@ class At extends w {
|
|
|
4404
4705
|
maxPointSize: "f32"
|
|
4405
4706
|
},
|
|
4406
4707
|
defaultUniforms: {
|
|
4407
|
-
sizeScale: i.pointSizeScale
|
|
4408
|
-
spaceSize: o.adjustedSpaceSize
|
|
4409
|
-
screenSize:
|
|
4410
|
-
ratio: i.pixelRatio
|
|
4708
|
+
sizeScale: i.pointSizeScale,
|
|
4709
|
+
spaceSize: o.adjustedSpaceSize,
|
|
4710
|
+
screenSize: _(o.screenSize, [0, 0]),
|
|
4711
|
+
ratio: i.pixelRatio,
|
|
4411
4712
|
transformationMatrix: o.transformationMatrix4x4,
|
|
4412
|
-
selection0:
|
|
4413
|
-
selection1:
|
|
4414
|
-
scalePointsOnZoom: i.scalePointsOnZoom
|
|
4415
|
-
maxPointSize: o.maxPointSize
|
|
4713
|
+
selection0: _((r = o.selectedArea) == null ? void 0 : r[0], [0, 0]),
|
|
4714
|
+
selection1: _((a = o.selectedArea) == null ? void 0 : a[1], [0, 0]),
|
|
4715
|
+
scalePointsOnZoom: i.scalePointsOnZoom ? 1 : 0,
|
|
4716
|
+
maxPointSize: o.maxPointSize
|
|
4416
4717
|
}
|
|
4417
4718
|
}
|
|
4418
|
-
})), this.findPointsOnAreaSelectionCommand || (this.findPointsOnAreaSelectionCommand = new
|
|
4419
|
-
fs:
|
|
4420
|
-
vs:
|
|
4719
|
+
})), this.findPointsOnAreaSelectionCommand || (this.findPointsOnAreaSelectionCommand = new x(t, {
|
|
4720
|
+
fs: at,
|
|
4721
|
+
vs: D,
|
|
4421
4722
|
topology: "triangle-strip",
|
|
4422
4723
|
vertexCount: 4,
|
|
4423
4724
|
attributes: {
|
|
@@ -4437,7 +4738,7 @@ class At extends w {
|
|
|
4437
4738
|
}
|
|
4438
4739
|
})), this.findPointsOnPolygonSelectionVertexCoordBuffer || (this.findPointsOnPolygonSelectionVertexCoordBuffer = t.createBuffer({
|
|
4439
4740
|
data: new Float32Array([-1, -1, 1, -1, -1, 1, 1, 1])
|
|
4440
|
-
})), this.findPointsOnPolygonSelectionUniformStore || (this.findPointsOnPolygonSelectionUniformStore = new
|
|
4741
|
+
})), this.findPointsOnPolygonSelectionUniformStore || (this.findPointsOnPolygonSelectionUniformStore = new R({
|
|
4441
4742
|
findPointsOnPolygonSelectionUniforms: {
|
|
4442
4743
|
uniformTypes: {
|
|
4443
4744
|
// Order MUST match shader declaration order (std140 layout)
|
|
@@ -4447,15 +4748,15 @@ class At extends w {
|
|
|
4447
4748
|
polygonPathLength: "f32"
|
|
4448
4749
|
},
|
|
4449
4750
|
defaultUniforms: {
|
|
4450
|
-
spaceSize: o.adjustedSpaceSize
|
|
4451
|
-
screenSize:
|
|
4751
|
+
spaceSize: o.adjustedSpaceSize,
|
|
4752
|
+
screenSize: _(o.screenSize, [0, 0]),
|
|
4452
4753
|
transformationMatrix: o.transformationMatrix4x4,
|
|
4453
4754
|
polygonPathLength: this.polygonPathLength
|
|
4454
4755
|
}
|
|
4455
4756
|
}
|
|
4456
|
-
})), this.findPointsOnPolygonSelectionCommand || (this.findPointsOnPolygonSelectionCommand = new
|
|
4457
|
-
fs:
|
|
4458
|
-
vs:
|
|
4757
|
+
})), this.findPointsOnPolygonSelectionCommand || (this.findPointsOnPolygonSelectionCommand = new x(t, {
|
|
4758
|
+
fs: dt,
|
|
4759
|
+
vs: D,
|
|
4459
4760
|
topology: "triangle-strip",
|
|
4460
4761
|
vertexCount: 4,
|
|
4461
4762
|
attributes: {
|
|
@@ -4473,7 +4774,7 @@ class At extends w {
|
|
|
4473
4774
|
findPointsOnPolygonSelectionUniforms: this.findPointsOnPolygonSelectionUniformStore.getManagedUniformBuffer(t, "findPointsOnPolygonSelectionUniforms")
|
|
4474
4775
|
// All texture bindings will be set dynamically in findPointsOnPolygonSelection() method
|
|
4475
4776
|
}
|
|
4476
|
-
})), this.findHoveredPointUniformStore || (this.findHoveredPointUniformStore = new
|
|
4777
|
+
})), this.findHoveredPointUniformStore || (this.findHoveredPointUniformStore = new R({
|
|
4477
4778
|
findHoveredPointUniforms: {
|
|
4478
4779
|
uniformTypes: {
|
|
4479
4780
|
// Order MUST match shader declaration order (std140 layout)
|
|
@@ -4491,30 +4792,32 @@ class At extends w {
|
|
|
4491
4792
|
},
|
|
4492
4793
|
defaultUniforms: {
|
|
4493
4794
|
pointsTextureSize: o.pointsTextureSize ?? 0,
|
|
4494
|
-
sizeScale: i.pointSizeScale
|
|
4495
|
-
spaceSize: o.adjustedSpaceSize
|
|
4496
|
-
screenSize:
|
|
4497
|
-
ratio: i.pixelRatio
|
|
4795
|
+
sizeScale: i.pointSizeScale,
|
|
4796
|
+
spaceSize: o.adjustedSpaceSize,
|
|
4797
|
+
screenSize: _(o.screenSize, [0, 0]),
|
|
4798
|
+
ratio: i.pixelRatio,
|
|
4498
4799
|
transformationMatrix: o.transformationMatrix4x4,
|
|
4499
|
-
mousePosition:
|
|
4500
|
-
scalePointsOnZoom: i.scalePointsOnZoom
|
|
4501
|
-
maxPointSize: o.maxPointSize
|
|
4800
|
+
mousePosition: _(o.screenMousePosition, [0, 0]),
|
|
4801
|
+
scalePointsOnZoom: i.scalePointsOnZoom ? 1 : 0,
|
|
4802
|
+
maxPointSize: o.maxPointSize,
|
|
4502
4803
|
skipSelected: 0,
|
|
4503
4804
|
skipUnselected: 0
|
|
4504
4805
|
}
|
|
4505
4806
|
}
|
|
4506
|
-
})), this.findHoveredPointCommand || (this.findHoveredPointCommand = new
|
|
4507
|
-
fs:
|
|
4508
|
-
vs:
|
|
4807
|
+
})), this.findHoveredPointCommand || (this.findHoveredPointCommand = new x(t, {
|
|
4808
|
+
fs: ft,
|
|
4809
|
+
vs: ht,
|
|
4509
4810
|
topology: "point-list",
|
|
4510
4811
|
vertexCount: s.pointsNumber ?? 0,
|
|
4511
4812
|
attributes: {
|
|
4512
4813
|
...this.hoveredPointIndices && { pointIndices: this.hoveredPointIndices },
|
|
4513
|
-
...this.sizeBuffer && { size: this.sizeBuffer }
|
|
4814
|
+
...this.sizeBuffer && { size: this.sizeBuffer },
|
|
4815
|
+
...this.imageSizesBuffer && { imageSize: this.imageSizesBuffer }
|
|
4514
4816
|
},
|
|
4515
4817
|
bufferLayout: [
|
|
4516
4818
|
{ name: "pointIndices", format: "float32x2" },
|
|
4517
|
-
{ name: "size", format: "float32" }
|
|
4819
|
+
{ name: "size", format: "float32" },
|
|
4820
|
+
{ name: "imageSize", format: "float32" }
|
|
4518
4821
|
],
|
|
4519
4822
|
defines: {
|
|
4520
4823
|
USE_UNIFORM_BUFFERS: !0
|
|
@@ -4531,7 +4834,7 @@ class At extends w {
|
|
|
4531
4834
|
blend: !1
|
|
4532
4835
|
// Disable blending - we want to overwrite, not blend
|
|
4533
4836
|
}
|
|
4534
|
-
})), this.fillSampledPointsUniformStore || (this.fillSampledPointsUniformStore = new
|
|
4837
|
+
})), this.fillSampledPointsUniformStore || (this.fillSampledPointsUniformStore = new R({
|
|
4535
4838
|
fillSampledPointsUniforms: {
|
|
4536
4839
|
uniformTypes: {
|
|
4537
4840
|
// Order MUST match shader declaration order (std140 layout)
|
|
@@ -4543,13 +4846,13 @@ class At extends w {
|
|
|
4543
4846
|
defaultUniforms: {
|
|
4544
4847
|
pointsTextureSize: o.pointsTextureSize ?? 0,
|
|
4545
4848
|
transformationMatrix: o.transformationMatrix4x4,
|
|
4546
|
-
spaceSize: o.adjustedSpaceSize
|
|
4547
|
-
screenSize:
|
|
4849
|
+
spaceSize: o.adjustedSpaceSize,
|
|
4850
|
+
screenSize: _(o.screenSize, [0, 0])
|
|
4548
4851
|
}
|
|
4549
4852
|
}
|
|
4550
|
-
})), this.fillSampledPointsFboCommand || (this.fillSampledPointsFboCommand = new
|
|
4551
|
-
fs:
|
|
4552
|
-
vs:
|
|
4853
|
+
})), this.fillSampledPointsFboCommand || (this.fillSampledPointsFboCommand = new x(t, {
|
|
4854
|
+
fs: ut,
|
|
4855
|
+
vs: St,
|
|
4553
4856
|
topology: "point-list",
|
|
4554
4857
|
vertexCount: s.pointsNumber ?? 0,
|
|
4555
4858
|
attributes: {
|
|
@@ -4573,7 +4876,7 @@ class At extends w {
|
|
|
4573
4876
|
}
|
|
4574
4877
|
})), this.drawHighlightedVertexCoordBuffer || (this.drawHighlightedVertexCoordBuffer = t.createBuffer({
|
|
4575
4878
|
data: new Float32Array([-1, -1, 1, -1, -1, 1, 1, 1])
|
|
4576
|
-
})), this.drawHighlightedUniformStore || (this.drawHighlightedUniformStore = new
|
|
4879
|
+
})), this.drawHighlightedUniformStore || (this.drawHighlightedUniformStore = new R({
|
|
4577
4880
|
drawHighlightedUniforms: {
|
|
4578
4881
|
uniformTypes: {
|
|
4579
4882
|
// Order MUST match shader declaration order (std140 layout)
|
|
@@ -4600,24 +4903,25 @@ class At extends w {
|
|
|
4600
4903
|
size: 1,
|
|
4601
4904
|
transformationMatrix: o.transformationMatrix4x4,
|
|
4602
4905
|
pointsTextureSize: o.pointsTextureSize ?? 0,
|
|
4603
|
-
sizeScale: i.pointSizeScale
|
|
4604
|
-
spaceSize: o.adjustedSpaceSize
|
|
4605
|
-
screenSize:
|
|
4606
|
-
scalePointsOnZoom: i.scalePointsOnZoom
|
|
4906
|
+
sizeScale: i.pointSizeScale,
|
|
4907
|
+
spaceSize: o.adjustedSpaceSize,
|
|
4908
|
+
screenSize: _(o.screenSize, [0, 0]),
|
|
4909
|
+
scalePointsOnZoom: i.scalePointsOnZoom ? 1 : 0,
|
|
4607
4910
|
pointIndex: -1,
|
|
4608
|
-
maxPointSize: o.maxPointSize
|
|
4911
|
+
maxPointSize: o.maxPointSize,
|
|
4609
4912
|
color: [0, 0, 0, 1],
|
|
4610
|
-
universalPointOpacity: i.pointOpacity
|
|
4913
|
+
universalPointOpacity: i.pointOpacity,
|
|
4914
|
+
// -1 is a sentinel value for the shader: when greyoutOpacity is -1, the shader skips opacity override (i.e. "not set")
|
|
4611
4915
|
greyoutOpacity: i.pointGreyoutOpacity ?? -1,
|
|
4612
4916
|
isDarkenGreyout: o.isDarkenGreyout ?? !1 ? 1 : 0,
|
|
4613
|
-
backgroundColor:
|
|
4614
|
-
greyoutColor:
|
|
4917
|
+
backgroundColor: A(o.backgroundColor, [0, 0, 0, 1]),
|
|
4918
|
+
greyoutColor: A(o.greyoutPointColor, [0, 0, 0, 1]),
|
|
4615
4919
|
width: 0.85
|
|
4616
4920
|
}
|
|
4617
4921
|
}
|
|
4618
|
-
})), this.drawHighlightedCommand || (this.drawHighlightedCommand = new
|
|
4619
|
-
fs:
|
|
4620
|
-
vs:
|
|
4922
|
+
})), this.drawHighlightedCommand || (this.drawHighlightedCommand = new x(t, {
|
|
4923
|
+
fs: lt,
|
|
4924
|
+
vs: ct,
|
|
4621
4925
|
topology: "triangle-strip",
|
|
4622
4926
|
vertexCount: 4,
|
|
4623
4927
|
attributes: {
|
|
@@ -4648,7 +4952,7 @@ class At extends w {
|
|
|
4648
4952
|
}
|
|
4649
4953
|
})), this.trackPointsVertexCoordBuffer || (this.trackPointsVertexCoordBuffer = t.createBuffer({
|
|
4650
4954
|
data: new Float32Array([-1, -1, 1, -1, -1, 1, 1, 1])
|
|
4651
|
-
})), this.trackPointsUniformStore || (this.trackPointsUniformStore = new
|
|
4955
|
+
})), this.trackPointsUniformStore || (this.trackPointsUniformStore = new R({
|
|
4652
4956
|
trackPointsUniforms: {
|
|
4653
4957
|
uniformTypes: {
|
|
4654
4958
|
// Order MUST match shader declaration order (std140 layout)
|
|
@@ -4658,9 +4962,9 @@ class At extends w {
|
|
|
4658
4962
|
pointsTextureSize: o.pointsTextureSize ?? 0
|
|
4659
4963
|
}
|
|
4660
4964
|
}
|
|
4661
|
-
})), this.trackPointsCommand || (this.trackPointsCommand = new
|
|
4662
|
-
fs:
|
|
4663
|
-
vs:
|
|
4965
|
+
})), this.trackPointsCommand || (this.trackPointsCommand = new x(t, {
|
|
4966
|
+
fs: _t,
|
|
4967
|
+
vs: D,
|
|
4664
4968
|
topology: "triangle-strip",
|
|
4665
4969
|
vertexCount: 4,
|
|
4666
4970
|
attributes: {
|
|
@@ -4742,6 +5046,7 @@ class At extends w {
|
|
|
4742
5046
|
});
|
|
4743
5047
|
}
|
|
4744
5048
|
updateSize() {
|
|
5049
|
+
var a;
|
|
4745
5050
|
const { device: t, store: { pointsTextureSize: i }, data: o } = this;
|
|
4746
5051
|
if (!i || o.pointsNumber === void 0 || o.pointSizes === void 0) return;
|
|
4747
5052
|
const s = o.pointSizes, n = s.byteLength;
|
|
@@ -4752,8 +5057,10 @@ class At extends w {
|
|
|
4752
5057
|
size: this.sizeBuffer
|
|
4753
5058
|
});
|
|
4754
5059
|
const r = new Float32Array(i * i * 4);
|
|
4755
|
-
for (let
|
|
4756
|
-
|
|
5060
|
+
for (let d = 0; d < o.pointsNumber; d++) {
|
|
5061
|
+
const l = o.pointSizes[d], c = ((a = o.pointImageSizes) == null ? void 0 : a[d]) ?? l;
|
|
5062
|
+
r[d * 4] = Math.max(l, c);
|
|
5063
|
+
}
|
|
4757
5064
|
!this.sizeTexture || this.sizeTexture.width !== i || this.sizeTexture.height !== i ? (this.sizeTexture && !this.sizeTexture.destroyed && this.sizeTexture.destroy(), this.sizeTexture = t.createTexture({
|
|
4758
5065
|
width: i,
|
|
4759
5066
|
height: i,
|
|
@@ -4803,12 +5110,14 @@ class At extends w {
|
|
|
4803
5110
|
usage: S.VERTEX | S.COPY_DST
|
|
4804
5111
|
})) : this.imageSizesBuffer.write(o), this.drawCommand && this.drawCommand.setAttributes({
|
|
4805
5112
|
imageSize: this.imageSizesBuffer
|
|
5113
|
+
}), this.findHoveredPointCommand && this.findHoveredPointCommand.setAttributes({
|
|
5114
|
+
imageSize: this.imageSizesBuffer
|
|
4806
5115
|
});
|
|
4807
5116
|
}
|
|
4808
5117
|
createAtlas() {
|
|
4809
|
-
var
|
|
5118
|
+
var l;
|
|
4810
5119
|
const { device: t, data: i, store: o } = this;
|
|
4811
|
-
if (!((
|
|
5120
|
+
if (!((l = i.inputImageData) != null && l.length)) {
|
|
4812
5121
|
this.imageCount = 0, this.imageAtlasCoordsTextureSize = 0, this.imageAtlasCoordsTexture || (this.imageAtlasCoordsTexture = t.createTexture({
|
|
4813
5122
|
data: new Float32Array(4).fill(0),
|
|
4814
5123
|
width: 1,
|
|
@@ -4822,14 +5131,14 @@ class At extends w {
|
|
|
4822
5131
|
}));
|
|
4823
5132
|
return;
|
|
4824
5133
|
}
|
|
4825
|
-
const s =
|
|
5134
|
+
const s = gt(i.inputImageData, o.webglMaxTextureSize);
|
|
4826
5135
|
if (!s) {
|
|
4827
5136
|
console.warn("Failed to create atlas from image data");
|
|
4828
5137
|
return;
|
|
4829
5138
|
}
|
|
4830
5139
|
this.imageCount = i.inputImageData.length;
|
|
4831
|
-
const { atlasData: n, atlasSize: r, atlasCoords: a, atlasCoordsSize:
|
|
4832
|
-
this.imageAtlasCoordsTextureSize =
|
|
5140
|
+
const { atlasData: n, atlasSize: r, atlasCoords: a, atlasCoordsSize: d } = s;
|
|
5141
|
+
this.imageAtlasCoordsTextureSize = d, this.imageAtlasTexture && !this.imageAtlasTexture.destroyed && this.imageAtlasTexture.destroy(), this.imageAtlasTexture = t.createTexture({
|
|
4833
5142
|
width: r,
|
|
4834
5143
|
height: r,
|
|
4835
5144
|
format: "rgba8unorm"
|
|
@@ -4841,13 +5150,13 @@ class At extends w {
|
|
|
4841
5150
|
x: 0,
|
|
4842
5151
|
y: 0
|
|
4843
5152
|
}), this.imageAtlasCoordsTexture && !this.imageAtlasCoordsTexture.destroyed && this.imageAtlasCoordsTexture.destroy(), this.imageAtlasCoordsTexture = t.createTexture({
|
|
4844
|
-
width:
|
|
4845
|
-
height:
|
|
5153
|
+
width: d,
|
|
5154
|
+
height: d,
|
|
4846
5155
|
format: "rgba32float"
|
|
4847
5156
|
}), this.imageAtlasCoordsTexture.copyImageData({
|
|
4848
5157
|
data: a,
|
|
4849
|
-
bytesPerRow: T("rgba32float",
|
|
4850
|
-
rowsPerImage:
|
|
5158
|
+
bytesPerRow: T("rgba32float", d),
|
|
5159
|
+
rowsPerImage: d,
|
|
4851
5160
|
mipLevel: 0,
|
|
4852
5161
|
x: 0,
|
|
4853
5162
|
y: 0
|
|
@@ -4856,9 +5165,9 @@ class At extends w {
|
|
|
4856
5165
|
updateSampledPointsGrid() {
|
|
4857
5166
|
const { store: { screenSize: t }, config: { pointSamplingDistance: i }, device: o } = this;
|
|
4858
5167
|
let s = i ?? Math.min(...t) / 2;
|
|
4859
|
-
s === 0 && (s =
|
|
5168
|
+
s === 0 && (s = k.pointSamplingDistance);
|
|
4860
5169
|
const n = Math.ceil(t[0] / s), r = Math.ceil(t[1] / s);
|
|
4861
|
-
(!this.sampledPointsFbo || this.sampledPointsFbo.width !== n || this.sampledPointsFbo.height !== r) && (this.sampledPointsFbo && !this.sampledPointsFbo.destroyed && this.sampledPointsFbo.destroy(), this.sampledPointsFbo = o.createFramebuffer({
|
|
5170
|
+
n === 0 || r === 0 || (!this.sampledPointsFbo || this.sampledPointsFbo.width !== n || this.sampledPointsFbo.height !== r) && (this.sampledPointsFbo && !this.sampledPointsFbo.destroyed && this.sampledPointsFbo.destroy(), this.sampledPointsFbo = o.createFramebuffer({
|
|
4862
5171
|
width: n,
|
|
4863
5172
|
height: r,
|
|
4864
5173
|
colorAttachments: ["rgba32float"]
|
|
@@ -4881,23 +5190,23 @@ class At extends w {
|
|
|
4881
5190
|
this.trackPointsCommand.draw(t), t.end();
|
|
4882
5191
|
}
|
|
4883
5192
|
draw(t) {
|
|
4884
|
-
var a, l;
|
|
5193
|
+
var a, d, l, c;
|
|
4885
5194
|
const { data: i, config: o, store: s } = this;
|
|
4886
5195
|
if (this.colorBuffer || this.updateColor(), this.sizeBuffer || this.updateSize(), this.shapeBuffer || this.updateShape(), this.imageIndicesBuffer || this.updateImageIndices(), this.imageSizesBuffer || this.updateImageSizes(), !this.drawCommand || !this.drawUniformStore || !this.currentPositionTexture || this.currentPositionTexture.destroyed || !this.greyoutStatusTexture || this.greyoutStatusTexture.destroyed || (!this.imageAtlasTexture || !this.imageAtlasCoordsTexture) && (this.createAtlas(), !this.imageAtlasTexture || !this.imageAtlasCoordsTexture) || this.imageAtlasTexture.destroyed || this.imageAtlasCoordsTexture.destroyed || !i.pointsNumber || i.pointsNumber === 0 || !s.screenSize || s.screenSize[0] === 0 || s.screenSize[1] === 0)
|
|
4887
5196
|
return;
|
|
4888
5197
|
this.drawCommand.setVertexCount(i.pointsNumber);
|
|
4889
5198
|
const n = {
|
|
4890
|
-
ratio: o.pixelRatio
|
|
5199
|
+
ratio: o.pixelRatio,
|
|
4891
5200
|
transformationMatrix: s.transformationMatrix4x4,
|
|
4892
5201
|
pointsTextureSize: s.pointsTextureSize ?? 0,
|
|
4893
|
-
sizeScale: o.pointSizeScale
|
|
4894
|
-
spaceSize: s.adjustedSpaceSize
|
|
4895
|
-
screenSize:
|
|
4896
|
-
greyoutColor:
|
|
4897
|
-
backgroundColor:
|
|
4898
|
-
scalePointsOnZoom: o.scalePointsOnZoom
|
|
5202
|
+
sizeScale: o.pointSizeScale,
|
|
5203
|
+
spaceSize: s.adjustedSpaceSize,
|
|
5204
|
+
screenSize: _(s.screenSize, [0, 0]),
|
|
5205
|
+
greyoutColor: A(s.greyoutPointColor, [-1, -1, -1, -1]),
|
|
5206
|
+
backgroundColor: A(s.backgroundColor, [0, 0, 0, 1]),
|
|
5207
|
+
scalePointsOnZoom: o.scalePointsOnZoom ? 1 : 0,
|
|
4899
5208
|
// Convert boolean to float
|
|
4900
|
-
maxPointSize: s.maxPointSize
|
|
5209
|
+
maxPointSize: s.maxPointSize,
|
|
4901
5210
|
isDarkenGreyout: s.isDarkenGreyout ?? !1 ? 1 : 0,
|
|
4902
5211
|
// Convert boolean to float
|
|
4903
5212
|
hasImages: this.imageCount > 0 ? 1 : 0,
|
|
@@ -4905,11 +5214,12 @@ class At extends w {
|
|
|
4905
5214
|
imageCount: this.imageCount,
|
|
4906
5215
|
imageAtlasCoordsTextureSize: this.imageAtlasCoordsTextureSize ?? 0
|
|
4907
5216
|
}, r = {
|
|
5217
|
+
// -1 is a sentinel value for the shader: when greyoutOpacity is -1, the shader skips opacity override (i.e. "not set")
|
|
4908
5218
|
greyoutOpacity: o.pointGreyoutOpacity ?? -1,
|
|
4909
|
-
pointOpacity: o.pointOpacity
|
|
5219
|
+
pointOpacity: o.pointOpacity,
|
|
4910
5220
|
isDarkenGreyout: s.isDarkenGreyout ?? !1 ? 1 : 0,
|
|
4911
5221
|
// Convert boolean to float
|
|
4912
|
-
backgroundColor:
|
|
5222
|
+
backgroundColor: A(s.backgroundColor, [0, 0, 0, 1])
|
|
4913
5223
|
};
|
|
4914
5224
|
if (s.selectedIndices && s.selectedIndices.length > 0 ? (this.drawUniformStore.setUniforms({
|
|
4915
5225
|
drawVertexUniforms: {
|
|
@@ -4955,24 +5265,25 @@ class At extends w {
|
|
|
4955
5265
|
imageAtlasCoords: this.imageAtlasCoordsTexture
|
|
4956
5266
|
}), this.drawCommand.draw(t)), o.renderHoveredPointRing && s.hoveredPoint && this.drawHighlightedCommand && this.drawHighlightedUniformStore) {
|
|
4957
5267
|
if (!this.currentPositionTexture || this.currentPositionTexture.destroyed || !this.greyoutStatusTexture || this.greyoutStatusTexture.destroyed) return;
|
|
4958
|
-
const
|
|
5268
|
+
const f = ((a = i.pointSizes) == null ? void 0 : a[s.hoveredPoint.index]) ?? 1, u = ((d = i.pointImageSizes) == null ? void 0 : d[s.hoveredPoint.index]) ?? f;
|
|
4959
5269
|
this.drawHighlightedUniformStore.setUniforms({
|
|
4960
5270
|
drawHighlightedUniforms: {
|
|
4961
|
-
size:
|
|
5271
|
+
size: Math.max(f, u),
|
|
4962
5272
|
transformationMatrix: s.transformationMatrix4x4,
|
|
4963
5273
|
pointsTextureSize: s.pointsTextureSize ?? 0,
|
|
4964
|
-
sizeScale: o.pointSizeScale
|
|
4965
|
-
spaceSize: s.adjustedSpaceSize
|
|
4966
|
-
screenSize:
|
|
4967
|
-
scalePointsOnZoom: o.scalePointsOnZoom
|
|
5274
|
+
sizeScale: o.pointSizeScale,
|
|
5275
|
+
spaceSize: s.adjustedSpaceSize,
|
|
5276
|
+
screenSize: _(s.screenSize, [0, 0]),
|
|
5277
|
+
scalePointsOnZoom: o.scalePointsOnZoom ? 1 : 0,
|
|
4968
5278
|
pointIndex: s.hoveredPoint.index,
|
|
4969
|
-
maxPointSize: s.maxPointSize
|
|
4970
|
-
color:
|
|
4971
|
-
universalPointOpacity: o.pointOpacity
|
|
5279
|
+
maxPointSize: s.maxPointSize,
|
|
5280
|
+
color: A(s.hoveredPointRingColor, [0, 0, 0, 1]),
|
|
5281
|
+
universalPointOpacity: o.pointOpacity,
|
|
5282
|
+
// -1 is a sentinel value for the shader: when greyoutOpacity is -1, the shader skips opacity override (i.e. "not set")
|
|
4972
5283
|
greyoutOpacity: o.pointGreyoutOpacity ?? -1,
|
|
4973
5284
|
isDarkenGreyout: s.isDarkenGreyout ?? !1 ? 1 : 0,
|
|
4974
|
-
backgroundColor:
|
|
4975
|
-
greyoutColor:
|
|
5285
|
+
backgroundColor: A(s.backgroundColor, [0, 0, 0, 1]),
|
|
5286
|
+
greyoutColor: A(s.greyoutPointColor, [0, 0, 0, 1]),
|
|
4976
5287
|
width: 0.85
|
|
4977
5288
|
}
|
|
4978
5289
|
}), this.drawHighlightedCommand.setBindings({
|
|
@@ -4982,24 +5293,25 @@ class At extends w {
|
|
|
4982
5293
|
}
|
|
4983
5294
|
if (s.focusedPoint && this.drawHighlightedCommand && this.drawHighlightedUniformStore) {
|
|
4984
5295
|
if (!this.currentPositionTexture || this.currentPositionTexture.destroyed || !this.greyoutStatusTexture || this.greyoutStatusTexture.destroyed) return;
|
|
4985
|
-
const
|
|
5296
|
+
const f = ((l = i.pointSizes) == null ? void 0 : l[s.focusedPoint.index]) ?? 1, u = ((c = i.pointImageSizes) == null ? void 0 : c[s.focusedPoint.index]) ?? f;
|
|
4986
5297
|
this.drawHighlightedUniformStore.setUniforms({
|
|
4987
5298
|
drawHighlightedUniforms: {
|
|
4988
|
-
size:
|
|
5299
|
+
size: Math.max(f, u),
|
|
4989
5300
|
transformationMatrix: s.transformationMatrix4x4,
|
|
4990
5301
|
pointsTextureSize: s.pointsTextureSize ?? 0,
|
|
4991
|
-
sizeScale: o.pointSizeScale
|
|
4992
|
-
spaceSize: s.adjustedSpaceSize
|
|
4993
|
-
screenSize:
|
|
4994
|
-
scalePointsOnZoom: o.scalePointsOnZoom
|
|
5302
|
+
sizeScale: o.pointSizeScale,
|
|
5303
|
+
spaceSize: s.adjustedSpaceSize,
|
|
5304
|
+
screenSize: _(s.screenSize, [0, 0]),
|
|
5305
|
+
scalePointsOnZoom: o.scalePointsOnZoom ? 1 : 0,
|
|
4995
5306
|
pointIndex: s.focusedPoint.index,
|
|
4996
|
-
maxPointSize: s.maxPointSize
|
|
4997
|
-
color:
|
|
4998
|
-
universalPointOpacity: o.pointOpacity
|
|
5307
|
+
maxPointSize: s.maxPointSize,
|
|
5308
|
+
color: A(s.focusedPointRingColor, [0, 0, 0, 1]),
|
|
5309
|
+
universalPointOpacity: o.pointOpacity,
|
|
5310
|
+
// -1 is a sentinel value for the shader: when greyoutOpacity is -1, the shader skips opacity override (i.e. "not set")
|
|
4999
5311
|
greyoutOpacity: o.pointGreyoutOpacity ?? -1,
|
|
5000
5312
|
isDarkenGreyout: s.isDarkenGreyout ?? !1 ? 1 : 0,
|
|
5001
|
-
backgroundColor:
|
|
5002
|
-
greyoutColor:
|
|
5313
|
+
backgroundColor: A(s.backgroundColor, [0, 0, 0, 1]),
|
|
5314
|
+
greyoutColor: A(s.greyoutPointColor, [0, 0, 0, 1]),
|
|
5003
5315
|
width: 0.85
|
|
5004
5316
|
}
|
|
5005
5317
|
}), this.drawHighlightedCommand.setBindings({
|
|
@@ -5012,8 +5324,8 @@ class At extends w {
|
|
|
5012
5324
|
if (!this.updatePositionCommand || !this.updatePositionUniformStore || !this.currentPositionFbo || this.currentPositionFbo.destroyed || !this.previousPositionTexture || this.previousPositionTexture.destroyed || !this.velocityTexture || this.velocityTexture.destroyed || !this.pinnedStatusTexture || this.pinnedStatusTexture.destroyed) return;
|
|
5013
5325
|
this.updatePositionUniformStore.setUniforms({
|
|
5014
5326
|
updatePositionUniforms: {
|
|
5015
|
-
friction: this.config.simulationFriction
|
|
5016
|
-
spaceSize: this.store.adjustedSpaceSize
|
|
5327
|
+
friction: this.config.simulationFriction,
|
|
5328
|
+
spaceSize: this.store.adjustedSpaceSize
|
|
5017
5329
|
}
|
|
5018
5330
|
}), this.updatePositionCommand.setBindings({
|
|
5019
5331
|
positionsTexture: this.previousPositionTexture,
|
|
@@ -5030,7 +5342,7 @@ class At extends w {
|
|
|
5030
5342
|
if (!this.dragPointCommand || !this.dragPointUniformStore || !this.currentPositionFbo || this.currentPositionFbo.destroyed || !this.previousPositionTexture || this.previousPositionTexture.destroyed) return;
|
|
5031
5343
|
this.dragPointUniformStore.setUniforms({
|
|
5032
5344
|
dragPointUniforms: {
|
|
5033
|
-
mousePos:
|
|
5345
|
+
mousePos: _(this.store.mousePosition, [0, 0]),
|
|
5034
5346
|
index: ((i = this.store.hoveredPoint) == null ? void 0 : i.index) ?? -1
|
|
5035
5347
|
}
|
|
5036
5348
|
}), this.dragPointCommand.setBindings({
|
|
@@ -5046,16 +5358,16 @@ class At extends w {
|
|
|
5046
5358
|
if (!this.findPointsOnAreaSelectionCommand || !this.findPointsOnAreaSelectionUniformStore || !this.selectedFbo || this.selectedFbo.destroyed || !this.currentPositionTexture || this.currentPositionTexture.destroyed || !this.sizeTexture || this.sizeTexture.destroyed) return;
|
|
5047
5359
|
this.findPointsOnAreaSelectionUniformStore.setUniforms({
|
|
5048
5360
|
findPointsOnAreaSelectionUniforms: {
|
|
5049
|
-
spaceSize: this.store.adjustedSpaceSize
|
|
5050
|
-
screenSize:
|
|
5051
|
-
sizeScale: this.config.pointSizeScale
|
|
5361
|
+
spaceSize: this.store.adjustedSpaceSize,
|
|
5362
|
+
screenSize: _(this.store.screenSize, [0, 0]),
|
|
5363
|
+
sizeScale: this.config.pointSizeScale,
|
|
5052
5364
|
transformationMatrix: this.store.transformationMatrix4x4,
|
|
5053
|
-
ratio: this.config.pixelRatio
|
|
5054
|
-
selection0:
|
|
5055
|
-
selection1:
|
|
5056
|
-
scalePointsOnZoom: this.config.scalePointsOnZoom
|
|
5365
|
+
ratio: this.config.pixelRatio,
|
|
5366
|
+
selection0: _((i = this.store.selectedArea) == null ? void 0 : i[0], [0, 0]),
|
|
5367
|
+
selection1: _((o = this.store.selectedArea) == null ? void 0 : o[1], [0, 0]),
|
|
5368
|
+
scalePointsOnZoom: this.config.scalePointsOnZoom ? 1 : 0,
|
|
5057
5369
|
// Convert boolean to number
|
|
5058
|
-
maxPointSize: this.store.maxPointSize
|
|
5370
|
+
maxPointSize: this.store.maxPointSize
|
|
5059
5371
|
}
|
|
5060
5372
|
}), this.findPointsOnAreaSelectionCommand.setBindings({
|
|
5061
5373
|
positionsTexture: this.currentPositionTexture,
|
|
@@ -5070,8 +5382,8 @@ class At extends w {
|
|
|
5070
5382
|
if (!this.findPointsOnPolygonSelectionCommand || !this.findPointsOnPolygonSelectionUniformStore || !this.selectedFbo || this.selectedFbo.destroyed || !this.currentPositionTexture || this.currentPositionTexture.destroyed || !this.polygonPathTexture || this.polygonPathTexture.destroyed) return;
|
|
5071
5383
|
this.findPointsOnPolygonSelectionUniformStore.setUniforms({
|
|
5072
5384
|
findPointsOnPolygonSelectionUniforms: {
|
|
5073
|
-
spaceSize: this.store.adjustedSpaceSize
|
|
5074
|
-
screenSize:
|
|
5385
|
+
spaceSize: this.store.adjustedSpaceSize,
|
|
5386
|
+
screenSize: _(this.store.screenSize, [0, 0]),
|
|
5075
5387
|
transformationMatrix: this.store.transformationMatrix4x4,
|
|
5076
5388
|
polygonPathLength: this.polygonPathLength
|
|
5077
5389
|
}
|
|
@@ -5092,8 +5404,8 @@ class At extends w {
|
|
|
5092
5404
|
}
|
|
5093
5405
|
const o = Math.ceil(Math.sqrt(t.length)), s = new Float32Array(o * o * 4);
|
|
5094
5406
|
for (const [n, r] of t.entries()) {
|
|
5095
|
-
const [a,
|
|
5096
|
-
s[n * 4] = a, s[n * 4 + 1] =
|
|
5407
|
+
const [a, d] = r;
|
|
5408
|
+
s[n * 4] = a, s[n * 4 + 1] = d, s[n * 4 + 2] = 0, s[n * 4 + 3] = 0;
|
|
5097
5409
|
}
|
|
5098
5410
|
!this.polygonPathTexture || this.polygonPathTexture.width !== o || this.polygonPathTexture.height !== o ? (this.polygonPathTexture && !this.polygonPathTexture.destroyed && this.polygonPathTexture.destroy(), this.polygonPathTexture = i.createTexture({
|
|
5099
5411
|
width: o,
|
|
@@ -5117,18 +5429,19 @@ class At extends w {
|
|
|
5117
5429
|
if (!this.hoveredFbo || this.hoveredFbo.destroyed || !this.findHoveredPointCommand || !this.findHoveredPointUniformStore || !this.currentPositionTexture || this.currentPositionTexture.destroyed || (this.greyoutStatusTexture || this.updateGreyoutStatus(), !this.greyoutStatusTexture || this.greyoutStatusTexture.destroyed)) return;
|
|
5118
5430
|
this.findHoveredPointCommand.setVertexCount(this.data.pointsNumber ?? 0), this.findHoveredPointCommand.setAttributes({
|
|
5119
5431
|
...this.hoveredPointIndices && { pointIndices: this.hoveredPointIndices },
|
|
5120
|
-
...this.sizeBuffer && { size: this.sizeBuffer }
|
|
5432
|
+
...this.sizeBuffer && { size: this.sizeBuffer },
|
|
5433
|
+
...this.imageSizesBuffer && { imageSize: this.imageSizesBuffer }
|
|
5121
5434
|
});
|
|
5122
5435
|
const t = {
|
|
5123
|
-
ratio: this.config.pixelRatio
|
|
5124
|
-
sizeScale: this.config.pointSizeScale
|
|
5436
|
+
ratio: this.config.pixelRatio,
|
|
5437
|
+
sizeScale: this.config.pointSizeScale,
|
|
5125
5438
|
pointsTextureSize: this.store.pointsTextureSize ?? 0,
|
|
5126
5439
|
transformationMatrix: this.store.transformationMatrix4x4,
|
|
5127
|
-
spaceSize: this.store.adjustedSpaceSize
|
|
5128
|
-
screenSize:
|
|
5129
|
-
scalePointsOnZoom: this.config.scalePointsOnZoom
|
|
5130
|
-
mousePosition:
|
|
5131
|
-
maxPointSize: this.store.maxPointSize
|
|
5440
|
+
spaceSize: this.store.adjustedSpaceSize,
|
|
5441
|
+
screenSize: _(this.store.screenSize, [0, 0]),
|
|
5442
|
+
scalePointsOnZoom: this.config.scalePointsOnZoom ? 1 : 0,
|
|
5443
|
+
mousePosition: _(this.store.screenMousePosition, [0, 0]),
|
|
5444
|
+
maxPointSize: this.store.maxPointSize
|
|
5132
5445
|
}, i = {
|
|
5133
5446
|
positionsTexture: this.currentPositionTexture,
|
|
5134
5447
|
pointGreyoutStatus: this.greyoutStatusTexture
|
|
@@ -5198,10 +5511,10 @@ class At extends w {
|
|
|
5198
5511
|
if ((!t || !i) && this.isPositionsUpToDate && this.trackedPositions)
|
|
5199
5512
|
return this.trackedPositions;
|
|
5200
5513
|
if (!this.trackedPositionsFbo || this.trackedPositionsFbo.destroyed) return /* @__PURE__ */ new Map();
|
|
5201
|
-
const o =
|
|
5514
|
+
const o = I(this.device, this.trackedPositionsFbo), s = /* @__PURE__ */ new Map();
|
|
5202
5515
|
for (let n = 0; n < o.length / 4; n += 1) {
|
|
5203
|
-
const r = o[n * 4], a = o[n * 4 + 1],
|
|
5204
|
-
r !== void 0 && a !== void 0 &&
|
|
5516
|
+
const r = o[n * 4], a = o[n * 4 + 1], d = this.trackedIndices[n];
|
|
5517
|
+
r !== void 0 && a !== void 0 && d !== void 0 && s.set(d, [r, a]);
|
|
5205
5518
|
}
|
|
5206
5519
|
return (!t || !i) && (this.trackedPositions = s, this.isPositionsUpToDate = !0), s;
|
|
5207
5520
|
}
|
|
@@ -5214,8 +5527,8 @@ class At extends w {
|
|
|
5214
5527
|
fillSampledPointsUniforms: {
|
|
5215
5528
|
pointsTextureSize: this.store.pointsTextureSize ?? 0,
|
|
5216
5529
|
transformationMatrix: this.store.transformationMatrix4x4,
|
|
5217
|
-
spaceSize: this.store.adjustedSpaceSize
|
|
5218
|
-
screenSize:
|
|
5530
|
+
spaceSize: this.store.adjustedSpaceSize,
|
|
5531
|
+
screenSize: _(this.store.screenSize, [0, 0])
|
|
5219
5532
|
}
|
|
5220
5533
|
}), this.fillSampledPointsFboCommand.setBindings({
|
|
5221
5534
|
positionsTexture: this.currentPositionTexture
|
|
@@ -5226,7 +5539,7 @@ class At extends w {
|
|
|
5226
5539
|
});
|
|
5227
5540
|
this.fillSampledPointsFboCommand.draw(o), o.end();
|
|
5228
5541
|
}
|
|
5229
|
-
const i =
|
|
5542
|
+
const i = I(this.device, this.sampledPointsFbo);
|
|
5230
5543
|
for (let o = 0; o < i.length / 4; o++) {
|
|
5231
5544
|
const s = i[o * 4], n = !!i[o * 4 + 1], r = i[o * 4 + 2], a = i[o * 4 + 3];
|
|
5232
5545
|
n && s !== void 0 && r !== void 0 && a !== void 0 && t.set(s, [r, a]);
|
|
@@ -5242,8 +5555,8 @@ class At extends w {
|
|
|
5242
5555
|
fillSampledPointsUniforms: {
|
|
5243
5556
|
pointsTextureSize: this.store.pointsTextureSize ?? 0,
|
|
5244
5557
|
transformationMatrix: this.store.transformationMatrix4x4,
|
|
5245
|
-
spaceSize: this.store.adjustedSpaceSize
|
|
5246
|
-
screenSize:
|
|
5558
|
+
spaceSize: this.store.adjustedSpaceSize,
|
|
5559
|
+
screenSize: _(this.store.screenSize, [0, 0])
|
|
5247
5560
|
}
|
|
5248
5561
|
}), this.fillSampledPointsFboCommand.setBindings({
|
|
5249
5562
|
positionsTexture: this.currentPositionTexture
|
|
@@ -5254,10 +5567,10 @@ class At extends w {
|
|
|
5254
5567
|
});
|
|
5255
5568
|
this.fillSampledPointsFboCommand.draw(s), s.end();
|
|
5256
5569
|
}
|
|
5257
|
-
const o =
|
|
5570
|
+
const o = I(this.device, this.sampledPointsFbo);
|
|
5258
5571
|
for (let s = 0; s < o.length / 4; s++) {
|
|
5259
|
-
const n = o[s * 4], r = !!o[s * 4 + 1], a = o[s * 4 + 2],
|
|
5260
|
-
r && n !== void 0 && a !== void 0 &&
|
|
5572
|
+
const n = o[s * 4], r = !!o[s * 4 + 1], a = o[s * 4 + 2], d = o[s * 4 + 3];
|
|
5573
|
+
r && n !== void 0 && a !== void 0 && d !== void 0 && (t.push(n), i.push(a, d));
|
|
5261
5574
|
}
|
|
5262
5575
|
return { indices: t, positions: i };
|
|
5263
5576
|
}
|
|
@@ -5265,7 +5578,7 @@ class At extends w {
|
|
|
5265
5578
|
const t = [];
|
|
5266
5579
|
if (!this.trackedIndices || !this.trackedPositionsFbo || this.trackedPositionsFbo.destroyed) return t;
|
|
5267
5580
|
t.length = this.trackedIndices.length * 2;
|
|
5268
|
-
const i =
|
|
5581
|
+
const i = I(this.device, this.trackedPositionsFbo);
|
|
5269
5582
|
for (let o = 0; o < i.length / 4; o += 1) {
|
|
5270
5583
|
const s = i[o * 4], n = i[o * 4 + 1], r = this.trackedIndices[o];
|
|
5271
5584
|
s !== void 0 && n !== void 0 && r !== void 0 && (t[o * 2] = s, t[o * 2 + 1] = n);
|
|
@@ -5277,56 +5590,56 @@ class At extends w {
|
|
|
5277
5590
|
* Models -> Framebuffers -> Textures -> UniformStores -> Buffers
|
|
5278
5591
|
* */
|
|
5279
5592
|
destroy() {
|
|
5280
|
-
var t, i, o, s, n, r, a,
|
|
5281
|
-
(t = this.drawCommand) == null || t.destroy(), this.drawCommand = void 0, (i = this.drawHighlightedCommand) == null || i.destroy(), this.drawHighlightedCommand = void 0, (o = this.updatePositionCommand) == null || o.destroy(), this.updatePositionCommand = void 0, (s = this.dragPointCommand) == null || s.destroy(), this.dragPointCommand = void 0, (n = this.findPointsOnAreaSelectionCommand) == null || n.destroy(), this.findPointsOnAreaSelectionCommand = void 0, (r = this.findPointsOnPolygonSelectionCommand) == null || r.destroy(), this.findPointsOnPolygonSelectionCommand = void 0, (a = this.findHoveredPointCommand) == null || a.destroy(), this.findHoveredPointCommand = void 0, (
|
|
5593
|
+
var t, i, o, s, n, r, a, d, l, c, f, u, h, p, P, m, C, v;
|
|
5594
|
+
(t = this.drawCommand) == null || t.destroy(), this.drawCommand = void 0, (i = this.drawHighlightedCommand) == null || i.destroy(), this.drawHighlightedCommand = void 0, (o = this.updatePositionCommand) == null || o.destroy(), this.updatePositionCommand = void 0, (s = this.dragPointCommand) == null || s.destroy(), this.dragPointCommand = void 0, (n = this.findPointsOnAreaSelectionCommand) == null || n.destroy(), this.findPointsOnAreaSelectionCommand = void 0, (r = this.findPointsOnPolygonSelectionCommand) == null || r.destroy(), this.findPointsOnPolygonSelectionCommand = void 0, (a = this.findHoveredPointCommand) == null || a.destroy(), this.findHoveredPointCommand = void 0, (d = this.fillSampledPointsFboCommand) == null || d.destroy(), this.fillSampledPointsFboCommand = void 0, (l = this.trackPointsCommand) == null || l.destroy(), this.trackPointsCommand = void 0, this.currentPositionFbo && !this.currentPositionFbo.destroyed && this.currentPositionFbo.destroy(), this.currentPositionFbo = void 0, this.previousPositionFbo && !this.previousPositionFbo.destroyed && this.previousPositionFbo.destroy(), this.previousPositionFbo = void 0, this.velocityFbo && !this.velocityFbo.destroyed && this.velocityFbo.destroy(), this.velocityFbo = void 0, this.selectedFbo && !this.selectedFbo.destroyed && this.selectedFbo.destroy(), this.selectedFbo = void 0, this.hoveredFbo && !this.hoveredFbo.destroyed && this.hoveredFbo.destroy(), this.hoveredFbo = void 0, this.trackedPositionsFbo && !this.trackedPositionsFbo.destroyed && this.trackedPositionsFbo.destroy(), this.trackedPositionsFbo = void 0, this.sampledPointsFbo && !this.sampledPointsFbo.destroyed && this.sampledPointsFbo.destroy(), this.sampledPointsFbo = void 0, this.currentPositionTexture && !this.currentPositionTexture.destroyed && this.currentPositionTexture.destroy(), this.currentPositionTexture = void 0, this.previousPositionTexture && !this.previousPositionTexture.destroyed && this.previousPositionTexture.destroy(), this.previousPositionTexture = void 0, this.velocityTexture && !this.velocityTexture.destroyed && this.velocityTexture.destroy(), this.velocityTexture = void 0, this.selectedTexture && !this.selectedTexture.destroyed && this.selectedTexture.destroy(), this.selectedTexture = void 0, this.greyoutStatusTexture && !this.greyoutStatusTexture.destroyed && this.greyoutStatusTexture.destroy(), this.greyoutStatusTexture = void 0, this.sizeTexture && !this.sizeTexture.destroyed && this.sizeTexture.destroy(), this.sizeTexture = void 0, this.trackedIndicesTexture && !this.trackedIndicesTexture.destroyed && this.trackedIndicesTexture.destroy(), this.trackedIndicesTexture = void 0, this.polygonPathTexture && !this.polygonPathTexture.destroyed && this.polygonPathTexture.destroy(), this.polygonPathTexture = void 0, this.imageAtlasTexture && !this.imageAtlasTexture.destroyed && this.imageAtlasTexture.destroy(), this.imageAtlasTexture = void 0, this.imageAtlasCoordsTexture && !this.imageAtlasCoordsTexture.destroyed && this.imageAtlasCoordsTexture.destroy(), this.imageAtlasCoordsTexture = void 0, this.pinnedStatusTexture && !this.pinnedStatusTexture.destroyed && this.pinnedStatusTexture.destroy(), this.pinnedStatusTexture = void 0, (c = this.updatePositionUniformStore) == null || c.destroy(), this.updatePositionUniformStore = void 0, (f = this.dragPointUniformStore) == null || f.destroy(), this.dragPointUniformStore = void 0, (u = this.drawUniformStore) == null || u.destroy(), this.drawUniformStore = void 0, (h = this.findPointsOnAreaSelectionUniformStore) == null || h.destroy(), this.findPointsOnAreaSelectionUniformStore = void 0, (p = this.findPointsOnPolygonSelectionUniformStore) == null || p.destroy(), this.findPointsOnPolygonSelectionUniformStore = void 0, (P = this.findHoveredPointUniformStore) == null || P.destroy(), this.findHoveredPointUniformStore = void 0, (m = this.fillSampledPointsUniformStore) == null || m.destroy(), this.fillSampledPointsUniformStore = void 0, (C = this.drawHighlightedUniformStore) == null || C.destroy(), this.drawHighlightedUniformStore = void 0, (v = this.trackPointsUniformStore) == null || v.destroy(), this.trackPointsUniformStore = void 0, this.colorBuffer && !this.colorBuffer.destroyed && this.colorBuffer.destroy(), this.colorBuffer = void 0, this.sizeBuffer && !this.sizeBuffer.destroyed && this.sizeBuffer.destroy(), this.sizeBuffer = void 0, this.shapeBuffer && !this.shapeBuffer.destroyed && this.shapeBuffer.destroy(), this.shapeBuffer = void 0, this.imageIndicesBuffer && !this.imageIndicesBuffer.destroyed && this.imageIndicesBuffer.destroy(), this.imageIndicesBuffer = void 0, this.imageSizesBuffer && !this.imageSizesBuffer.destroyed && this.imageSizesBuffer.destroy(), this.imageSizesBuffer = void 0, this.drawPointIndices && !this.drawPointIndices.destroyed && this.drawPointIndices.destroy(), this.drawPointIndices = void 0, this.hoveredPointIndices && !this.hoveredPointIndices.destroyed && this.hoveredPointIndices.destroy(), this.hoveredPointIndices = void 0, this.sampledPointIndices && !this.sampledPointIndices.destroyed && this.sampledPointIndices.destroy(), this.sampledPointIndices = void 0, this.updatePositionVertexCoordBuffer && !this.updatePositionVertexCoordBuffer.destroyed && this.updatePositionVertexCoordBuffer.destroy(), this.updatePositionVertexCoordBuffer = void 0, this.dragPointVertexCoordBuffer && !this.dragPointVertexCoordBuffer.destroyed && this.dragPointVertexCoordBuffer.destroy(), this.dragPointVertexCoordBuffer = void 0, this.findPointsOnAreaSelectionVertexCoordBuffer && !this.findPointsOnAreaSelectionVertexCoordBuffer.destroyed && this.findPointsOnAreaSelectionVertexCoordBuffer.destroy(), this.findPointsOnAreaSelectionVertexCoordBuffer = void 0, this.findPointsOnPolygonSelectionVertexCoordBuffer && !this.findPointsOnPolygonSelectionVertexCoordBuffer.destroyed && this.findPointsOnPolygonSelectionVertexCoordBuffer.destroy(), this.findPointsOnPolygonSelectionVertexCoordBuffer = void 0, this.drawHighlightedVertexCoordBuffer && !this.drawHighlightedVertexCoordBuffer.destroyed && this.drawHighlightedVertexCoordBuffer.destroy(), this.drawHighlightedVertexCoordBuffer = void 0, this.trackPointsVertexCoordBuffer && !this.trackPointsVertexCoordBuffer.destroyed && this.trackPointsVertexCoordBuffer.destroy(), this.trackPointsVertexCoordBuffer = void 0;
|
|
5282
5595
|
}
|
|
5283
5596
|
swapFbo() {
|
|
5284
5597
|
if (!this.currentPositionTexture || this.currentPositionTexture.destroyed || !this.previousPositionTexture || this.previousPositionTexture.destroyed || !this.currentPositionFbo || this.currentPositionFbo.destroyed || !this.previousPositionFbo || this.previousPositionFbo.destroyed)
|
|
5285
5598
|
return;
|
|
5286
5599
|
const t = this.previousPositionTexture, i = this.previousPositionFbo;
|
|
5287
|
-
this.previousPositionTexture = this.currentPositionTexture, this.previousPositionFbo = this.currentPositionFbo, this.currentPositionTexture = t, this.currentPositionFbo = i;
|
|
5600
|
+
this.previousPositionTexture = this.currentPositionTexture, this.previousPositionFbo = this.currentPositionFbo, this.currentPositionTexture = t, this.currentPositionFbo = i, this.areClusterCentroidsUpToDate = !1;
|
|
5288
5601
|
}
|
|
5289
5602
|
rescaleInitialNodePositions() {
|
|
5290
5603
|
const { config: { spaceSize: t } } = this;
|
|
5291
5604
|
if (!this.data.pointPositions || !t) return;
|
|
5292
5605
|
const i = this.data.pointPositions, o = i.length / 2;
|
|
5293
5606
|
let s = 1 / 0, n = -1 / 0, r = 1 / 0, a = -1 / 0;
|
|
5294
|
-
for (let
|
|
5295
|
-
const v = i[
|
|
5607
|
+
for (let C = 0; C < i.length; C += 2) {
|
|
5608
|
+
const v = i[C], y = i[C + 1];
|
|
5296
5609
|
s = Math.min(s, v), n = Math.max(n, v), r = Math.min(r, y), a = Math.max(a, y);
|
|
5297
5610
|
}
|
|
5298
|
-
const
|
|
5611
|
+
const d = n - s, l = a - r, c = Math.max(d, l);
|
|
5299
5612
|
if (c > t) {
|
|
5300
5613
|
this.scaleX = void 0, this.scaleY = void 0;
|
|
5301
5614
|
return;
|
|
5302
5615
|
}
|
|
5303
|
-
const f = t * t * 1e-3,
|
|
5304
|
-
this.scaleX = (
|
|
5305
|
-
for (let
|
|
5306
|
-
this.data.pointPositions[
|
|
5616
|
+
const f = t * t * 1e-3, u = o > f ? t * Math.max(1.2, Math.sqrt(o) / t) : t * 0.1, h = u / c, p = (t - u) / 2, P = (c - d) / 2 * h + p, m = (c - l) / 2 * h + p;
|
|
5617
|
+
this.scaleX = (C) => (C - s) * h + P, this.scaleY = (C) => (C - r) * h + m;
|
|
5618
|
+
for (let C = 0; C < o; C++)
|
|
5619
|
+
this.data.pointPositions[C * 2] = this.scaleX(i[C * 2]), this.data.pointPositions[C * 2 + 1] = this.scaleY(i[C * 2 + 1]);
|
|
5307
5620
|
}
|
|
5308
5621
|
}
|
|
5309
|
-
class
|
|
5622
|
+
class Pt {
|
|
5310
5623
|
constructor(t, i) {
|
|
5311
|
-
this.eventTransform = W, this.behavior =
|
|
5624
|
+
this.eventTransform = W, this.behavior = Te().scaleExtent([1e-3, 1 / 0]).on("start", (o) => {
|
|
5312
5625
|
var n, r;
|
|
5313
5626
|
this.isRunning = !0;
|
|
5314
5627
|
const s = !!o.sourceEvent;
|
|
5315
|
-
(r = (n = this.config)
|
|
5628
|
+
s && (this.shouldEnableSimulationDuringZoomOverride = void 0), (r = (n = this.config).onZoomStart) == null || r.call(n, o, s);
|
|
5316
5629
|
}).on("zoom", (o) => {
|
|
5317
|
-
var
|
|
5630
|
+
var u, h;
|
|
5318
5631
|
this.eventTransform = o.transform;
|
|
5319
|
-
const { eventTransform: { x: s, y: n, k: r }, store: { transform: a, screenSize:
|
|
5320
|
-
if (!
|
|
5321
|
-
V.projection(a,
|
|
5632
|
+
const { eventTransform: { x: s, y: n, k: r }, store: { transform: a, screenSize: d } } = this, l = d[0], c = d[1];
|
|
5633
|
+
if (!l || !c) return;
|
|
5634
|
+
V.projection(a, l, c), V.translate(a, a, [s, n]), V.scale(a, a, [r, r]), V.translate(a, a, [l / 2, c / 2]), V.scale(a, a, [l / 2, c / 2]), V.scale(a, a, [1, -1]);
|
|
5322
5635
|
const f = !!o.sourceEvent;
|
|
5323
|
-
(
|
|
5636
|
+
(h = (u = this.config).onZoom) == null || h.call(u, o, f);
|
|
5324
5637
|
}).on("end", (o) => {
|
|
5325
5638
|
var n, r;
|
|
5326
5639
|
this.isRunning = !1;
|
|
5327
5640
|
const s = !!o.sourceEvent;
|
|
5328
|
-
(r = (n = this.config)
|
|
5329
|
-
}), this.isRunning = !1, this.store = t, this.config = i;
|
|
5641
|
+
(r = (n = this.config).onZoomEnd) == null || r.call(n, o, s);
|
|
5642
|
+
}), this.isRunning = !1, this.shouldEnableSimulationDuringZoomOverride = void 0, this.store = t, this.config = i;
|
|
5330
5643
|
}
|
|
5331
5644
|
/**
|
|
5332
5645
|
* Returns the zoom transform that fits the given point positions into the viewport.
|
|
@@ -5339,14 +5652,14 @@ class vt {
|
|
|
5339
5652
|
getTransform(t, i, o = 0.1) {
|
|
5340
5653
|
if (t.length === 0) return this.eventTransform;
|
|
5341
5654
|
const { store: { screenSize: s } } = this, n = s[0], r = s[1];
|
|
5342
|
-
let a = 1 / 0,
|
|
5343
|
-
for (let
|
|
5344
|
-
const
|
|
5345
|
-
|
|
5655
|
+
let a = 1 / 0, d = -1 / 0, l = 1 / 0, c = -1 / 0;
|
|
5656
|
+
for (let F = 0; F < t.length; F += 2) {
|
|
5657
|
+
const E = t[F], M = t[F + 1];
|
|
5658
|
+
E < a && (a = E), E > d && (d = E), M < l && (l = M), M > c && (c = M);
|
|
5346
5659
|
}
|
|
5347
|
-
const f = [this.store.scaleX(a), this.store.scaleX(
|
|
5348
|
-
f[0] === f[1] && (f[0] -= 0.5, f[1] += 0.5),
|
|
5349
|
-
const
|
|
5660
|
+
const f = [this.store.scaleX(a), this.store.scaleX(d)], u = [this.store.scaleY(l), this.store.scaleY(c)];
|
|
5661
|
+
f[0] === f[1] && (f[0] -= 0.5, f[1] += 0.5), u[0] === u[1] && (u[0] += 0.5, u[1] -= 0.5);
|
|
5662
|
+
const h = n * (1 - o * 2) / (f[1] - f[0]), p = r * (1 - o * 2) / (u[0] - u[1]), P = me(i ?? Math.min(h, p), ...this.behavior.scaleExtent()), m = (f[1] + f[0]) / 2, C = (u[1] + u[0]) / 2, v = n / 2 - m * P, y = r / 2 - C * P;
|
|
5350
5663
|
return W.translate(v, y).scale(P);
|
|
5351
5664
|
}
|
|
5352
5665
|
getDistanceToPoint(t) {
|
|
@@ -5354,11 +5667,11 @@ class vt {
|
|
|
5354
5667
|
return Math.sqrt(r * r + a * a);
|
|
5355
5668
|
}
|
|
5356
5669
|
getMiddlePointTransform(t) {
|
|
5357
|
-
const { store: { screenSize: i }, eventTransform: { x: o, y: s, k: n } } = this, r = i[0], a = i[1],
|
|
5358
|
-
return W.translate(P, m).scale(
|
|
5670
|
+
const { store: { screenSize: i }, eventTransform: { x: o, y: s, k: n } } = this, r = i[0], a = i[1], d = (r / 2 - o) / n, l = (a / 2 - s) / n, c = this.store.scaleX(t[0]), f = this.store.scaleY(t[1]), u = (d + c) / 2, h = (l + f) / 2, p = 1, P = r / 2 - u * p, m = a / 2 - h * p;
|
|
5671
|
+
return W.translate(P, m).scale(p);
|
|
5359
5672
|
}
|
|
5360
5673
|
convertScreenToSpacePosition(t) {
|
|
5361
|
-
const { eventTransform: { x: i, y: o, k: s }, store: { screenSize: n } } = this, r = n[0], a = n[1],
|
|
5674
|
+
const { eventTransform: { x: i, y: o, k: s }, store: { screenSize: n } } = this, r = n[0], a = n[1], d = (t[0] - i) / s, l = (t[1] - o) / s, c = [d, a - l];
|
|
5362
5675
|
return c[0] -= (r - this.store.adjustedSpaceSize) / 2, c[1] -= (a - this.store.adjustedSpaceSize) / 2, c;
|
|
5363
5676
|
}
|
|
5364
5677
|
convertSpaceToScreenPosition(t) {
|
|
@@ -5371,63 +5684,69 @@ class vt {
|
|
|
5371
5684
|
return i ? n *= s : n *= Math.min(5, Math.max(1, s * 0.01)), Math.min(n, o) / 2;
|
|
5372
5685
|
}
|
|
5373
5686
|
}
|
|
5374
|
-
class
|
|
5687
|
+
class Rt {
|
|
5375
5688
|
constructor(t, i) {
|
|
5376
|
-
this.isActive = !1, this.behavior =
|
|
5689
|
+
this.isActive = !1, this.behavior = ge().subject((o) => this.store.hoveredPoint && !this.store.isSpaceKeyPressed ? { x: o.x, y: o.y } : void 0).on("start", (o) => {
|
|
5377
5690
|
var s, n;
|
|
5378
|
-
this.store.hoveredPoint && (this.store.draggingPointIndex = this.store.hoveredPoint.index, this.isActive = !0, (n = (s = this.config)
|
|
5691
|
+
this.store.hoveredPoint && (this.store.draggingPointIndex = this.store.hoveredPoint.index, this.isActive = !0, (n = (s = this.config).onDragStart) == null || n.call(s, o));
|
|
5379
5692
|
}).on("drag", (o) => {
|
|
5380
5693
|
var s, n;
|
|
5381
|
-
(n = (s = this.config)
|
|
5694
|
+
(n = (s = this.config).onDrag) == null || n.call(s, o);
|
|
5382
5695
|
}).on("end", (o) => {
|
|
5383
5696
|
var s, n;
|
|
5384
|
-
this.isActive = !1, this.store.draggingPointIndex = void 0, (n = (s = this.config)
|
|
5697
|
+
this.isActive = !1, this.store.draggingPointIndex = void 0, (n = (s = this.config).onDragEnd) == null || n.call(s, o);
|
|
5385
5698
|
}), this.store = t, this.config = i;
|
|
5386
5699
|
}
|
|
5387
5700
|
}
|
|
5388
|
-
class
|
|
5701
|
+
class kt {
|
|
5702
|
+
/**
|
|
5703
|
+
* Create a new Graph instance.
|
|
5704
|
+
* @param div - Container element for the graph canvas.
|
|
5705
|
+
* @param config - Optional configuration. Unset properties use default values.
|
|
5706
|
+
*/
|
|
5389
5707
|
constructor(t, i, o) {
|
|
5390
|
-
if (this.config =
|
|
5708
|
+
if (this.config = se(), this.graph = new ye(this.config), this.isReady = !1, this.requestAnimationFrameId = 0, this.isRightClickMouse = !1, this.store = new Pe(), this.zoomInstance = new Pt(this.store, this.config), this.dragInstance = new Rt(this.store, this.config), this._findHoveredItemExecutionCount = 0, this._isMouseOnCanvas = !1, this._lastMouseX = 0, this._lastMouseY = 0, this._lastCheckedMouseX = 0, this._lastCheckedMouseY = 0, this._shouldForceHoverDetection = !1, this._isFirstRenderAfterInit = !0, this.isPointPositionsUpdateNeeded = !1, this.isPointColorUpdateNeeded = !1, this.isPointSizeUpdateNeeded = !1, this.isPointShapeUpdateNeeded = !1, this.isPointImageIndicesUpdateNeeded = !1, this.isLinksUpdateNeeded = !1, this.isLinkColorUpdateNeeded = !1, this.isLinkWidthUpdateNeeded = !1, this.isLinkArrowUpdateNeeded = !1, this.isPointClusterUpdateNeeded = !1, this.isForceManyBodyUpdateNeeded = !1, this.isForceLinkUpdateNeeded = !1, this.isForceCenterUpdateNeeded = !1, this.isPointImageSizesUpdateNeeded = !1, this._isDestroyed = !1, i && Y(this.config, i), o)
|
|
5391
5709
|
this.deviceInitPromise = o, this.shouldDestroyDevice = !1;
|
|
5392
5710
|
else {
|
|
5393
|
-
const
|
|
5394
|
-
this.deviceInitPromise = this.createDevice(
|
|
5711
|
+
const n = document.createElement("canvas");
|
|
5712
|
+
this.deviceInitPromise = this.createDevice(n), this.shouldDestroyDevice = !0;
|
|
5395
5713
|
}
|
|
5396
|
-
this.deviceInitPromise.then((
|
|
5714
|
+
const s = this.deviceInitPromise.then((n) => {
|
|
5397
5715
|
if (this._isDestroyed)
|
|
5398
|
-
return this.shouldDestroyDevice &&
|
|
5399
|
-
this.device =
|
|
5400
|
-
const
|
|
5401
|
-
o &&
|
|
5402
|
-
const
|
|
5403
|
-
|
|
5404
|
-
const
|
|
5405
|
-
return this.store.adjustSpaceSize(this.config.spaceSize, this.device.limits.maxTextureDimension2D), this.store.setWebGLMaxTextureSize(this.device.limits.maxTextureDimension2D), this.store.updateScreenSize(
|
|
5406
|
-
this._isMouseOnCanvas = !0, this._lastMouseX =
|
|
5407
|
-
}).on("mousemove.cosmos", (
|
|
5408
|
-
this._isMouseOnCanvas = !0, this._lastMouseX =
|
|
5409
|
-
}).on("mouseleave.cosmos", (
|
|
5410
|
-
this._isMouseOnCanvas = !1, this.currentEvent =
|
|
5411
|
-
}),
|
|
5412
|
-
|
|
5413
|
-
}).on("keyup.cosmos", (
|
|
5414
|
-
|
|
5415
|
-
}), this.zoomInstance.behavior.on("start.detect", (
|
|
5416
|
-
this.currentEvent =
|
|
5417
|
-
}).on("zoom.detect", (
|
|
5418
|
-
!!
|
|
5419
|
-
}).on("end.detect", (
|
|
5420
|
-
this.currentEvent =
|
|
5421
|
-
}), this.dragInstance.behavior.on("start.detect", (
|
|
5422
|
-
this.currentEvent =
|
|
5423
|
-
}).on("drag.detect", (
|
|
5424
|
-
this.dragInstance.isActive && this.updateMousePosition(
|
|
5425
|
-
}).on("end.detect", (
|
|
5426
|
-
this.currentEvent =
|
|
5427
|
-
}), this.canvasD3Selection.call(this.dragInstance.behavior).call(this.zoomInstance.behavior).on("click", this.onClick.bind(this)).on("mousemove", this.onMouseMove.bind(this)).on("contextmenu", this.onContextMenu.bind(this)), (!this.config.enableZoom || !this.config.enableDrag) && this.updateZoomDragBehaviors(), this.setZoomLevel(this.config.initialZoomLevel ?? 1), this.store.maxPointSize =
|
|
5428
|
-
}).catch((
|
|
5429
|
-
throw this.device = void 0, this.isReady = !1, console.error("Device initialization failed:",
|
|
5430
|
-
})
|
|
5716
|
+
return this.shouldDestroyDevice && n.destroy(), n;
|
|
5717
|
+
this.device = n, this.isReady = !0;
|
|
5718
|
+
const r = this.validateDevice(n);
|
|
5719
|
+
o && r.setProps({ useDevicePixels: this.config.pixelRatio }), this.store.div = t;
|
|
5720
|
+
const a = r.canvas;
|
|
5721
|
+
a.parentNode !== this.store.div && (a.parentNode && a.parentNode.removeChild(a), this.store.div.appendChild(a)), this.addAttribution(), a.style.width = "100%", a.style.height = "100%", this.canvas = a;
|
|
5722
|
+
const d = this.canvas.clientWidth, l = this.canvas.clientHeight;
|
|
5723
|
+
return this.store.adjustSpaceSize(this.config.spaceSize, this.device.limits.maxTextureDimension2D), this.store.setWebGLMaxTextureSize(this.device.limits.maxTextureDimension2D), this.store.updateScreenSize(d, l), this.canvasD3Selection = b(this.canvas), this.canvasD3Selection.on("mouseenter.cosmos", (c) => {
|
|
5724
|
+
this._isMouseOnCanvas = !0, this._lastMouseX = c.clientX, this._lastMouseY = c.clientY;
|
|
5725
|
+
}).on("mousemove.cosmos", (c) => {
|
|
5726
|
+
this._isMouseOnCanvas = !0, this._lastMouseX = c.clientX, this._lastMouseY = c.clientY;
|
|
5727
|
+
}).on("mouseleave.cosmos", (c) => {
|
|
5728
|
+
this._isMouseOnCanvas = !1, this.currentEvent = c, this.store.hoveredPoint !== void 0 && this.config.onPointMouseOut && this.config.onPointMouseOut(c), this.store.hoveredLinkIndex !== void 0 && this.config.onLinkMouseOut && this.config.onLinkMouseOut(c), this.isRightClickMouse = !1, this.store.hoveredPoint = void 0, this.store.hoveredLinkIndex = void 0, this.updateCanvasCursor();
|
|
5729
|
+
}), b(document).on("keydown.cosmos", (c) => {
|
|
5730
|
+
c.code === "Space" && (this.store.isSpaceKeyPressed = !0);
|
|
5731
|
+
}).on("keyup.cosmos", (c) => {
|
|
5732
|
+
c.code === "Space" && (this.store.isSpaceKeyPressed = !1);
|
|
5733
|
+
}), this.zoomInstance.behavior.on("start.detect", (c) => {
|
|
5734
|
+
this.currentEvent = c;
|
|
5735
|
+
}).on("zoom.detect", (c) => {
|
|
5736
|
+
!!c.sourceEvent && this.updateMousePosition(c.sourceEvent), this.currentEvent = c;
|
|
5737
|
+
}).on("end.detect", (c) => {
|
|
5738
|
+
this.currentEvent = c, this._shouldForceHoverDetection = !0;
|
|
5739
|
+
}), this.dragInstance.behavior.on("start.detect", (c) => {
|
|
5740
|
+
this.currentEvent = c, this.updateCanvasCursor();
|
|
5741
|
+
}).on("drag.detect", (c) => {
|
|
5742
|
+
this.dragInstance.isActive && this.updateMousePosition(c), this.currentEvent = c;
|
|
5743
|
+
}).on("end.detect", (c) => {
|
|
5744
|
+
this.currentEvent = c, this.updateCanvasCursor();
|
|
5745
|
+
}), this.canvasD3Selection.call(this.dragInstance.behavior).call(this.zoomInstance.behavior).on("click", this.onClick.bind(this)).on("mousemove", this.onMouseMove.bind(this)).on("contextmenu", this.onContextMenu.bind(this)), (!this.config.enableZoom || !this.config.enableDrag) && this.updateZoomDragBehaviors(), this.setZoomLevel(this.config.initialZoomLevel ?? 1), this.store.maxPointSize = J(n, this.config.pixelRatio), this.store.isSimulationRunning = this.config.enableSimulation, this.points = new Ct(n, this.config, this.store, this.graph), this.lines = new st(n, this.config, this.store, this.graph, this.points), this.config.enableSimulation && (this.forceGravity = new be(n, this.config, this.store, this.graph, this.points), this.forceCenter = new Ue(n, this.config, this.store, this.graph, this.points), this.forceManyBody = new Xe(n, this.config, this.store, this.graph, this.points), this.forceLinkIncoming = new G(n, this.config, this.store, this.graph, this.points), this.forceLinkOutgoing = new G(n, this.config, this.store, this.graph, this.points), this.forceMouse = new Ye(n, this.config, this.store, this.graph, this.points)), this.clusters = new je(n, this.config, this.store, this.graph, this.points), this.store.backgroundColor = z(this.config.backgroundColor), this.store.setHoveredPointRingColor(this.config.hoveredPointRingColor), this.store.setFocusedPointRingColor(this.config.focusedPointRingColor), this.config.focusedPointIndex !== void 0 && this.store.setFocusedPoint(this.config.focusedPointIndex), this.store.setGreyoutPointColor(this.config.pointGreyoutColor), this.store.setHoveredLinkColor(this.config.hoveredLinkColor), this.store.updateLinkHoveringEnabled(this.config), this.config.showFPSMonitor && (this.fpsMonitor = new ee(this.canvas)), this.config.randomSeed !== void 0 && this.store.addRandomSeed(this.config.randomSeed), n;
|
|
5746
|
+
}).catch((n) => {
|
|
5747
|
+
throw this.device = void 0, this.isReady = !1, console.error("Device initialization failed:", n), n;
|
|
5748
|
+
});
|
|
5749
|
+
this.ready = s.then(() => {
|
|
5431
5750
|
});
|
|
5432
5751
|
}
|
|
5433
5752
|
/**
|
|
@@ -5450,14 +5769,31 @@ class Ht {
|
|
|
5450
5769
|
return this._isDestroyed ? 0 : this.store.maxPointSize;
|
|
5451
5770
|
}
|
|
5452
5771
|
/**
|
|
5453
|
-
*
|
|
5454
|
-
*
|
|
5772
|
+
* Apply a new configuration. Changes take effect immediately.
|
|
5773
|
+
*
|
|
5774
|
+
* **Important:** Every call fully resets the configuration to defaults first,
|
|
5775
|
+
* then applies the provided values on top. Properties not included in `config`
|
|
5776
|
+
* will revert to their default values — they are not preserved from the previous call.
|
|
5777
|
+
*
|
|
5778
|
+
* @param config - Configuration object. Only include the properties you want to set.
|
|
5455
5779
|
*/
|
|
5456
5780
|
setConfig(t) {
|
|
5457
|
-
var o, s, n, r, a, l, d, c, f;
|
|
5458
5781
|
if (this._isDestroyed || this.ensureDevice(() => this.setConfig(t))) return;
|
|
5459
5782
|
const i = { ...this.config };
|
|
5460
|
-
|
|
5783
|
+
Ne(this.config), Y(this.config, t), this.preserveInitOnlyFields(i), this.updateStateFromConfig(i);
|
|
5784
|
+
}
|
|
5785
|
+
/**
|
|
5786
|
+
* Partially updates the graph configuration. Only the provided properties
|
|
5787
|
+
* will be changed; all other properties retain their current values.
|
|
5788
|
+
*
|
|
5789
|
+
* Properties set to `undefined` will be reset to their default values.
|
|
5790
|
+
*
|
|
5791
|
+
* @param config - A partial configuration object with the properties to update.
|
|
5792
|
+
*/
|
|
5793
|
+
setConfigPartial(t) {
|
|
5794
|
+
if (this._isDestroyed || this.ensureDevice(() => this.setConfigPartial(t))) return;
|
|
5795
|
+
const i = { ...this.config };
|
|
5796
|
+
Y(this.config, t, !0), this.preserveInitOnlyFields(i), this.updateStateFromConfig(i);
|
|
5461
5797
|
}
|
|
5462
5798
|
/**
|
|
5463
5799
|
* Sets the positions for the graph points.
|
|
@@ -5477,7 +5813,7 @@ class Ht {
|
|
|
5477
5813
|
*
|
|
5478
5814
|
* @param {Float32Array} pointColors - A Float32Array representing the colors of points in the format [r1, g1, b1, a1, r2, g2, b2, a2, ..., rn, gn, bn, an],
|
|
5479
5815
|
* where each color is represented in RGBA format.
|
|
5480
|
-
* Example: `new Float32Array([
|
|
5816
|
+
* Example: `new Float32Array([1, 0, 0, 1, 0, 1, 0, 1])` sets the first point to red and the second point to green.
|
|
5481
5817
|
*/
|
|
5482
5818
|
setPointColors(t) {
|
|
5483
5819
|
this._isDestroyed || this.ensureDevice(() => this.setPointColors(t)) || (this.graph.inputPointColors = t, this.isPointColorUpdateNeeded = !0);
|
|
@@ -5571,7 +5907,7 @@ class Ht {
|
|
|
5571
5907
|
*
|
|
5572
5908
|
* @param {Float32Array} linkColors - A Float32Array representing the colors of links in the format [r1, g1, b1, a1, r2, g2, b2, a2, ..., rn, gn, bn, an],
|
|
5573
5909
|
* where each color is in RGBA format.
|
|
5574
|
-
* Example: `new Float32Array([
|
|
5910
|
+
* Example: `new Float32Array([1, 0, 0, 1, 0, 1, 0, 1])` sets the first link to red and the second link to green.
|
|
5575
5911
|
*/
|
|
5576
5912
|
setLinkColors(t) {
|
|
5577
5913
|
this._isDestroyed || this.ensureDevice(() => this.setLinkColors(t)) || (this.graph.inputLinkColors = t, this.isLinkColorUpdateNeeded = !0);
|
|
@@ -5697,23 +6033,23 @@ class Ht {
|
|
|
5697
6033
|
render(t) {
|
|
5698
6034
|
if (this._isDestroyed || this.ensureDevice(() => this.render(t))) return;
|
|
5699
6035
|
this.graph.update();
|
|
5700
|
-
const { fitViewOnInit: i, fitViewDelay: o, fitViewPadding: s, fitViewDuration: n, fitViewByPointsInRect: r, fitViewByPointIndices: a, initialZoomLevel:
|
|
6036
|
+
const { fitViewOnInit: i, fitViewDelay: o, fitViewPadding: s, fitViewDuration: n, fitViewByPointsInRect: r, fitViewByPointIndices: a, initialZoomLevel: d } = this.config;
|
|
5701
6037
|
if (!this.graph.pointsNumber && !this.graph.linksNumber) {
|
|
5702
|
-
this.stopFrames(),
|
|
6038
|
+
this.stopFrames(), b(this.canvas).style("cursor", null), this.device && (this.device.beginRenderPass({
|
|
5703
6039
|
clearColor: this.store.backgroundColor,
|
|
5704
6040
|
clearDepth: 1,
|
|
5705
6041
|
clearStencil: 0
|
|
5706
6042
|
}).end(), this.device.submit());
|
|
5707
6043
|
return;
|
|
5708
6044
|
}
|
|
5709
|
-
this._isFirstRenderAfterInit && i &&
|
|
6045
|
+
this._isFirstRenderAfterInit && i && d === void 0 && (this._fitViewOnInitTimeoutID = window.setTimeout(() => {
|
|
5710
6046
|
a ? this.fitViewByPointIndices(a, n, s) : r ? this.setZoomTransformByPointPositions(
|
|
5711
6047
|
new Float32Array(this.flatten(r)),
|
|
5712
6048
|
n,
|
|
5713
6049
|
void 0,
|
|
5714
6050
|
s
|
|
5715
6051
|
) : this.fitView(n, s);
|
|
5716
|
-
}, o)), this.update(t), this.startFrames(), this._isFirstRenderAfterInit = !1;
|
|
6052
|
+
}, o)), this.update(t), this._shouldForceHoverDetection = !0, this.startFrames(), this._isFirstRenderAfterInit = !1;
|
|
5717
6053
|
}
|
|
5718
6054
|
/**
|
|
5719
6055
|
* Center the view on a point and zoom in, by point index.
|
|
@@ -5721,36 +6057,40 @@ class Ht {
|
|
|
5721
6057
|
* @param duration Duration of the animation transition in milliseconds (`700` by default).
|
|
5722
6058
|
* @param scale Scale value to zoom in or out (`3` by default).
|
|
5723
6059
|
* @param canZoomOut Set to `false` to prevent zooming out from the point (`true` by default).
|
|
6060
|
+
* @param enableSimulation Whether to run the simulation during the zoom transition (`true` by default).
|
|
5724
6061
|
*/
|
|
5725
|
-
zoomToPointByIndex(t, i = 700, o =
|
|
5726
|
-
if (this._isDestroyed || this.ensureDevice(() => this.zoomToPointByIndex(t, i, o, s)) || !this.device || !this.points || !this.canvasD3Selection) return;
|
|
5727
|
-
const { store: { screenSize:
|
|
6062
|
+
zoomToPointByIndex(t, i = 700, o = 3, s = !0, n = !0) {
|
|
6063
|
+
if (this._isDestroyed || this.ensureDevice(() => this.zoomToPointByIndex(t, i, o, s, n)) || !this.device || !this.points || !this.canvasD3Selection) return;
|
|
6064
|
+
const { store: { screenSize: r } } = this, a = I(this.device, this.points.currentPositionFbo);
|
|
5728
6065
|
if (t === void 0) return;
|
|
5729
|
-
const
|
|
5730
|
-
if (
|
|
5731
|
-
const
|
|
5732
|
-
if (
|
|
5733
|
-
this.setZoomTransformByPointPositions(new Float32Array([
|
|
6066
|
+
const d = a[t * 4 + 0], l = a[t * 4 + 1];
|
|
6067
|
+
if (d === void 0 || l === void 0) return;
|
|
6068
|
+
const c = this.zoomInstance.getDistanceToPoint([d, l]), f = s ? o : Math.max(this.getZoomLevel(), o);
|
|
6069
|
+
if (c < Math.min(r[0], r[1]))
|
|
6070
|
+
this.setZoomTransformByPointPositions(new Float32Array([d, l]), i, f, void 0, n);
|
|
5734
6071
|
else {
|
|
5735
|
-
|
|
5736
|
-
|
|
6072
|
+
this.zoomInstance.shouldEnableSimulationDuringZoomOverride = n;
|
|
6073
|
+
const u = this.zoomInstance.getTransform([d, l], f), h = this.zoomInstance.getMiddlePointTransform([d, l]);
|
|
6074
|
+
this.canvasD3Selection.transition().ease(ne).duration(i / 2).call(this.zoomInstance.behavior.transform, h).transition().ease(re).duration(i / 2).call(this.zoomInstance.behavior.transform, u);
|
|
5737
6075
|
}
|
|
5738
6076
|
}
|
|
5739
6077
|
/**
|
|
5740
6078
|
* Zoom the view in or out to the specified zoom level.
|
|
5741
6079
|
* @param value Zoom level
|
|
5742
6080
|
* @param duration Duration of the zoom in/out transition.
|
|
6081
|
+
* @param enableSimulation Whether to run the simulation during the zoom transition (`true` by default).
|
|
5743
6082
|
*/
|
|
5744
|
-
zoom(t, i = 0) {
|
|
5745
|
-
this._isDestroyed || this.setZoomLevel(t, i);
|
|
6083
|
+
zoom(t, i = 0, o = !0) {
|
|
6084
|
+
this._isDestroyed || this.setZoomLevel(t, i, o);
|
|
5746
6085
|
}
|
|
5747
6086
|
/**
|
|
5748
6087
|
* Zoom the view in or out to the specified zoom level.
|
|
5749
6088
|
* @param value Zoom level
|
|
5750
6089
|
* @param duration Duration of the zoom in/out transition.
|
|
6090
|
+
* @param enableSimulation Whether to run the simulation during the zoom transition (`true` by default).
|
|
5751
6091
|
*/
|
|
5752
|
-
setZoomLevel(t, i = 0) {
|
|
5753
|
-
this._isDestroyed || this.ensureDevice(() => this.setZoomLevel(t, i)) || this.canvasD3Selection && (i === 0 ? this.canvasD3Selection.call(this.zoomInstance.behavior.scaleTo, t) : this.canvasD3Selection.transition().duration(i).call(this.zoomInstance.behavior.scaleTo, t));
|
|
6092
|
+
setZoomLevel(t, i = 0, o = !0) {
|
|
6093
|
+
this._isDestroyed || this.ensureDevice(() => this.setZoomLevel(t, i, o)) || this.canvasD3Selection && (this.zoomInstance.shouldEnableSimulationDuringZoomOverride = o, i === 0 ? this.canvasD3Selection.call(this.zoomInstance.behavior.scaleTo, t) : this.canvasD3Selection.transition().duration(i).call(this.zoomInstance.behavior.scaleTo, t));
|
|
5754
6094
|
}
|
|
5755
6095
|
/**
|
|
5756
6096
|
* Get zoom level.
|
|
@@ -5766,7 +6106,7 @@ class Ht {
|
|
|
5766
6106
|
getPointPositions() {
|
|
5767
6107
|
if (this._isDestroyed || !this.device || !this.points) return [];
|
|
5768
6108
|
if (this.graph.pointsNumber === void 0) return [];
|
|
5769
|
-
const t = [], i =
|
|
6109
|
+
const t = [], i = I(this.device, this.points.currentPositionFbo);
|
|
5770
6110
|
t.length = this.graph.pointsNumber * 2;
|
|
5771
6111
|
for (let o = 0; o < this.graph.pointsNumber; o += 1) {
|
|
5772
6112
|
const s = i[o * 4 + 0], n = i[o * 4 + 1];
|
|
@@ -5776,49 +6116,43 @@ class Ht {
|
|
|
5776
6116
|
}
|
|
5777
6117
|
/**
|
|
5778
6118
|
* Get current X and Y coordinates of the clusters.
|
|
5779
|
-
* @returns Array of
|
|
6119
|
+
* @returns Array of cluster positions in `[x0, y0, x1, y1, ...]` order. Do not mutate the returned array.
|
|
5780
6120
|
*/
|
|
5781
6121
|
getClusterPositions() {
|
|
5782
|
-
|
|
5783
|
-
if (this.graph.pointClusters === void 0 || this.clusters.clusterCount === void 0) return [];
|
|
5784
|
-
this.clusters.calculateCentermass();
|
|
5785
|
-
const t = [], i = N(this.device, this.clusters.centermassFbo);
|
|
5786
|
-
t.length = this.clusters.clusterCount * 2;
|
|
5787
|
-
for (let o = 0; o < t.length / 2; o += 1) {
|
|
5788
|
-
const s = i[o * 4 + 0], n = i[o * 4 + 1], r = i[o * 4 + 2];
|
|
5789
|
-
s !== void 0 && n !== void 0 && r !== void 0 && (t[o * 2] = s / r, t[o * 2 + 1] = n / r);
|
|
5790
|
-
}
|
|
5791
|
-
return t;
|
|
6122
|
+
return this._isDestroyed || !this.device || !this.clusters ? [] : this.graph.pointClusters === void 0 || this.clusters.clusterCount === void 0 ? [] : this.clusters.getCentroidPositions();
|
|
5792
6123
|
}
|
|
5793
6124
|
/**
|
|
5794
6125
|
* Center and zoom in/out the view to fit all points in the scene.
|
|
5795
6126
|
* @param duration Duration of the center and zoom in/out animation in milliseconds (`250` by default).
|
|
5796
6127
|
* @param padding Padding around the viewport in percentage (`0.1` by default).
|
|
6128
|
+
* @param enableSimulation Whether to run the simulation during the zoom transition (`true` by default).
|
|
5797
6129
|
*/
|
|
5798
|
-
fitView(t = 250, i = 0.1) {
|
|
5799
|
-
this._isDestroyed || this.ensureDevice(() => this.fitView(t, i)) || this.setZoomTransformByPointPositions(new Float32Array(this.getPointPositions()), t, void 0, i);
|
|
6130
|
+
fitView(t = 250, i = 0.1, o = !0) {
|
|
6131
|
+
this._isDestroyed || this.ensureDevice(() => this.fitView(t, i, o)) || this.setZoomTransformByPointPositions(new Float32Array(this.getPointPositions()), t, void 0, i, o);
|
|
5800
6132
|
}
|
|
5801
6133
|
/**
|
|
5802
6134
|
* Center and zoom in/out the view to fit points by their indices in the scene.
|
|
5803
6135
|
* @param indices Point indices to fit in the view.
|
|
5804
6136
|
* @param duration Duration of the center and zoom in/out animation in milliseconds (`250` by default).
|
|
5805
6137
|
* @param padding Padding around the viewport in percentage (`0.1` by default).
|
|
6138
|
+
* @param enableSimulation Whether to run the simulation during the zoom transition (`true` by default).
|
|
5806
6139
|
*/
|
|
5807
|
-
fitViewByPointIndices(t, i = 250, o = 0.1) {
|
|
5808
|
-
if (this._isDestroyed || this.ensureDevice(() => this.fitViewByPointIndices(t, i, o))) return;
|
|
5809
|
-
const
|
|
5810
|
-
for (const [
|
|
5811
|
-
|
|
5812
|
-
this.setZoomTransformByPointPositions(
|
|
6140
|
+
fitViewByPointIndices(t, i = 250, o = 0.1, s = !0) {
|
|
6141
|
+
if (this._isDestroyed || this.ensureDevice(() => this.fitViewByPointIndices(t, i, o, s))) return;
|
|
6142
|
+
const n = this.getPointPositions(), r = new Float32Array(t.length * 2);
|
|
6143
|
+
for (const [a, d] of t.entries())
|
|
6144
|
+
r[a * 2] = n[d * 2], r[a * 2 + 1] = n[d * 2 + 1];
|
|
6145
|
+
this.setZoomTransformByPointPositions(r, i, void 0, o, s);
|
|
5813
6146
|
}
|
|
5814
6147
|
/**
|
|
5815
6148
|
* Center and zoom in/out the view to fit points by their positions in the scene.
|
|
5816
6149
|
* @param positions Flat array of point coordinates as `[x0, y0, x1, y1, ...]`.
|
|
5817
6150
|
* @param duration Duration of the center and zoom in/out animation in milliseconds (`250` by default).
|
|
5818
6151
|
* @param padding Padding around the viewport in percentage (`0.1` by default).
|
|
6152
|
+
* @param enableSimulation Whether to run the simulation during the zoom transition (`true` by default).
|
|
5819
6153
|
*/
|
|
5820
|
-
fitViewByPointPositions(t, i = 250, o = 0.1) {
|
|
5821
|
-
this._isDestroyed || this.ensureDevice(() => this.fitViewByPointPositions(t, i, o)) || this.setZoomTransformByPointPositions(new Float32Array(t), i, void 0, o);
|
|
6154
|
+
fitViewByPointPositions(t, i = 250, o = 0.1, s = !0) {
|
|
6155
|
+
this._isDestroyed || this.ensureDevice(() => this.fitViewByPointPositions(t, i, o, s)) || this.setZoomTransformByPointPositions(new Float32Array(t), i, void 0, o, s);
|
|
5822
6156
|
}
|
|
5823
6157
|
/**
|
|
5824
6158
|
* Sets the zoom transform so that the given point positions fit in the viewport, with optional animation.
|
|
@@ -5827,13 +6161,14 @@ class Ht {
|
|
|
5827
6161
|
* @param duration Animation duration in milliseconds. Default `250`.
|
|
5828
6162
|
* @param scale Optional scale factor; if omitted, scale is chosen to fit the positions.
|
|
5829
6163
|
* @param padding Padding around the viewport as a fraction (e.g. `0.1` = 10%). Default `0.1`.
|
|
6164
|
+
* @param enableSimulation Whether to run the simulation during the zoom transition (`true` by default).
|
|
5830
6165
|
*/
|
|
5831
|
-
setZoomTransformByPointPositions(t, i = 250, o, s = 0.1) {
|
|
5832
|
-
var
|
|
5833
|
-
if (this._isDestroyed || this.ensureDevice(() => this.setZoomTransformByPointPositions(t, i, o, s))) return;
|
|
5834
|
-
this.resizeCanvas();
|
|
5835
|
-
const
|
|
5836
|
-
(
|
|
6166
|
+
setZoomTransformByPointPositions(t, i = 250, o, s = 0.1, n = !0) {
|
|
6167
|
+
var a;
|
|
6168
|
+
if (this._isDestroyed || this.ensureDevice(() => this.setZoomTransformByPointPositions(t, i, o, s, n))) return;
|
|
6169
|
+
this.zoomInstance.shouldEnableSimulationDuringZoomOverride = n, this.resizeCanvas();
|
|
6170
|
+
const r = this.zoomInstance.getTransform(t, o, s);
|
|
6171
|
+
(a = this.canvasD3Selection) == null || a.transition().ease(ae).duration(i).call(this.zoomInstance.behavior.transform, r);
|
|
5837
6172
|
}
|
|
5838
6173
|
/**
|
|
5839
6174
|
* Get points indices inside a rectangular area.
|
|
@@ -5845,18 +6180,7 @@ class Ht {
|
|
|
5845
6180
|
getPointsInRect(t) {
|
|
5846
6181
|
if (this._isDestroyed || !this.device || !this.points) return new Float32Array();
|
|
5847
6182
|
const i = this.store.screenSize[1];
|
|
5848
|
-
return this.store.selectedArea = [[t[0][0], i - t[1][1]], [t[1][0], i - t[0][1]]], this.points.findPointsOnAreaSelection(),
|
|
5849
|
-
}
|
|
5850
|
-
/**
|
|
5851
|
-
* Get points indices inside a rectangular area.
|
|
5852
|
-
* @param selection - Array of two corner points `[[left, top], [right, bottom]]`.
|
|
5853
|
-
* The `left` and `right` coordinates should be from 0 to the width of the canvas.
|
|
5854
|
-
* The `top` and `bottom` coordinates should be from 0 to the height of the canvas.
|
|
5855
|
-
* @returns A Float32Array containing the indices of points inside a rectangular area.
|
|
5856
|
-
* @deprecated Use `getPointsInRect` instead. This method will be removed in a future version.
|
|
5857
|
-
*/
|
|
5858
|
-
getPointsInRange(t) {
|
|
5859
|
-
return this.getPointsInRect(t);
|
|
6183
|
+
return this.store.selectedArea = [[t[0][0], i - t[1][1]], [t[1][0], i - t[0][1]]], this.points.findPointsOnAreaSelection(), I(this.device, this.points.selectedFbo).map((s, n) => n % 4 === 0 && s !== 0 ? n / 4 : -1).filter((s) => s !== -1);
|
|
5860
6184
|
}
|
|
5861
6185
|
/**
|
|
5862
6186
|
* Get points indices inside a polygon area.
|
|
@@ -5868,7 +6192,7 @@ class Ht {
|
|
|
5868
6192
|
if (this._isDestroyed || !this.device || !this.points) return new Float32Array();
|
|
5869
6193
|
if (t.length < 3) return new Float32Array();
|
|
5870
6194
|
const i = this.store.screenSize[1], o = t.map(([n, r]) => [n, i - r]);
|
|
5871
|
-
return this.points.updatePolygonPath(o), this.points.findPointsOnPolygonSelection(),
|
|
6195
|
+
return this.points.updatePolygonPath(o), this.points.findPointsOnPolygonSelection(), I(this.device, this.points.selectedFbo).map((n, r) => r % 4 === 0 && n !== 0 ? r / 4 : -1).filter((n) => n !== -1);
|
|
5872
6196
|
}
|
|
5873
6197
|
/** Select points inside a rectangular area.
|
|
5874
6198
|
* @param selection - Array of two corner points `[[left, top], [right, bottom]]`.
|
|
@@ -5879,22 +6203,13 @@ class Ht {
|
|
|
5879
6203
|
if (t) {
|
|
5880
6204
|
const i = this.store.screenSize[1];
|
|
5881
6205
|
this.store.selectedArea = [[t[0][0], i - t[1][1]], [t[1][0], i - t[0][1]]], this.points.findPointsOnAreaSelection();
|
|
5882
|
-
const o =
|
|
6206
|
+
const o = I(this.device, this.points.selectedFbo);
|
|
5883
6207
|
this.store.selectedIndices = o.map((s, n) => n % 4 === 0 && s !== 0 ? n / 4 : -1).filter((s) => s !== -1);
|
|
5884
6208
|
} else
|
|
5885
6209
|
this.store.selectedIndices = null;
|
|
5886
6210
|
this.points.updateGreyoutStatus();
|
|
5887
6211
|
}
|
|
5888
6212
|
}
|
|
5889
|
-
/** Select points inside a rectangular area.
|
|
5890
|
-
* @param selection - Array of two corner points `[[left, top], [right, bottom]]`.
|
|
5891
|
-
* The `left` and `right` coordinates should be from 0 to the width of the canvas.
|
|
5892
|
-
* The `top` and `bottom` coordinates should be from 0 to the height of the canvas.
|
|
5893
|
-
* @deprecated Use `selectPointsInRect` instead. This method will be removed in a future version.
|
|
5894
|
-
*/
|
|
5895
|
-
selectPointsInRange(t) {
|
|
5896
|
-
return this.selectPointsInRect(t);
|
|
5897
|
-
}
|
|
5898
6213
|
/** Select points inside a polygon area.
|
|
5899
6214
|
* @param polygonPath - Array of points `[[x1, y1], [x2, y2], ..., [xn, yn]]` that defines the polygon.
|
|
5900
6215
|
* The coordinates should be from 0 to the width/height of the canvas.
|
|
@@ -5908,7 +6223,7 @@ class Ht {
|
|
|
5908
6223
|
}
|
|
5909
6224
|
const i = this.store.screenSize[1], o = t.map(([n, r]) => [n, i - r]);
|
|
5910
6225
|
this.points.updatePolygonPath(o), this.points.findPointsOnPolygonSelection();
|
|
5911
|
-
const s =
|
|
6226
|
+
const s = I(this.device, this.points.selectedFbo);
|
|
5912
6227
|
this.store.selectedIndices = s.map((n, r) => r % 4 === 0 && n !== 0 ? r / 4 : -1).filter((n) => n !== -1);
|
|
5913
6228
|
} else
|
|
5914
6229
|
this.store.selectedIndices = null;
|
|
@@ -5988,9 +6303,11 @@ class Ht {
|
|
|
5988
6303
|
* @returns Radius of the point.
|
|
5989
6304
|
*/
|
|
5990
6305
|
getPointRadiusByIndex(t) {
|
|
5991
|
-
var
|
|
5992
|
-
if (
|
|
5993
|
-
|
|
6306
|
+
var s, n;
|
|
6307
|
+
if (this._isDestroyed) return;
|
|
6308
|
+
const i = (s = this.graph.pointSizes) == null ? void 0 : s[t], o = (n = this.graph.pointImageSizes) == null ? void 0 : n[t];
|
|
6309
|
+
if (!(i === void 0 && o === void 0))
|
|
6310
|
+
return Math.max(i ?? 0, o ?? 0);
|
|
5994
6311
|
}
|
|
5995
6312
|
/**
|
|
5996
6313
|
* Track multiple point positions by their indices on each Cosmos tick.
|
|
@@ -6035,6 +6352,24 @@ class Ht {
|
|
|
6035
6352
|
getSampledPoints() {
|
|
6036
6353
|
return this._isDestroyed || !this.points ? { indices: [], positions: [] } : this.points.getSampledPoints();
|
|
6037
6354
|
}
|
|
6355
|
+
/**
|
|
6356
|
+
* For the links that are currently visible on the screen, get a sample of link indices with their midpoint coordinates and angle.
|
|
6357
|
+
* The resulting number of links will depend on the `linkSamplingDistance` configuration property,
|
|
6358
|
+
* and the sampled links will be evenly distributed (one link per grid cell, based on link midpoint in screen space).
|
|
6359
|
+
* Each value is [x, y, angle]: position in data space; angle in radians for screen-space rotation (0 = right, positive = clockwise, e.g. for CSS rotation).
|
|
6360
|
+
*/
|
|
6361
|
+
getSampledLinkPositionsMap() {
|
|
6362
|
+
return this._isDestroyed || !this.lines ? /* @__PURE__ */ new Map() : this.lines.getSampledLinkPositionsMap();
|
|
6363
|
+
}
|
|
6364
|
+
/**
|
|
6365
|
+
* For the links that are currently visible on the screen, get a sample of link indices, midpoint positions, and angles.
|
|
6366
|
+
* The resulting number of links will depend on the `linkSamplingDistance` configuration property,
|
|
6367
|
+
* and the sampled links will be evenly distributed.
|
|
6368
|
+
* Positions are in data space; angles are in radians for screen-space rotation (0 = right, positive = clockwise, e.g. for CSS rotation).
|
|
6369
|
+
*/
|
|
6370
|
+
getSampledLinks() {
|
|
6371
|
+
return this._isDestroyed || !this.lines ? { indices: [], positions: [], angles: [] } : this.lines.getSampledLinks();
|
|
6372
|
+
}
|
|
6038
6373
|
/**
|
|
6039
6374
|
* Gets the X-axis of rescaling function.
|
|
6040
6375
|
*
|
|
@@ -6087,15 +6422,6 @@ class Ht {
|
|
|
6087
6422
|
var t, i;
|
|
6088
6423
|
this._isDestroyed || this.ensureDevice(() => this.unpause()) || (this.store.isSimulationRunning = !0, (i = (t = this.config).onSimulationUnpause) == null || i.call(t));
|
|
6089
6424
|
}
|
|
6090
|
-
/**
|
|
6091
|
-
* Restart/Resume the simulation. This method unpauses a paused
|
|
6092
|
-
* simulation and resumes its execution.
|
|
6093
|
-
* @deprecated Use `unpause()` instead. This method will be removed in a future version.
|
|
6094
|
-
*/
|
|
6095
|
-
restart() {
|
|
6096
|
-
var t, i;
|
|
6097
|
-
this._isDestroyed || this.ensureDevice(() => this.restart()) || (this.store.isSimulationRunning = !0, (i = (t = this.config).onSimulationRestart) == null || i.call(t));
|
|
6098
|
-
}
|
|
6099
6425
|
/**
|
|
6100
6426
|
* Run one step of the simulation manually.
|
|
6101
6427
|
* Works even when the simulation is paused.
|
|
@@ -6107,19 +6433,21 @@ class Ht {
|
|
|
6107
6433
|
* Destroy this Cosmos instance.
|
|
6108
6434
|
*/
|
|
6109
6435
|
destroy() {
|
|
6110
|
-
var t, i, o, s, n, r, a,
|
|
6111
|
-
this._isDestroyed || (this._isDestroyed = !0, this.isReady = !1, window.clearTimeout(this._fitViewOnInitTimeoutID), this.stopFrames(), this.canvasD3Selection && this.canvasD3Selection.on("mouseenter.cosmos", null).on("mousemove.cosmos", null).on("mouseleave.cosmos", null).on("click", null).on("mousemove", null).on("contextmenu", null).on(".drag", null).on(".zoom", null),
|
|
6436
|
+
var t, i, o, s, n, r, a, d, l, c, f, u, h;
|
|
6437
|
+
this._isDestroyed || (this._isDestroyed = !0, this.isReady = !1, window.clearTimeout(this._fitViewOnInitTimeoutID), this.stopFrames(), this.canvasD3Selection && this.canvasD3Selection.on("mouseenter.cosmos", null).on("mousemove.cosmos", null).on("mouseleave.cosmos", null).on("click", null).on("mousemove", null).on("contextmenu", null).on(".drag", null).on(".zoom", null), b(document).on("keydown.cosmos", null).on("keyup.cosmos", null), (t = this.zoomInstance) != null && t.behavior && this.zoomInstance.behavior.on("start.detect", null).on("zoom.detect", null).on("end.detect", null), (i = this.dragInstance) != null && i.behavior && this.dragInstance.behavior.on("start.detect", null).on("drag.detect", null).on("end.detect", null), (o = this.fpsMonitor) == null || o.destroy(), (s = this.points) == null || s.destroy(), (n = this.lines) == null || n.destroy(), (r = this.clusters) == null || r.destroy(), (a = this.forceGravity) == null || a.destroy(), (d = this.forceCenter) == null || d.destroy(), (l = this.forceManyBody) == null || l.destroy(), (c = this.forceLinkIncoming) == null || c.destroy(), (f = this.forceLinkOutgoing) == null || f.destroy(), (u = this.forceMouse) == null || u.destroy(), this.device && this.shouldDestroyDevice && (this.device.beginRenderPass({
|
|
6112
6438
|
clearColor: this.store.backgroundColor,
|
|
6113
6439
|
clearDepth: 1,
|
|
6114
6440
|
clearStencil: 0
|
|
6115
|
-
}).end(), this.device.submit(), this.device.destroy()), this.shouldDestroyDevice && this.canvas && this.canvas.parentNode && this.canvas.parentNode.removeChild(this.canvas), this.attributionDivElement && this.attributionDivElement.parentNode && this.attributionDivElement.parentNode.removeChild(this.attributionDivElement), (
|
|
6441
|
+
}).end(), this.device.submit(), this.device.destroy()), this.shouldDestroyDevice && this.canvas && this.canvas.parentNode && this.canvas.parentNode.removeChild(this.canvas), this.attributionDivElement && this.attributionDivElement.parentNode && this.attributionDivElement.parentNode.removeChild(this.attributionDivElement), (h = document.getElementById("gl-bench-style")) == null || h.remove(), this.canvasD3Selection = void 0, this.attributionDivElement = void 0);
|
|
6116
6442
|
}
|
|
6117
6443
|
/**
|
|
6118
|
-
*
|
|
6444
|
+
* Applies pending data changes (positions, colors, sizes, shapes, links, forces, clusters)
|
|
6445
|
+
* to the graph visualization. Call this after setting data via methods like `setPointPositions`,
|
|
6446
|
+
* `setPointColors`, `setLinks`, etc. if you need to apply changes without calling `render()`.
|
|
6119
6447
|
*/
|
|
6120
6448
|
create() {
|
|
6121
6449
|
var t, i, o, s, n;
|
|
6122
|
-
this._isDestroyed || this.ensureDevice(() => this.create()) || this.points && this.lines && (this.isPointPositionsUpdateNeeded && this.points.updatePositions(), this.isPointColorUpdateNeeded && this.points.updateColor(), this.isPointSizeUpdateNeeded && this.points.updateSize(), this.isPointShapeUpdateNeeded && this.points.updateShape(), this.isPointImageIndicesUpdateNeeded && this.points.updateImageIndices(), this.isPointImageSizesUpdateNeeded && this.points.updateImageSizes(), this.isLinksUpdateNeeded && this.lines.updatePointsBuffer(), this.isLinkColorUpdateNeeded && this.lines.updateColor(), this.isLinkWidthUpdateNeeded && this.lines.updateWidth(), this.isLinkArrowUpdateNeeded && this.lines.updateArrow(), this.isForceManyBodyUpdateNeeded && ((t = this.forceManyBody) == null || t.create()), this.isForceLinkUpdateNeeded && ((i = this.forceLinkIncoming) == null || i.create(
|
|
6450
|
+
this._isDestroyed || this.ensureDevice(() => this.create()) || this.points && this.lines && (this.isPointPositionsUpdateNeeded && this.points.updatePositions(), this.isPointColorUpdateNeeded && this.points.updateColor(), this.isPointSizeUpdateNeeded && this.points.updateSize(), this.isPointShapeUpdateNeeded && this.points.updateShape(), this.isPointImageIndicesUpdateNeeded && this.points.updateImageIndices(), this.isPointImageSizesUpdateNeeded && this.points.updateImageSizes(), this.isLinksUpdateNeeded && this.lines.updatePointsBuffer(), this.isLinkColorUpdateNeeded && this.lines.updateColor(), this.isLinkWidthUpdateNeeded && this.lines.updateWidth(), this.isLinkArrowUpdateNeeded && this.lines.updateArrow(), this.isForceManyBodyUpdateNeeded && ((t = this.forceManyBody) == null || t.create()), this.isForceLinkUpdateNeeded && ((i = this.forceLinkIncoming) == null || i.create(j.INCOMING), (o = this.forceLinkOutgoing) == null || o.create(j.OUTGOING)), this.isForceCenterUpdateNeeded && ((s = this.forceCenter) == null || s.create()), this.isPointClusterUpdateNeeded && ((n = this.clusters) == null || n.create()), this.isPointPositionsUpdateNeeded = !1, this.isPointColorUpdateNeeded = !1, this.isPointSizeUpdateNeeded = !1, this.isPointShapeUpdateNeeded = !1, this.isPointImageIndicesUpdateNeeded = !1, this.isPointImageSizesUpdateNeeded = !1, this.isLinksUpdateNeeded = !1, this.isLinkColorUpdateNeeded = !1, this.isLinkWidthUpdateNeeded = !1, this.isLinkArrowUpdateNeeded = !1, this.isPointClusterUpdateNeeded = !1, this.isForceManyBodyUpdateNeeded = !1, this.isForceLinkUpdateNeeded = !1, this.isForceCenterUpdateNeeded = !1);
|
|
6123
6451
|
}
|
|
6124
6452
|
/**
|
|
6125
6453
|
* Converts an array of tuple positions to a single array containing all coordinates sequentially
|
|
@@ -6140,6 +6468,21 @@ class Ht {
|
|
|
6140
6468
|
i[o] = [t[o * 2], t[o * 2 + 1]];
|
|
6141
6469
|
return i;
|
|
6142
6470
|
}
|
|
6471
|
+
/**
|
|
6472
|
+
* Restores init-only fields (`enableSimulation`, `initialZoomLevel`, `randomSeed`, `attribution`)
|
|
6473
|
+
* to their pre-update values, preventing runtime changes via setConfig/setConfigPartial.
|
|
6474
|
+
*/
|
|
6475
|
+
preserveInitOnlyFields(t) {
|
|
6476
|
+
this.config.enableSimulation = t.enableSimulation, this.config.initialZoomLevel = t.initialZoomLevel, this.config.randomSeed = t.randomSeed, this.config.attribution = t.attribution;
|
|
6477
|
+
}
|
|
6478
|
+
/**
|
|
6479
|
+
* Compares the previous config snapshot with the current `this.config` and
|
|
6480
|
+
* applies any necessary side effects (updating renderers, store, behaviors, etc.).
|
|
6481
|
+
*/
|
|
6482
|
+
updateStateFromConfig(t) {
|
|
6483
|
+
var i, o, s, n, r, a, d, l, c, f;
|
|
6484
|
+
t.pointDefaultColor !== this.config.pointDefaultColor && (this.graph.updatePointColor(), (i = this.points) == null || i.updateColor()), t.pointDefaultSize !== this.config.pointDefaultSize && (this.graph.updatePointSize(), (o = this.points) == null || o.updateSize()), t.pointDefaultShape !== this.config.pointDefaultShape && (this.graph.updatePointShape(), (s = this.points) == null || s.updateShape()), t.linkDefaultColor !== this.config.linkDefaultColor && (this.graph.updateLinkColor(), (n = this.lines) == null || n.updateColor()), t.linkDefaultWidth !== this.config.linkDefaultWidth && (this.graph.updateLinkWidth(), (r = this.lines) == null || r.updateWidth()), t.linkDefaultArrows !== this.config.linkDefaultArrows && (this.graph.updateArrows(), (a = this.lines) == null || a.updateArrow()), (t.curvedLinkSegments !== this.config.curvedLinkSegments || t.curvedLinks !== this.config.curvedLinks) && ((d = this.lines) == null || d.updateCurveLineGeometry()), t.backgroundColor !== this.config.backgroundColor && (this.store.backgroundColor = z(this.config.backgroundColor)), t.hoveredPointRingColor !== this.config.hoveredPointRingColor && this.store.setHoveredPointRingColor(this.config.hoveredPointRingColor), t.focusedPointRingColor !== this.config.focusedPointRingColor && this.store.setFocusedPointRingColor(this.config.focusedPointRingColor), t.pointGreyoutColor !== this.config.pointGreyoutColor && this.store.setGreyoutPointColor(this.config.pointGreyoutColor), t.hoveredLinkColor !== this.config.hoveredLinkColor && this.store.setHoveredLinkColor(this.config.hoveredLinkColor), t.focusedPointIndex !== this.config.focusedPointIndex && this.store.setFocusedPoint(this.config.focusedPointIndex), t.pixelRatio !== this.config.pixelRatio && (l = this.device) != null && l.canvasContext && (this.device.canvasContext.setProps({ useDevicePixels: this.config.pixelRatio }), this.store.maxPointSize = J(this.device, this.config.pixelRatio)), t.spaceSize !== this.config.spaceSize && (this.store.adjustSpaceSize(this.config.spaceSize, ((c = this.device) == null ? void 0 : c.limits.maxTextureDimension2D) ?? 4096), this.resizeCanvas(!0), this.update(this.store.isSimulationRunning ? this.store.alpha : 0)), t.showFPSMonitor !== this.config.showFPSMonitor && (this.config.showFPSMonitor ? this.fpsMonitor = new ee(this.canvas) : ((f = this.fpsMonitor) == null || f.destroy(), this.fpsMonitor = void 0)), (t.enableZoom !== this.config.enableZoom || t.enableDrag !== this.config.enableDrag) && this.updateZoomDragBehaviors(), (t.onLinkClick !== this.config.onLinkClick || t.onLinkContextMenu !== this.config.onLinkContextMenu || t.onLinkMouseOver !== this.config.onLinkMouseOver || t.onLinkMouseOut !== this.config.onLinkMouseOut) && this.store.updateLinkHoveringEnabled(this.config);
|
|
6485
|
+
}
|
|
6143
6486
|
/**
|
|
6144
6487
|
* Ensures device is initialized before executing a method.
|
|
6145
6488
|
* If device is not ready, queues the method to run after initialization.
|
|
@@ -6172,9 +6515,9 @@ class Ht {
|
|
|
6172
6515
|
* Graph class decides what device to create with sensible defaults
|
|
6173
6516
|
*/
|
|
6174
6517
|
async createDevice(t) {
|
|
6175
|
-
return await
|
|
6518
|
+
return await le.createDevice({
|
|
6176
6519
|
type: "webgl",
|
|
6177
|
-
adapters: [
|
|
6520
|
+
adapters: [ce],
|
|
6178
6521
|
createCanvasContext: {
|
|
6179
6522
|
canvas: t,
|
|
6180
6523
|
// Provide existing canvas
|
|
@@ -6193,7 +6536,7 @@ class Ht {
|
|
|
6193
6536
|
*/
|
|
6194
6537
|
update(t = this.store.alpha) {
|
|
6195
6538
|
const { graph: i } = this;
|
|
6196
|
-
this.store.pointsTextureSize = Math.ceil(Math.sqrt(i.pointsNumber ?? 0)), this.store.linksTextureSize = Math.ceil(Math.sqrt((i.linksNumber ?? 0) * 2)), this.create(), this.initPrograms(), this.store.
|
|
6539
|
+
this.store.pointsTextureSize = Math.ceil(Math.sqrt(i.pointsNumber ?? 0)), this.store.linksTextureSize = Math.ceil(Math.sqrt((i.linksNumber ?? 0) * 2)), this.create(), this.initPrograms(), this.store.alpha = t;
|
|
6197
6540
|
}
|
|
6198
6541
|
/**
|
|
6199
6542
|
* Runs one step of the simulation (forces, position updates, alpha decay).
|
|
@@ -6206,15 +6549,17 @@ class Ht {
|
|
|
6206
6549
|
* to respect pause/unpause state.
|
|
6207
6550
|
*/
|
|
6208
6551
|
runSimulationStep(t = !1) {
|
|
6209
|
-
var
|
|
6552
|
+
var d, l, c, f, u, h, p, P, m, C, v, y, O, F, E, M, U, B, q;
|
|
6210
6553
|
const { config: { simulationGravity: i, simulationCenter: o, enableSimulation: s }, store: { isSimulationRunning: n } } = this;
|
|
6211
6554
|
if (!s) return;
|
|
6212
|
-
this.isRightClickMouse && this.config.enableRightClickRepulsion && ((
|
|
6213
|
-
|
|
6555
|
+
this.isRightClickMouse && this.config.enableRightClickRepulsion && ((d = this.forceMouse) == null || d.run(), (l = this.points) == null || l.updatePosition());
|
|
6556
|
+
const r = this.zoomInstance.shouldEnableSimulationDuringZoomOverride ?? this.config.enableSimulationDuringZoom;
|
|
6557
|
+
(t || n && !(this.zoomInstance.isRunning && !r)) && (i && ((c = this.forceGravity) == null || c.run(), (f = this.points) == null || f.updatePosition()), o && ((u = this.forceCenter) == null || u.run(), (h = this.points) == null || h.updatePosition()), (p = this.forceManyBody) == null || p.run(), (P = this.points) == null || P.updatePosition(), this.store.linksTextureSize && ((m = this.forceLinkIncoming) == null || m.run(), (C = this.points) == null || C.updatePosition(), (v = this.forceLinkOutgoing) == null || v.run(), (y = this.points) == null || y.updatePosition()), (this.graph.pointClusters || this.graph.clusterPositions) && ((O = this.clusters) == null || O.run(), (F = this.points) == null || F.updatePosition()), this.store.alpha += this.store.addAlpha(this.config.simulationDecay), this.isRightClickMouse && this.config.enableRightClickRepulsion && (this.store.alpha = Math.max(this.store.alpha, 0.1)), this.store.simulationProgress = Math.sqrt(Math.min(1, K / this.store.alpha)), (B = (U = this.config).onSimulationTick) == null || B.call(
|
|
6558
|
+
U,
|
|
6214
6559
|
this.store.alpha,
|
|
6215
6560
|
(E = this.store.hoveredPoint) == null ? void 0 : E.index,
|
|
6216
|
-
(
|
|
6217
|
-
)), (
|
|
6561
|
+
(M = this.store.hoveredPoint) == null ? void 0 : M.position
|
|
6562
|
+
)), (q = this.points) == null || q.trackPoints();
|
|
6218
6563
|
}
|
|
6219
6564
|
initPrograms() {
|
|
6220
6565
|
var t, i, o, s, n, r;
|
|
@@ -6226,7 +6571,7 @@ class Ht {
|
|
|
6226
6571
|
frame() {
|
|
6227
6572
|
if (this._isDestroyed) return;
|
|
6228
6573
|
const { store: { alpha: t, isSimulationRunning: i } } = this;
|
|
6229
|
-
t <
|
|
6574
|
+
t < K && i && this.end(), this.requestAnimationFrameId = window.requestAnimationFrame((o) => {
|
|
6230
6575
|
this.renderFrame(o), this._isDestroyed || this.frame();
|
|
6231
6576
|
});
|
|
6232
6577
|
}
|
|
@@ -6235,17 +6580,17 @@ class Ht {
|
|
|
6235
6580
|
* This does NOT schedule the next frame.
|
|
6236
6581
|
*/
|
|
6237
6582
|
renderFrame(t) {
|
|
6238
|
-
var i, o, s, n, r, a,
|
|
6583
|
+
var i, o, s, n, r, a, d;
|
|
6239
6584
|
if (!this._isDestroyed && this.store.pointsTextureSize) {
|
|
6240
6585
|
if ((i = this.fpsMonitor) == null || i.begin(), this.resizeCanvas(), this.dragInstance.isActive || this.findHoveredItem(), this.runSimulationStep(!1), this.device) {
|
|
6241
|
-
const
|
|
6242
|
-
clearColor:
|
|
6586
|
+
const l = this.store.backgroundColor ?? [0, 0, 0, 1], c = this.device.beginRenderPass({
|
|
6587
|
+
clearColor: l,
|
|
6243
6588
|
clearDepth: 1,
|
|
6244
6589
|
clearStencil: 0
|
|
6245
6590
|
}), { config: { renderLinks: f } } = this;
|
|
6246
6591
|
f !== !1 && !!this.store.linksTextureSize && !!this.graph.linksNumber && this.graph.linksNumber > 0 && ((o = this.lines) == null || o.draw(c)), (s = this.points) == null || s.draw(c), this.dragInstance.isActive && ((n = this.points) == null || n.drag(), (r = this.points) == null || r.drag(), (a = this.points) == null || a.trackPoints()), c.end(), this.device.submit();
|
|
6247
6592
|
}
|
|
6248
|
-
(
|
|
6593
|
+
(d = this.fpsMonitor) == null || d.end(t ?? performance.now()), this.currentEvent = void 0;
|
|
6249
6594
|
}
|
|
6250
6595
|
}
|
|
6251
6596
|
stopFrames() {
|
|
@@ -6266,7 +6611,7 @@ class Ht {
|
|
|
6266
6611
|
this.store.isSimulationRunning = !1, this.store.simulationProgress = 1, (i = (t = this.config).onSimulationEnd) == null || i.call(t), this._shouldForceHoverDetection = !0;
|
|
6267
6612
|
}
|
|
6268
6613
|
onClick(t) {
|
|
6269
|
-
var i, o, s, n, r, a,
|
|
6614
|
+
var i, o, s, n, r, a, d, l, c, f;
|
|
6270
6615
|
(n = (s = this.config).onClick) == null || n.call(
|
|
6271
6616
|
s,
|
|
6272
6617
|
(i = this.store.hoveredPoint) == null ? void 0 : i.index,
|
|
@@ -6277,8 +6622,8 @@ class Ht {
|
|
|
6277
6622
|
this.store.hoveredPoint.index,
|
|
6278
6623
|
this.store.hoveredPoint.position,
|
|
6279
6624
|
t
|
|
6280
|
-
) : this.store.hoveredLinkIndex !== void 0 ? (
|
|
6281
|
-
|
|
6625
|
+
) : this.store.hoveredLinkIndex !== void 0 ? (l = (d = this.config).onLinkClick) == null || l.call(
|
|
6626
|
+
d,
|
|
6282
6627
|
this.store.hoveredLinkIndex,
|
|
6283
6628
|
t
|
|
6284
6629
|
) : (f = (c = this.config).onBackgroundClick) == null || f.call(
|
|
@@ -6301,7 +6646,7 @@ class Ht {
|
|
|
6301
6646
|
);
|
|
6302
6647
|
}
|
|
6303
6648
|
onContextMenu(t) {
|
|
6304
|
-
var i, o, s, n, r, a,
|
|
6649
|
+
var i, o, s, n, r, a, d, l, c, f;
|
|
6305
6650
|
t.preventDefault(), (n = (s = this.config).onContextMenu) == null || n.call(
|
|
6306
6651
|
s,
|
|
6307
6652
|
(i = this.store.hoveredPoint) == null ? void 0 : i.index,
|
|
@@ -6312,8 +6657,8 @@ class Ht {
|
|
|
6312
6657
|
this.store.hoveredPoint.index,
|
|
6313
6658
|
this.store.hoveredPoint.position,
|
|
6314
6659
|
t
|
|
6315
|
-
) : this.store.hoveredLinkIndex !== void 0 ? (
|
|
6316
|
-
|
|
6660
|
+
) : this.store.hoveredLinkIndex !== void 0 ? (l = (d = this.config).onLinkContextMenu) == null || l.call(
|
|
6661
|
+
d,
|
|
6317
6662
|
this.store.hoveredLinkIndex,
|
|
6318
6663
|
t
|
|
6319
6664
|
) : (f = (c = this.config).onBackgroundContextMenu) == null || f.call(
|
|
@@ -6322,12 +6667,12 @@ class Ht {
|
|
|
6322
6667
|
);
|
|
6323
6668
|
}
|
|
6324
6669
|
resizeCanvas(t = !1) {
|
|
6325
|
-
var r, a, l;
|
|
6670
|
+
var r, a, d, l;
|
|
6326
6671
|
if (this._isDestroyed) return;
|
|
6327
6672
|
const i = this.canvas.clientWidth, o = this.canvas.clientHeight, [s, n] = this.store.screenSize;
|
|
6328
6673
|
if (t || s !== i || n !== o) {
|
|
6329
|
-
const { k:
|
|
6330
|
-
this.store.updateScreenSize(i, o), (r = this.canvasD3Selection) == null || r.call(this.zoomInstance.behavior.transform, this.zoomInstance.getTransform(
|
|
6674
|
+
const { k: c } = this.zoomInstance.eventTransform, f = this.zoomInstance.convertScreenToSpacePosition([s / 2, n / 2]);
|
|
6675
|
+
this.store.updateScreenSize(i, o), (r = this.canvasD3Selection) == null || r.call(this.zoomInstance.behavior.transform, this.zoomInstance.getTransform(f, c)), (a = this.points) == null || a.updateSampledPointsGrid(), (d = this.lines) == null || d.updateSampledLinksGrid(), this.store.isLinkHoveringEnabled && ((l = this.lines) == null || l.updateLinkIndexFbo());
|
|
6331
6676
|
}
|
|
6332
6677
|
}
|
|
6333
6678
|
updateZoomDragBehaviors() {
|
|
@@ -6336,12 +6681,12 @@ class Ht {
|
|
|
6336
6681
|
}
|
|
6337
6682
|
findHoveredItem() {
|
|
6338
6683
|
if (this._isDestroyed || !this._isMouseOnCanvas) return;
|
|
6339
|
-
if (this._findHoveredItemExecutionCount <
|
|
6684
|
+
if (this._findHoveredItemExecutionCount < Ce) {
|
|
6340
6685
|
this._findHoveredItemExecutionCount += 1;
|
|
6341
6686
|
return;
|
|
6342
6687
|
}
|
|
6343
6688
|
const t = Math.abs(this._lastMouseX - this._lastCheckedMouseX), i = Math.abs(this._lastMouseY - this._lastCheckedMouseY);
|
|
6344
|
-
if (!(!(t >
|
|
6689
|
+
if (!(!(t > $ || i > $) && !this._shouldForceHoverDetection)) {
|
|
6345
6690
|
if (this._lastCheckedMouseX = this._lastMouseX, this._lastCheckedMouseY = this._lastMouseY, this._shouldForceHoverDetection = !1, this._findHoveredItemExecutionCount = 0, this.findHoveredPoint(), this.graph.linksNumber && this.store.isLinkHoveringEnabled)
|
|
6346
6691
|
this.findHoveredLine();
|
|
6347
6692
|
else if (this.store.hoveredLinkIndex !== void 0) {
|
|
@@ -6352,24 +6697,24 @@ class Ht {
|
|
|
6352
6697
|
}
|
|
6353
6698
|
}
|
|
6354
6699
|
findHoveredPoint() {
|
|
6355
|
-
var
|
|
6700
|
+
var d, l, c, f, u;
|
|
6356
6701
|
if (this._isDestroyed || !this.device || !this.points) return;
|
|
6357
6702
|
this.points.findHoveredPoint();
|
|
6358
6703
|
let t = !1, i = !1;
|
|
6359
|
-
const o =
|
|
6704
|
+
const o = I(this.device, this.points.hoveredFbo, 0, 0, 2, 2), s = o[0], n = o[1], r = o[2], a = o[3];
|
|
6360
6705
|
n > 0 ? ((this.store.hoveredPoint === void 0 || this.store.hoveredPoint.index !== s) && (t = !0), this.store.hoveredPoint = {
|
|
6361
6706
|
index: s,
|
|
6362
6707
|
position: [r, a]
|
|
6363
|
-
}) : (this.store.hoveredPoint && (i = !0), this.store.hoveredPoint = void 0), t && this.store.hoveredPoint && ((c = (
|
|
6364
|
-
|
|
6708
|
+
}) : (this.store.hoveredPoint && (i = !0), this.store.hoveredPoint = void 0), t && this.store.hoveredPoint && ((c = (l = this.config).onPointMouseOver) == null || c.call(
|
|
6709
|
+
l,
|
|
6365
6710
|
this.store.hoveredPoint.index,
|
|
6366
6711
|
this.store.hoveredPoint.position,
|
|
6367
6712
|
this.currentEvent,
|
|
6368
|
-
((
|
|
6369
|
-
)), i && ((
|
|
6713
|
+
((d = this.store.selectedIndices) == null ? void 0 : d.includes(this.store.hoveredPoint.index)) ?? !1
|
|
6714
|
+
)), i && ((u = (f = this.config).onPointMouseOut) == null || u.call(f, this.currentEvent));
|
|
6370
6715
|
}
|
|
6371
6716
|
findHoveredLine() {
|
|
6372
|
-
var n, r, a,
|
|
6717
|
+
var n, r, a, d, l, c;
|
|
6373
6718
|
if (this._isDestroyed || !this.lines) return;
|
|
6374
6719
|
if (this.store.hoveredPoint) {
|
|
6375
6720
|
this.store.hoveredLinkIndex !== void 0 && (this.store.hoveredLinkIndex = void 0, (r = (n = this.config).onLinkMouseOut) == null || r.call(n, this.currentEvent));
|
|
@@ -6378,12 +6723,12 @@ class Ht {
|
|
|
6378
6723
|
this.lines.findHoveredLine();
|
|
6379
6724
|
let t = !1, i = !1;
|
|
6380
6725
|
if (!this.device) return;
|
|
6381
|
-
const s =
|
|
6382
|
-
s >= 0 ? (this.store.hoveredLinkIndex !== s && (t = !0), this.store.hoveredLinkIndex = s) : (this.store.hoveredLinkIndex !== void 0 && (i = !0), this.store.hoveredLinkIndex = void 0), t && this.store.hoveredLinkIndex !== void 0 && ((
|
|
6726
|
+
const s = I(this.device, this.lines.hoveredLineIndexFbo)[0];
|
|
6727
|
+
s >= 0 ? (this.store.hoveredLinkIndex !== s && (t = !0), this.store.hoveredLinkIndex = s) : (this.store.hoveredLinkIndex !== void 0 && (i = !0), this.store.hoveredLinkIndex = void 0), t && this.store.hoveredLinkIndex !== void 0 && ((d = (a = this.config).onLinkMouseOver) == null || d.call(a, this.store.hoveredLinkIndex)), i && ((c = (l = this.config).onLinkMouseOut) == null || c.call(l, this.currentEvent));
|
|
6383
6728
|
}
|
|
6384
6729
|
updateCanvasCursor() {
|
|
6385
6730
|
const { hoveredPointCursor: t, hoveredLinkCursor: i } = this.config;
|
|
6386
|
-
this.dragInstance.isActive ?
|
|
6731
|
+
this.dragInstance.isActive ? b(this.canvas).style("cursor", "grabbing") : this.store.hoveredPoint ? !this.config.enableDrag || this.store.isSpaceKeyPressed ? b(this.canvas).style("cursor", t) : b(this.canvas).style("cursor", "grab") : this.store.isLinkHoveringEnabled && this.store.hoveredLinkIndex !== void 0 ? b(this.canvas).style("cursor", i) : b(this.canvas).style("cursor", null);
|
|
6387
6732
|
}
|
|
6388
6733
|
addAttribution() {
|
|
6389
6734
|
var t;
|
|
@@ -6396,26 +6741,29 @@ class Ht {
|
|
|
6396
6741
|
margin: 0 0.6rem 0.6rem 0;
|
|
6397
6742
|
font-size: 0.7rem;
|
|
6398
6743
|
font-family: inherit;
|
|
6399
|
-
`, this.attributionDivElement.innerHTML =
|
|
6744
|
+
`, this.attributionDivElement.innerHTML = Ie(this.config.attribution, {
|
|
6400
6745
|
ALLOWED_TAGS: ["a", "b", "i", "em", "strong", "span", "div", "p", "br", "img"],
|
|
6401
6746
|
ALLOWED_ATTR: ["href", "target", "class", "id", "style", "src", "alt", "title"]
|
|
6402
6747
|
}), (t = this.store.div) == null || t.appendChild(this.attributionDivElement));
|
|
6403
6748
|
}
|
|
6404
6749
|
}
|
|
6405
6750
|
export {
|
|
6406
|
-
|
|
6407
|
-
|
|
6408
|
-
|
|
6409
|
-
|
|
6410
|
-
|
|
6411
|
-
|
|
6412
|
-
|
|
6413
|
-
Fe as
|
|
6414
|
-
|
|
6415
|
-
|
|
6416
|
-
|
|
6417
|
-
N as
|
|
6418
|
-
|
|
6419
|
-
|
|
6751
|
+
kt as Graph,
|
|
6752
|
+
oe as PointShape,
|
|
6753
|
+
me as clamp,
|
|
6754
|
+
k as defaultConfigValues,
|
|
6755
|
+
Ee as focusedPointRingOpacity,
|
|
6756
|
+
J as getMaxPointSize,
|
|
6757
|
+
z as getRgbaColor,
|
|
6758
|
+
Fe as hoveredPointRingOpacity,
|
|
6759
|
+
ve as isAClassInstance,
|
|
6760
|
+
ie as isArray,
|
|
6761
|
+
Re as isFunction,
|
|
6762
|
+
N as isNumber,
|
|
6763
|
+
xe as isObject,
|
|
6764
|
+
zt as isPlainObject,
|
|
6765
|
+
I as readPixels,
|
|
6766
|
+
Ae as rgbToBrightness,
|
|
6767
|
+
Ie as sanitizeHtml
|
|
6420
6768
|
};
|
|
6421
6769
|
//# sourceMappingURL=index.js.map
|