@cosmos.gl/graph 3.0.0-beta.6 → 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 +121 -158
- package/dist/index.d.ts +58 -19
- package/dist/index.js +990 -875
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +66 -63
- 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/Points/index.d.ts +7 -0
- package/dist/modules/Zoom/index.d.ts +4 -0
- package/dist/variables.d.ts +73 -43
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,79 +1,26 @@
|
|
|
1
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
|
-
const Te = "#b3b3b3", ge = void 0, Y = void 0, Ce = 1, Pe = 4, Re = "#666666", xe = 0.1, ve = 1, Ae = 1, te = "#222222", f = {
|
|
17
|
-
enableSimulation: !0,
|
|
18
|
-
/** Setting to 4096 because larger values crash the graph on iOS. More info: https://github.com/cosmosgl/graph/issues/203 */
|
|
19
|
-
spaceSize: 4096,
|
|
20
|
-
pointSizeScale: 1,
|
|
21
|
-
linkWidthScale: 1,
|
|
22
|
-
linkArrowsSizeScale: 1,
|
|
23
|
-
renderLinks: !0,
|
|
24
|
-
curvedLinks: !1,
|
|
25
|
-
curvedLinkSegments: 19,
|
|
26
|
-
curvedLinkWeight: 0.8,
|
|
27
|
-
curvedLinkControlPointDistance: 0.5,
|
|
28
|
-
linkArrows: !1,
|
|
29
|
-
linkVisibilityDistanceRange: [50, 150],
|
|
30
|
-
linkVisibilityMinTransparency: 0.25,
|
|
31
|
-
hoveredPointCursor: "auto",
|
|
32
|
-
hoveredLinkCursor: "auto",
|
|
33
|
-
renderHoveredPointRing: !1,
|
|
34
|
-
hoveredPointRingColor: "white",
|
|
35
|
-
hoveredLinkColor: void 0,
|
|
36
|
-
hoveredLinkWidthIncrease: 5,
|
|
37
|
-
focusedPointRingColor: "white",
|
|
38
|
-
focusedPointIndex: void 0,
|
|
39
|
-
simulation: {
|
|
40
|
-
decay: 5e3,
|
|
41
|
-
gravity: 0.25,
|
|
42
|
-
center: 0,
|
|
43
|
-
repulsion: 1,
|
|
44
|
-
repulsionTheta: 1.15,
|
|
45
|
-
linkSpring: 1,
|
|
46
|
-
linkDistance: 10,
|
|
47
|
-
linkDistRandomVariationRange: [1, 1.2],
|
|
48
|
-
repulsionFromMouse: 2,
|
|
49
|
-
friction: 0.85,
|
|
50
|
-
cluster: 0.1
|
|
51
|
-
},
|
|
52
|
-
showFPSMonitor: !1,
|
|
53
|
-
pixelRatio: typeof window < "u" && window.devicePixelRatio || 2,
|
|
54
|
-
scalePointsOnZoom: !1,
|
|
55
|
-
scaleLinksOnZoom: !1,
|
|
56
|
-
enableZoom: !0,
|
|
57
|
-
enableSimulationDuringZoom: !1,
|
|
58
|
-
enableDrag: !1,
|
|
59
|
-
fitViewOnInit: !0,
|
|
60
|
-
fitViewDelay: 250,
|
|
61
|
-
fitViewPadding: 0.1,
|
|
62
|
-
fitViewDuration: 250,
|
|
63
|
-
pointSamplingDistance: 100,
|
|
64
|
-
linkSamplingDistance: 100,
|
|
65
|
-
attribution: "",
|
|
66
|
-
rescalePositions: void 0,
|
|
67
|
-
enableRightClickRepulsion: !1
|
|
68
|
-
}, me = 0.7, Ie = 0.95, ye = 3;
|
|
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";
|
|
69
16
|
var L;
|
|
70
17
|
(function(e) {
|
|
71
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";
|
|
72
19
|
})(L || (L = {}));
|
|
73
|
-
const K = 1e-3, H = 64,
|
|
74
|
-
class
|
|
20
|
+
const K = 1e-3, H = 64, Ce = 4, $ = 2;
|
|
21
|
+
class Pe {
|
|
75
22
|
constructor() {
|
|
76
|
-
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);
|
|
77
24
|
}
|
|
78
25
|
get backgroundColor() {
|
|
79
26
|
return this._backgroundColor;
|
|
@@ -194,7 +141,7 @@ class Ee {
|
|
|
194
141
|
}
|
|
195
142
|
set backgroundColor(t) {
|
|
196
143
|
this._backgroundColor = t;
|
|
197
|
-
const i =
|
|
144
|
+
const i = Ae(t[0], t[1], t[2]);
|
|
198
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;
|
|
199
146
|
}
|
|
200
147
|
addRandomSeed(t) {
|
|
@@ -209,7 +156,7 @@ class Ee {
|
|
|
209
156
|
* Ensures `spaceSize` is always a positive number >= 2 (required for Math.log2).
|
|
210
157
|
*/
|
|
211
158
|
adjustSpaceSize(t, i) {
|
|
212
|
-
(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);
|
|
213
160
|
const o = 2;
|
|
214
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) {
|
|
215
162
|
console.warn(`Invalid webglMaxTextureSize: ${i}. Using configSpaceSize without WebGL limit adjustment.`), this.adjustedSpaceSize = t;
|
|
@@ -267,26 +214,26 @@ class Ee {
|
|
|
267
214
|
return (this.alphaTarget - this.alpha) * this.alphaDecay(t);
|
|
268
215
|
}
|
|
269
216
|
}
|
|
270
|
-
const
|
|
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);
|
|
271
218
|
function z(e) {
|
|
272
219
|
let t;
|
|
273
220
|
if (ie(e))
|
|
274
221
|
t = e;
|
|
275
222
|
else {
|
|
276
|
-
const i =
|
|
277
|
-
t = [
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
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;
|
|
285
232
|
}
|
|
286
|
-
function
|
|
233
|
+
function Ae(e, t, i) {
|
|
287
234
|
return 0.2126 * e + 0.7152 * t + 0.0722 * i;
|
|
288
235
|
}
|
|
289
|
-
function
|
|
236
|
+
function I(e, t, i = 0, o = 0, s, n) {
|
|
290
237
|
return e.readPixelsToArrayWebGL(t, {
|
|
291
238
|
sourceX: i,
|
|
292
239
|
sourceY: o,
|
|
@@ -294,7 +241,7 @@ function y(e, t, i = 0, o = 0, s, n) {
|
|
|
294
241
|
sourceHeight: n
|
|
295
242
|
});
|
|
296
243
|
}
|
|
297
|
-
function
|
|
244
|
+
function J(e, t) {
|
|
298
245
|
switch (e.info.type) {
|
|
299
246
|
case "webgl": {
|
|
300
247
|
const i = e.gl.getParameter(L.ALIASED_POINT_SIZE_RANGE);
|
|
@@ -306,14 +253,14 @@ function $(e, t) {
|
|
|
306
253
|
return H / t;
|
|
307
254
|
}
|
|
308
255
|
}
|
|
309
|
-
function
|
|
256
|
+
function me(e, t, i) {
|
|
310
257
|
return Math.min(Math.max(e, t), i);
|
|
311
258
|
}
|
|
312
|
-
function
|
|
259
|
+
function N(e) {
|
|
313
260
|
return e != null && !Number.isNaN(e);
|
|
314
261
|
}
|
|
315
|
-
function
|
|
316
|
-
return
|
|
262
|
+
function Ie(e, t) {
|
|
263
|
+
return he.sanitize(e, {
|
|
317
264
|
// Default configuration: allow common safe HTML elements and attributes
|
|
318
265
|
ALLOWED_TAGS: ["a", "b", "i", "em", "strong", "span", "div", "p", "br"],
|
|
319
266
|
ALLOWED_ATTR: ["href", "target", "class", "id", "style"],
|
|
@@ -321,30 +268,331 @@ function Be(e, t) {
|
|
|
321
268
|
...t
|
|
322
269
|
});
|
|
323
270
|
}
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
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;
|
|
327
275
|
}
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
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
|
+
}
|
|
360
|
+
}
|
|
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
|
+
}
|
|
400
|
+
}
|
|
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
|
+
}
|
|
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])) || []];
|
|
332
445
|
}
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
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
|
+
}
|
|
337
457
|
}
|
|
338
|
-
|
|
339
|
-
|
|
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);
|
|
340
467
|
}
|
|
341
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);
|
|
589
|
+
}
|
|
342
590
|
class w {
|
|
343
591
|
constructor(t, i, o, s, n) {
|
|
344
592
|
this._debugRandomNumber = Math.floor(Math.random() * 1e3), this.device = t, this.config = i, this.store = o, this.data = s, n && (this.points = n);
|
|
345
593
|
}
|
|
346
594
|
}
|
|
347
|
-
const
|
|
595
|
+
const De = `#version 300 es
|
|
348
596
|
precision highp float;
|
|
349
597
|
|
|
350
598
|
in vec4 rgba;
|
|
@@ -352,7 +600,7 @@ out vec4 fragColor;
|
|
|
352
600
|
|
|
353
601
|
void main() {
|
|
354
602
|
fragColor = rgba;
|
|
355
|
-
}`,
|
|
603
|
+
}`, Me = `#version 300 es
|
|
356
604
|
precision highp float;
|
|
357
605
|
|
|
358
606
|
uniform sampler2D positionsTexture;
|
|
@@ -378,7 +626,7 @@ void main() {
|
|
|
378
626
|
gl_Position = vec4(0.0, 0.0, 0.0, 1.0);
|
|
379
627
|
gl_PointSize = 1.0;
|
|
380
628
|
}
|
|
381
|
-
`,
|
|
629
|
+
`, Oe = `#version 300 es
|
|
382
630
|
precision highp float;
|
|
383
631
|
|
|
384
632
|
uniform sampler2D positionsTexture;
|
|
@@ -424,8 +672,8 @@ function X(e) {
|
|
|
424
672
|
}
|
|
425
673
|
return t;
|
|
426
674
|
}
|
|
427
|
-
function
|
|
428
|
-
const i =
|
|
675
|
+
function T(e, t) {
|
|
676
|
+
const i = de.getInfo(e);
|
|
429
677
|
return t * (i.bytesPerPixel ?? 0);
|
|
430
678
|
}
|
|
431
679
|
const D = `#version 300 es
|
|
@@ -442,7 +690,7 @@ void main() {
|
|
|
442
690
|
gl_Position = vec4(vertexCoord, 0, 1);
|
|
443
691
|
}
|
|
444
692
|
`;
|
|
445
|
-
class
|
|
693
|
+
class Ue extends w {
|
|
446
694
|
create() {
|
|
447
695
|
var s;
|
|
448
696
|
const { device: t, store: i } = this, { pointsTextureSize: o } = i;
|
|
@@ -451,10 +699,10 @@ class Ve extends w {
|
|
|
451
699
|
width: 1,
|
|
452
700
|
height: 1,
|
|
453
701
|
format: "rgba32float",
|
|
454
|
-
usage:
|
|
702
|
+
usage: g.SAMPLE | g.RENDER | g.COPY_DST
|
|
455
703
|
})), this.centermassTexture.copyImageData({
|
|
456
704
|
data: new Float32Array(4).fill(0),
|
|
457
|
-
bytesPerRow:
|
|
705
|
+
bytesPerRow: T("rgba32float", 1),
|
|
458
706
|
mipLevel: 0,
|
|
459
707
|
x: 0,
|
|
460
708
|
y: 0
|
|
@@ -479,22 +727,22 @@ class Ve extends w {
|
|
|
479
727
|
const { device: t, store: i, points: o } = this;
|
|
480
728
|
!o || !i.pointsTextureSize || !this.centermassFbo || this.centermassFbo.destroyed || !this.centermassTexture || this.centermassTexture.destroyed || (this.forceVertexCoordBuffer || (this.forceVertexCoordBuffer = t.createBuffer({
|
|
481
729
|
data: new Float32Array([-1, -1, 1, -1, -1, 1, 1, 1])
|
|
482
|
-
})), this.calculateUniformStore || (this.calculateUniformStore = new
|
|
730
|
+
})), this.calculateUniformStore || (this.calculateUniformStore = new R({
|
|
483
731
|
calculateCentermassUniforms: {
|
|
484
732
|
uniformTypes: {
|
|
485
733
|
pointsTextureSize: "f32"
|
|
486
734
|
}
|
|
487
735
|
}
|
|
488
|
-
})), this.forceUniformStore || (this.forceUniformStore = new
|
|
736
|
+
})), this.forceUniformStore || (this.forceUniformStore = new R({
|
|
489
737
|
forceCenterUniforms: {
|
|
490
738
|
uniformTypes: {
|
|
491
739
|
centerForce: "f32",
|
|
492
740
|
alpha: "f32"
|
|
493
741
|
}
|
|
494
742
|
}
|
|
495
|
-
})), this.calculateCentermassCommand || (this.calculateCentermassCommand = new
|
|
496
|
-
fs:
|
|
497
|
-
vs:
|
|
743
|
+
})), this.calculateCentermassCommand || (this.calculateCentermassCommand = new x(t, {
|
|
744
|
+
fs: De,
|
|
745
|
+
vs: Me,
|
|
498
746
|
topology: "point-list",
|
|
499
747
|
attributes: {
|
|
500
748
|
...this.pointIndices && { pointIndices: this.pointIndices }
|
|
@@ -522,8 +770,8 @@ class Ve extends w {
|
|
|
522
770
|
depthWriteEnabled: !1,
|
|
523
771
|
depthCompare: "always"
|
|
524
772
|
}
|
|
525
|
-
})), this.calculateCentermassCommand.setVertexCount(this.data.pointsNumber ?? 0), this.runCommand || (this.runCommand = new
|
|
526
|
-
fs:
|
|
773
|
+
})), this.calculateCentermassCommand.setVertexCount(this.data.pointsNumber ?? 0), this.runCommand || (this.runCommand = new x(t, {
|
|
774
|
+
fs: Oe,
|
|
527
775
|
vs: D,
|
|
528
776
|
topology: "triangle-strip",
|
|
529
777
|
vertexCount: 4,
|
|
@@ -563,7 +811,7 @@ class Ve extends w {
|
|
|
563
811
|
positionsTexture: o.previousPositionTexture
|
|
564
812
|
}), this.calculateCentermassCommand.draw(s), s.end(), this.forceUniformStore.setUniforms({
|
|
565
813
|
forceCenterUniforms: {
|
|
566
|
-
centerForce: this.config.simulationCenter
|
|
814
|
+
centerForce: this.config.simulationCenter,
|
|
567
815
|
alpha: i.alpha
|
|
568
816
|
}
|
|
569
817
|
}), this.runCommand.setBindings({
|
|
@@ -585,7 +833,7 @@ class Ve extends w {
|
|
|
585
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;
|
|
586
834
|
}
|
|
587
835
|
}
|
|
588
|
-
const
|
|
836
|
+
const Be = `#version 300 es
|
|
589
837
|
precision highp float;
|
|
590
838
|
|
|
591
839
|
uniform sampler2D positionsTexture;
|
|
@@ -625,12 +873,12 @@ void main() {
|
|
|
625
873
|
|
|
626
874
|
fragColor = velocity;
|
|
627
875
|
}`;
|
|
628
|
-
class
|
|
876
|
+
class be extends w {
|
|
629
877
|
initPrograms() {
|
|
630
878
|
const { device: t, points: i, store: o } = this;
|
|
631
879
|
!i || !o.pointsTextureSize || (this.vertexCoordBuffer || (this.vertexCoordBuffer = t.createBuffer({
|
|
632
880
|
data: new Float32Array([-1, -1, 1, -1, -1, 1, 1, 1])
|
|
633
|
-
})), this.uniformStore || (this.uniformStore = new
|
|
881
|
+
})), this.uniformStore || (this.uniformStore = new R({
|
|
634
882
|
forceGravityUniforms: {
|
|
635
883
|
uniformTypes: {
|
|
636
884
|
gravity: "f32",
|
|
@@ -638,8 +886,8 @@ class Xe extends w {
|
|
|
638
886
|
alpha: "f32"
|
|
639
887
|
}
|
|
640
888
|
}
|
|
641
|
-
})), this.runCommand || (this.runCommand = new
|
|
642
|
-
fs:
|
|
889
|
+
})), this.runCommand || (this.runCommand = new x(t, {
|
|
890
|
+
fs: Be,
|
|
643
891
|
vs: D,
|
|
644
892
|
topology: "triangle-strip",
|
|
645
893
|
vertexCount: 4,
|
|
@@ -669,8 +917,8 @@ class Xe extends w {
|
|
|
669
917
|
if (!i || !this.runCommand || !this.uniformStore || !i.previousPositionTexture || i.previousPositionTexture.destroyed || !i.velocityFbo || i.velocityFbo.destroyed) return;
|
|
670
918
|
this.uniformStore.setUniforms({
|
|
671
919
|
forceGravityUniforms: {
|
|
672
|
-
gravity: this.config.simulationGravity
|
|
673
|
-
spaceSize: o.adjustedSpaceSize
|
|
920
|
+
gravity: this.config.simulationGravity,
|
|
921
|
+
spaceSize: o.adjustedSpaceSize,
|
|
674
922
|
alpha: o.alpha
|
|
675
923
|
}
|
|
676
924
|
}), this.runCommand.setBindings({
|
|
@@ -691,7 +939,7 @@ class Xe extends w {
|
|
|
691
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;
|
|
692
940
|
}
|
|
693
941
|
}
|
|
694
|
-
function
|
|
942
|
+
function ze(e) {
|
|
695
943
|
return `#version 300 es
|
|
696
944
|
precision highp float;
|
|
697
945
|
|
|
@@ -780,86 +1028,86 @@ void main() {
|
|
|
780
1028
|
}
|
|
781
1029
|
`;
|
|
782
1030
|
}
|
|
783
|
-
function
|
|
1031
|
+
function _(e, t) {
|
|
784
1032
|
return !e || e.length !== 2 ? t : [e[0], e[1]];
|
|
785
1033
|
}
|
|
786
|
-
function
|
|
1034
|
+
function A(e, t) {
|
|
787
1035
|
return !e || e.length !== 4 ? t : [e[0], e[1], e[2], e[3]];
|
|
788
1036
|
}
|
|
789
|
-
var
|
|
790
|
-
class
|
|
1037
|
+
var j = /* @__PURE__ */ ((e) => (e.OUTGOING = "outgoing", e.INCOMING = "incoming", e))(j || {});
|
|
1038
|
+
class G extends w {
|
|
791
1039
|
constructor() {
|
|
792
1040
|
super(...arguments), this.linkFirstIndicesAndAmount = new Float32Array(), this.indices = new Float32Array(), this.maxPointDegree = 0;
|
|
793
1041
|
}
|
|
794
1042
|
create(t) {
|
|
795
|
-
var
|
|
1043
|
+
var u;
|
|
796
1044
|
const { device: i, store: { pointsTextureSize: o, linksTextureSize: s }, data: n } = this;
|
|
797
1045
|
if (!o || !s) return;
|
|
798
1046
|
this.linkFirstIndicesAndAmount = new Float32Array(o * o * 4), this.indices = new Float32Array(s * s * 4);
|
|
799
1047
|
const r = new Float32Array(s * s * 4), a = new Float32Array(s * s * 4), d = t === "incoming" ? n.sourceIndexToTargetIndices : n.targetIndexToSourceIndices;
|
|
800
1048
|
this.maxPointDegree = 0;
|
|
801
1049
|
let l = 0;
|
|
802
|
-
d == null || d.forEach((
|
|
803
|
-
|
|
804
|
-
var
|
|
805
|
-
this.indices[l * 4 + 0] =
|
|
806
|
-
const
|
|
807
|
-
let
|
|
808
|
-
|
|
809
|
-
}), this.maxPointDegree = Math.max(this.maxPointDegree,
|
|
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));
|
|
810
1058
|
});
|
|
811
|
-
const c = !this.linkFirstIndicesAndAmountTexture || this.linkFirstIndicesAndAmountTexture.width !== o || this.linkFirstIndicesAndAmountTexture.height !== o,
|
|
1059
|
+
const c = !this.linkFirstIndicesAndAmountTexture || this.linkFirstIndicesAndAmountTexture.width !== o || this.linkFirstIndicesAndAmountTexture.height !== o, f = !this.indicesTexture || this.indicesTexture.width !== s || this.indicesTexture.height !== s;
|
|
812
1060
|
c && (this.linkFirstIndicesAndAmountTexture && !this.linkFirstIndicesAndAmountTexture.destroyed && this.linkFirstIndicesAndAmountTexture.destroy(), this.linkFirstIndicesAndAmountTexture = i.createTexture({
|
|
813
1061
|
width: o,
|
|
814
1062
|
height: o,
|
|
815
1063
|
format: "rgba32float",
|
|
816
|
-
usage:
|
|
1064
|
+
usage: g.SAMPLE | g.COPY_DST
|
|
817
1065
|
})), this.linkFirstIndicesAndAmountTexture.copyImageData({
|
|
818
1066
|
data: this.linkFirstIndicesAndAmount,
|
|
819
|
-
bytesPerRow:
|
|
1067
|
+
bytesPerRow: T("rgba32float", o),
|
|
820
1068
|
mipLevel: 0,
|
|
821
1069
|
x: 0,
|
|
822
1070
|
y: 0
|
|
823
|
-
}),
|
|
1071
|
+
}), f && (this.indicesTexture && !this.indicesTexture.destroyed && this.indicesTexture.destroy(), this.biasAndStrengthTexture && !this.biasAndStrengthTexture.destroyed && this.biasAndStrengthTexture.destroy(), this.randomDistanceTexture && !this.randomDistanceTexture.destroyed && this.randomDistanceTexture.destroy(), this.indicesTexture = i.createTexture({
|
|
824
1072
|
width: s,
|
|
825
1073
|
height: s,
|
|
826
1074
|
format: "rgba32float",
|
|
827
|
-
usage:
|
|
1075
|
+
usage: g.SAMPLE | g.COPY_DST
|
|
828
1076
|
}), this.biasAndStrengthTexture = i.createTexture({
|
|
829
1077
|
width: s,
|
|
830
1078
|
height: s,
|
|
831
1079
|
format: "rgba32float",
|
|
832
|
-
usage:
|
|
1080
|
+
usage: g.SAMPLE | g.COPY_DST
|
|
833
1081
|
}), this.randomDistanceTexture = i.createTexture({
|
|
834
1082
|
width: s,
|
|
835
1083
|
height: s,
|
|
836
1084
|
format: "rgba32float",
|
|
837
|
-
usage:
|
|
1085
|
+
usage: g.SAMPLE | g.COPY_DST
|
|
838
1086
|
})), this.indicesTexture.copyImageData({
|
|
839
1087
|
data: this.indices,
|
|
840
|
-
bytesPerRow:
|
|
1088
|
+
bytesPerRow: T("rgba32float", s),
|
|
841
1089
|
mipLevel: 0,
|
|
842
1090
|
x: 0,
|
|
843
1091
|
y: 0
|
|
844
1092
|
}), this.biasAndStrengthTexture.copyImageData({
|
|
845
1093
|
data: r,
|
|
846
|
-
bytesPerRow:
|
|
1094
|
+
bytesPerRow: T("rgba32float", s),
|
|
847
1095
|
mipLevel: 0,
|
|
848
1096
|
x: 0,
|
|
849
1097
|
y: 0
|
|
850
1098
|
}), this.randomDistanceTexture.copyImageData({
|
|
851
1099
|
data: a,
|
|
852
|
-
bytesPerRow:
|
|
1100
|
+
bytesPerRow: T("rgba32float", s),
|
|
853
1101
|
mipLevel: 0,
|
|
854
1102
|
x: 0,
|
|
855
1103
|
y: 0
|
|
856
|
-
}), 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;
|
|
857
1105
|
}
|
|
858
1106
|
initPrograms() {
|
|
859
1107
|
const { device: t, store: i, points: o } = this;
|
|
860
1108
|
!o || !i.pointsTextureSize || !i.linksTextureSize || !this.linkFirstIndicesAndAmountTexture || !this.indicesTexture || !this.biasAndStrengthTexture || !this.randomDistanceTexture || (this.vertexCoordBuffer || (this.vertexCoordBuffer = t.createBuffer({
|
|
861
1109
|
data: new Float32Array([-1, -1, 1, -1, -1, 1, 1, 1])
|
|
862
|
-
})), this.uniformStore || (this.uniformStore = new
|
|
1110
|
+
})), this.uniformStore || (this.uniformStore = new R({
|
|
863
1111
|
forceLinkUniforms: {
|
|
864
1112
|
uniformTypes: {
|
|
865
1113
|
linkSpring: "f32",
|
|
@@ -870,8 +1118,8 @@ class J extends w {
|
|
|
870
1118
|
alpha: "f32"
|
|
871
1119
|
}
|
|
872
1120
|
}
|
|
873
|
-
})), this.runCommand || (this.runCommand = new
|
|
874
|
-
fs:
|
|
1121
|
+
})), this.runCommand || (this.runCommand = new x(t, {
|
|
1122
|
+
fs: ze(this.maxPointDegree),
|
|
875
1123
|
vs: D,
|
|
876
1124
|
topology: "triangle-strip",
|
|
877
1125
|
vertexCount: 4,
|
|
@@ -902,9 +1150,9 @@ class J extends w {
|
|
|
902
1150
|
return;
|
|
903
1151
|
this.uniformStore.setUniforms({
|
|
904
1152
|
forceLinkUniforms: {
|
|
905
|
-
linkSpring: this.config.simulationLinkSpring
|
|
906
|
-
linkDistance: this.config.simulationLinkDistance
|
|
907
|
-
linkDistRandomVariationRange:
|
|
1153
|
+
linkSpring: this.config.simulationLinkSpring,
|
|
1154
|
+
linkDistance: this.config.simulationLinkDistance,
|
|
1155
|
+
linkDistRandomVariationRange: _(this.config.simulationLinkDistRandomVariationRange, [0, 0]),
|
|
908
1156
|
pointsTextureSize: i.pointsTextureSize,
|
|
909
1157
|
linksTextureSize: i.linksTextureSize,
|
|
910
1158
|
alpha: i.alpha
|
|
@@ -931,7 +1179,7 @@ class J extends w {
|
|
|
931
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;
|
|
932
1180
|
}
|
|
933
1181
|
}
|
|
934
|
-
const
|
|
1182
|
+
const ke = `#version 300 es
|
|
935
1183
|
precision highp float;
|
|
936
1184
|
|
|
937
1185
|
in vec4 vColor;
|
|
@@ -939,7 +1187,7 @@ out vec4 fragColor;
|
|
|
939
1187
|
|
|
940
1188
|
void main() {
|
|
941
1189
|
fragColor = vColor;
|
|
942
|
-
}`,
|
|
1190
|
+
}`, we = `#version 300 es
|
|
943
1191
|
precision highp float;
|
|
944
1192
|
|
|
945
1193
|
uniform sampler2D positionsTexture;
|
|
@@ -975,7 +1223,7 @@ void main() {
|
|
|
975
1223
|
|
|
976
1224
|
gl_Position = vec4(levelPosition, 0.0, 1.0);
|
|
977
1225
|
gl_PointSize = 1.0;
|
|
978
|
-
}`,
|
|
1226
|
+
}`, Ve = `#version 300 es
|
|
979
1227
|
precision highp float;
|
|
980
1228
|
|
|
981
1229
|
uniform sampler2D positionsTexture;
|
|
@@ -1112,7 +1360,7 @@ void main() {
|
|
|
1112
1360
|
}
|
|
1113
1361
|
|
|
1114
1362
|
fragColor = velocity;
|
|
1115
|
-
}`,
|
|
1363
|
+
}`, He = `#version 300 es
|
|
1116
1364
|
precision highp float;
|
|
1117
1365
|
|
|
1118
1366
|
uniform sampler2D positionsTexture;
|
|
@@ -1173,7 +1421,7 @@ void main() {
|
|
|
1173
1421
|
|
|
1174
1422
|
fragColor = velocity;
|
|
1175
1423
|
}`;
|
|
1176
|
-
class
|
|
1424
|
+
class Xe extends w {
|
|
1177
1425
|
constructor() {
|
|
1178
1426
|
super(...arguments), this.levels = 0, this.levelTargets = /* @__PURE__ */ new Map();
|
|
1179
1427
|
}
|
|
@@ -1187,7 +1435,7 @@ class je extends w {
|
|
|
1187
1435
|
if (l && l.texture.width === d && l.texture.height === d) {
|
|
1188
1436
|
l.texture.copyImageData({
|
|
1189
1437
|
data: new Float32Array(d * d * 4).fill(0),
|
|
1190
|
-
bytesPerRow:
|
|
1438
|
+
bytesPerRow: T("rgba32float", d),
|
|
1191
1439
|
mipLevel: 0,
|
|
1192
1440
|
x: 0,
|
|
1193
1441
|
y: 0
|
|
@@ -1199,21 +1447,21 @@ class je extends w {
|
|
|
1199
1447
|
width: d,
|
|
1200
1448
|
height: d,
|
|
1201
1449
|
format: "rgba32float",
|
|
1202
|
-
usage:
|
|
1450
|
+
usage: g.SAMPLE | g.RENDER | g.COPY_DST
|
|
1203
1451
|
});
|
|
1204
1452
|
c.copyImageData({
|
|
1205
1453
|
data: new Float32Array(d * d * 4).fill(0),
|
|
1206
|
-
bytesPerRow:
|
|
1454
|
+
bytesPerRow: T("rgba32float", d),
|
|
1207
1455
|
mipLevel: 0,
|
|
1208
1456
|
x: 0,
|
|
1209
1457
|
y: 0
|
|
1210
1458
|
});
|
|
1211
|
-
const
|
|
1459
|
+
const f = t.createFramebuffer({
|
|
1212
1460
|
width: d,
|
|
1213
1461
|
height: d,
|
|
1214
1462
|
colorAttachments: [c]
|
|
1215
1463
|
});
|
|
1216
|
-
this.levelTargets.set(a, { texture: c, fbo:
|
|
1464
|
+
this.levelTargets.set(a, { texture: c, fbo: f });
|
|
1217
1465
|
}
|
|
1218
1466
|
for (const [a, d] of Array.from(this.levelTargets.entries()))
|
|
1219
1467
|
a >= this.levels && (d.fbo.destroyed || d.fbo.destroy(), d.texture.destroyed || d.texture.destroy(), this.levelTargets.delete(a));
|
|
@@ -1224,10 +1472,10 @@ class je extends w {
|
|
|
1224
1472
|
width: i.pointsTextureSize,
|
|
1225
1473
|
height: i.pointsTextureSize,
|
|
1226
1474
|
format: "rgba32float",
|
|
1227
|
-
usage:
|
|
1475
|
+
usage: g.SAMPLE | g.COPY_DST
|
|
1228
1476
|
})), this.randomValuesTexture.copyImageData({
|
|
1229
1477
|
data: s,
|
|
1230
|
-
bytesPerRow:
|
|
1478
|
+
bytesPerRow: T("rgba32float", i.pointsTextureSize),
|
|
1231
1479
|
mipLevel: 0,
|
|
1232
1480
|
x: 0,
|
|
1233
1481
|
y: 0
|
|
@@ -1245,7 +1493,7 @@ class je extends w {
|
|
|
1245
1493
|
}
|
|
1246
1494
|
initPrograms() {
|
|
1247
1495
|
const { device: t, store: i, data: o, points: s } = this;
|
|
1248
|
-
!o.pointsNumber || !s || !i.pointsTextureSize || (this.calculateLevelsUniformStore || (this.calculateLevelsUniformStore = new
|
|
1496
|
+
!o.pointsNumber || !s || !i.pointsTextureSize || (this.calculateLevelsUniformStore || (this.calculateLevelsUniformStore = new R({
|
|
1249
1497
|
calculateLevelsUniforms: {
|
|
1250
1498
|
uniformTypes: {
|
|
1251
1499
|
pointsTextureSize: "f32",
|
|
@@ -1258,9 +1506,9 @@ class je extends w {
|
|
|
1258
1506
|
cellSize: 0
|
|
1259
1507
|
}
|
|
1260
1508
|
}
|
|
1261
|
-
})), this.calculateLevelsCommand || (this.calculateLevelsCommand = new
|
|
1262
|
-
fs:
|
|
1263
|
-
vs:
|
|
1509
|
+
})), this.calculateLevelsCommand || (this.calculateLevelsCommand = new x(t, {
|
|
1510
|
+
fs: ke,
|
|
1511
|
+
vs: we,
|
|
1264
1512
|
topology: "point-list",
|
|
1265
1513
|
vertexCount: o.pointsNumber,
|
|
1266
1514
|
attributes: {
|
|
@@ -1289,7 +1537,7 @@ class je extends w {
|
|
|
1289
1537
|
depthWriteEnabled: !1,
|
|
1290
1538
|
depthCompare: "always"
|
|
1291
1539
|
}
|
|
1292
|
-
})), this.forceUniformStore || (this.forceUniformStore = new
|
|
1540
|
+
})), this.forceUniformStore || (this.forceUniformStore = new R({
|
|
1293
1541
|
forceUniforms: {
|
|
1294
1542
|
uniformTypes: {
|
|
1295
1543
|
level: "f32",
|
|
@@ -1305,15 +1553,15 @@ class je extends w {
|
|
|
1305
1553
|
levels: this.levels,
|
|
1306
1554
|
levelTextureSize: 0,
|
|
1307
1555
|
alpha: i.alpha,
|
|
1308
|
-
repulsion: this.config.simulationRepulsion
|
|
1309
|
-
spaceSize: i.adjustedSpaceSize
|
|
1310
|
-
theta: this.config.simulationRepulsionTheta
|
|
1556
|
+
repulsion: this.config.simulationRepulsion,
|
|
1557
|
+
spaceSize: i.adjustedSpaceSize,
|
|
1558
|
+
theta: this.config.simulationRepulsionTheta
|
|
1311
1559
|
}
|
|
1312
1560
|
}
|
|
1313
1561
|
})), this.forceVertexCoordBuffer || (this.forceVertexCoordBuffer = t.createBuffer({
|
|
1314
1562
|
data: new Float32Array([-1, -1, 1, -1, -1, 1, 1, 1])
|
|
1315
|
-
})), this.forceCommand || (this.forceCommand = new
|
|
1316
|
-
fs:
|
|
1563
|
+
})), this.forceCommand || (this.forceCommand = new x(t, {
|
|
1564
|
+
fs: Ve,
|
|
1317
1565
|
vs: D,
|
|
1318
1566
|
topology: "triangle-strip",
|
|
1319
1567
|
vertexCount: 4,
|
|
@@ -1343,7 +1591,7 @@ class je extends w {
|
|
|
1343
1591
|
depthWriteEnabled: !1,
|
|
1344
1592
|
depthCompare: "always"
|
|
1345
1593
|
}
|
|
1346
|
-
})), this.forceCenterUniformStore || (this.forceCenterUniformStore = new
|
|
1594
|
+
})), this.forceCenterUniformStore || (this.forceCenterUniformStore = new R({
|
|
1347
1595
|
forceCenterUniforms: {
|
|
1348
1596
|
uniformTypes: {
|
|
1349
1597
|
levelTextureSize: "f32",
|
|
@@ -1353,11 +1601,11 @@ class je extends w {
|
|
|
1353
1601
|
defaultUniforms: {
|
|
1354
1602
|
levelTextureSize: 0,
|
|
1355
1603
|
alpha: i.alpha,
|
|
1356
|
-
repulsion: this.config.simulationRepulsion
|
|
1604
|
+
repulsion: this.config.simulationRepulsion
|
|
1357
1605
|
}
|
|
1358
1606
|
}
|
|
1359
|
-
})), this.forceFromItsOwnCentermassCommand || (this.forceFromItsOwnCentermassCommand = new
|
|
1360
|
-
fs:
|
|
1607
|
+
})), this.forceFromItsOwnCentermassCommand || (this.forceFromItsOwnCentermassCommand = new x(t, {
|
|
1608
|
+
fs: He,
|
|
1361
1609
|
vs: D,
|
|
1362
1610
|
topology: "triangle-strip",
|
|
1363
1611
|
vertexCount: 4,
|
|
@@ -1412,7 +1660,7 @@ class je extends w {
|
|
|
1412
1660
|
for (let n = 0; n < this.levels; n += 1) {
|
|
1413
1661
|
const r = this.levelTargets.get(n);
|
|
1414
1662
|
if (!r || r.fbo.destroyed || r.texture.destroyed) continue;
|
|
1415
|
-
const a = Math.pow(2, n + 1), d =
|
|
1663
|
+
const a = Math.pow(2, n + 1), d = i.adjustedSpaceSize / a;
|
|
1416
1664
|
this.calculateLevelsUniformStore.setUniforms({
|
|
1417
1665
|
calculateLevelsUniforms: {
|
|
1418
1666
|
pointsTextureSize: i.pointsTextureSize ?? 0,
|
|
@@ -1446,9 +1694,9 @@ class je extends w {
|
|
|
1446
1694
|
levels: this.levels,
|
|
1447
1695
|
levelTextureSize: a,
|
|
1448
1696
|
alpha: i.alpha,
|
|
1449
|
-
repulsion: this.config.simulationRepulsion
|
|
1450
|
-
spaceSize: i.adjustedSpaceSize
|
|
1451
|
-
theta: this.config.simulationRepulsionTheta
|
|
1697
|
+
repulsion: this.config.simulationRepulsion,
|
|
1698
|
+
spaceSize: i.adjustedSpaceSize,
|
|
1699
|
+
theta: this.config.simulationRepulsionTheta
|
|
1452
1700
|
}
|
|
1453
1701
|
}), this.forceCommand.setBindings({
|
|
1454
1702
|
positionsTexture: o.previousPositionTexture,
|
|
@@ -1457,7 +1705,7 @@ class je extends w {
|
|
|
1457
1705
|
forceCenterUniforms: {
|
|
1458
1706
|
levelTextureSize: a,
|
|
1459
1707
|
alpha: i.alpha,
|
|
1460
|
-
repulsion: this.config.simulationRepulsion
|
|
1708
|
+
repulsion: this.config.simulationRepulsion
|
|
1461
1709
|
}
|
|
1462
1710
|
}), this.forceFromItsOwnCentermassCommand.setBindings({
|
|
1463
1711
|
positionsTexture: o.previousPositionTexture,
|
|
@@ -1468,7 +1716,7 @@ class je extends w {
|
|
|
1468
1716
|
s.end();
|
|
1469
1717
|
}
|
|
1470
1718
|
}
|
|
1471
|
-
const
|
|
1719
|
+
const We = `#version 300 es
|
|
1472
1720
|
precision highp float;
|
|
1473
1721
|
|
|
1474
1722
|
uniform sampler2D positionsTexture;
|
|
@@ -1503,20 +1751,20 @@ void main() {
|
|
|
1503
1751
|
|
|
1504
1752
|
fragColor = velocity;
|
|
1505
1753
|
}`;
|
|
1506
|
-
class
|
|
1754
|
+
class Ye extends w {
|
|
1507
1755
|
initPrograms() {
|
|
1508
1756
|
const { device: t, points: i } = this;
|
|
1509
1757
|
i && (this.vertexCoordBuffer || (this.vertexCoordBuffer = t.createBuffer({
|
|
1510
1758
|
data: new Float32Array([-1, -1, 1, -1, -1, 1, 1, 1])
|
|
1511
|
-
})), this.uniformStore || (this.uniformStore = new
|
|
1759
|
+
})), this.uniformStore || (this.uniformStore = new R({
|
|
1512
1760
|
forceMouseUniforms: {
|
|
1513
1761
|
uniformTypes: {
|
|
1514
1762
|
repulsion: "f32",
|
|
1515
1763
|
mousePos: "vec2<f32>"
|
|
1516
1764
|
}
|
|
1517
1765
|
}
|
|
1518
|
-
})), this.runCommand || (this.runCommand = new
|
|
1519
|
-
fs:
|
|
1766
|
+
})), this.runCommand || (this.runCommand = new x(t, {
|
|
1767
|
+
fs: We,
|
|
1520
1768
|
vs: D,
|
|
1521
1769
|
topology: "triangle-strip",
|
|
1522
1770
|
vertexCount: 4,
|
|
@@ -1546,8 +1794,8 @@ class Qe extends w {
|
|
|
1546
1794
|
if (!i || !this.runCommand || !this.uniformStore || !i.previousPositionTexture || i.previousPositionTexture.destroyed || !i.velocityFbo || i.velocityFbo.destroyed) return;
|
|
1547
1795
|
this.uniformStore.setUniforms({
|
|
1548
1796
|
forceMouseUniforms: {
|
|
1549
|
-
repulsion: this.config.simulationRepulsionFromMouse
|
|
1550
|
-
mousePos:
|
|
1797
|
+
repulsion: this.config.simulationRepulsionFromMouse,
|
|
1798
|
+
mousePos: _(o.mousePosition, [0, 0])
|
|
1551
1799
|
}
|
|
1552
1800
|
}), this.runCommand.setBindings({
|
|
1553
1801
|
positionsTexture: i.previousPositionTexture
|
|
@@ -1567,7 +1815,7 @@ class Qe extends w {
|
|
|
1567
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;
|
|
1568
1816
|
}
|
|
1569
1817
|
}
|
|
1570
|
-
const
|
|
1818
|
+
const Le = `#version 300 es
|
|
1571
1819
|
#ifdef GL_ES
|
|
1572
1820
|
precision highp float;
|
|
1573
1821
|
#endif
|
|
@@ -1578,7 +1826,7 @@ out vec4 fragColor;
|
|
|
1578
1826
|
|
|
1579
1827
|
void main() {
|
|
1580
1828
|
fragColor = rgba;
|
|
1581
|
-
}`,
|
|
1829
|
+
}`, Ke = `#version 300 es
|
|
1582
1830
|
#ifdef GL_ES
|
|
1583
1831
|
precision highp float;
|
|
1584
1832
|
#endif
|
|
@@ -1616,7 +1864,7 @@ void main() {
|
|
|
1616
1864
|
gl_Position = vec4(xy, 0.0, 1.0);
|
|
1617
1865
|
gl_PointSize = 1.0;
|
|
1618
1866
|
}
|
|
1619
|
-
`,
|
|
1867
|
+
`, Ze = `#version 300 es
|
|
1620
1868
|
#ifdef GL_ES
|
|
1621
1869
|
precision highp float;
|
|
1622
1870
|
#endif
|
|
@@ -1671,34 +1919,38 @@ void main() {
|
|
|
1671
1919
|
|
|
1672
1920
|
fragColor = velocity;
|
|
1673
1921
|
}`;
|
|
1674
|
-
class
|
|
1922
|
+
class je extends w {
|
|
1923
|
+
constructor() {
|
|
1924
|
+
super(...arguments), this.cachedCentroidPositions = null;
|
|
1925
|
+
}
|
|
1675
1926
|
create() {
|
|
1676
|
-
var
|
|
1927
|
+
var f, u;
|
|
1928
|
+
this.cachedCentroidPositions = null;
|
|
1677
1929
|
const { device: t, store: i, data: o } = this, { pointsTextureSize: s } = i;
|
|
1678
1930
|
if (o.pointsNumber === void 0 || !o.pointClusters && !o.clusterPositions) return;
|
|
1679
|
-
this.clusterCount = (o.pointClusters ?? []).reduce((
|
|
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));
|
|
1680
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);
|
|
1681
1933
|
if (o.clusterPositions)
|
|
1682
|
-
for (let
|
|
1683
|
-
l[
|
|
1684
|
-
for (let
|
|
1685
|
-
const
|
|
1686
|
-
|
|
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);
|
|
1687
1939
|
}
|
|
1688
1940
|
if (!this.clusterTexture || n ? (this.clusterTexture && !this.clusterTexture.destroyed && this.clusterTexture.destroy(), this.clusterTexture = t.createTexture({
|
|
1689
1941
|
width: s,
|
|
1690
1942
|
height: s,
|
|
1691
1943
|
format: "rgba32float",
|
|
1692
|
-
usage:
|
|
1944
|
+
usage: g.SAMPLE | g.RENDER | g.COPY_DST
|
|
1693
1945
|
}), this.clusterTexture.copyImageData({
|
|
1694
1946
|
data: d,
|
|
1695
|
-
bytesPerRow:
|
|
1947
|
+
bytesPerRow: T("rgba32float", s),
|
|
1696
1948
|
mipLevel: 0,
|
|
1697
1949
|
x: 0,
|
|
1698
1950
|
y: 0
|
|
1699
1951
|
})) : this.clusterTexture.copyImageData({
|
|
1700
1952
|
data: d,
|
|
1701
|
-
bytesPerRow:
|
|
1953
|
+
bytesPerRow: T("rgba32float", s),
|
|
1702
1954
|
mipLevel: 0,
|
|
1703
1955
|
x: 0,
|
|
1704
1956
|
y: 0
|
|
@@ -1706,16 +1958,16 @@ class et extends w {
|
|
|
1706
1958
|
width: this.clustersTextureSize,
|
|
1707
1959
|
height: this.clustersTextureSize,
|
|
1708
1960
|
format: "rgba32float",
|
|
1709
|
-
usage:
|
|
1961
|
+
usage: g.SAMPLE | g.RENDER | g.COPY_DST
|
|
1710
1962
|
}), this.clusterPositionsTexture.copyImageData({
|
|
1711
1963
|
data: l,
|
|
1712
|
-
bytesPerRow:
|
|
1964
|
+
bytesPerRow: T("rgba32float", this.clustersTextureSize),
|
|
1713
1965
|
mipLevel: 0,
|
|
1714
1966
|
x: 0,
|
|
1715
1967
|
y: 0
|
|
1716
1968
|
})) : this.clusterPositionsTexture.copyImageData({
|
|
1717
1969
|
data: l,
|
|
1718
|
-
bytesPerRow:
|
|
1970
|
+
bytesPerRow: T("rgba32float", this.clustersTextureSize),
|
|
1719
1971
|
mipLevel: 0,
|
|
1720
1972
|
x: 0,
|
|
1721
1973
|
y: 0
|
|
@@ -1723,16 +1975,16 @@ class et extends w {
|
|
|
1723
1975
|
width: s,
|
|
1724
1976
|
height: s,
|
|
1725
1977
|
format: "rgba32float",
|
|
1726
|
-
usage:
|
|
1978
|
+
usage: g.SAMPLE | g.RENDER | g.COPY_DST
|
|
1727
1979
|
}), this.clusterForceCoefficientTexture.copyImageData({
|
|
1728
1980
|
data: c,
|
|
1729
|
-
bytesPerRow:
|
|
1981
|
+
bytesPerRow: T("rgba32float", s),
|
|
1730
1982
|
mipLevel: 0,
|
|
1731
1983
|
x: 0,
|
|
1732
1984
|
y: 0
|
|
1733
1985
|
})) : this.clusterForceCoefficientTexture.copyImageData({
|
|
1734
1986
|
data: c,
|
|
1735
|
-
bytesPerRow:
|
|
1987
|
+
bytesPerRow: T("rgba32float", s),
|
|
1736
1988
|
mipLevel: 0,
|
|
1737
1989
|
x: 0,
|
|
1738
1990
|
y: 0
|
|
@@ -1740,10 +1992,10 @@ class et extends w {
|
|
|
1740
1992
|
width: this.clustersTextureSize,
|
|
1741
1993
|
height: this.clustersTextureSize,
|
|
1742
1994
|
format: "rgba32float",
|
|
1743
|
-
usage:
|
|
1995
|
+
usage: g.SAMPLE | g.RENDER | g.COPY_DST
|
|
1744
1996
|
}), this.centermassTexture.copyImageData({
|
|
1745
1997
|
data: new Float32Array(a).fill(0),
|
|
1746
|
-
bytesPerRow:
|
|
1998
|
+
bytesPerRow: T("rgba32float", this.clustersTextureSize),
|
|
1747
1999
|
mipLevel: 0,
|
|
1748
2000
|
x: 0,
|
|
1749
2001
|
y: 0
|
|
@@ -1753,17 +2005,17 @@ class et extends w {
|
|
|
1753
2005
|
colorAttachments: [this.centermassTexture]
|
|
1754
2006
|
})) : this.centermassTexture.copyImageData({
|
|
1755
2007
|
data: new Float32Array(a).fill(0),
|
|
1756
|
-
bytesPerRow:
|
|
2008
|
+
bytesPerRow: T("rgba32float", this.clustersTextureSize),
|
|
1757
2009
|
mipLevel: 0,
|
|
1758
2010
|
x: 0,
|
|
1759
2011
|
y: 0
|
|
1760
2012
|
}), !this.pointIndices || this.previousPointsTextureSize !== s) {
|
|
1761
2013
|
this.pointIndices && !this.pointIndices.destroyed && this.pointIndices.destroy();
|
|
1762
|
-
const
|
|
2014
|
+
const h = X(i.pointsTextureSize);
|
|
1763
2015
|
this.pointIndices = t.createBuffer({
|
|
1764
|
-
data:
|
|
2016
|
+
data: h,
|
|
1765
2017
|
usage: S.VERTEX | S.COPY_DST
|
|
1766
|
-
}), (
|
|
2018
|
+
}), (u = this.calculateCentermassCommand) == null || u.setAttributes({
|
|
1767
2019
|
pointIndices: this.pointIndices
|
|
1768
2020
|
});
|
|
1769
2021
|
}
|
|
@@ -1771,7 +2023,7 @@ class et extends w {
|
|
|
1771
2023
|
}
|
|
1772
2024
|
initPrograms() {
|
|
1773
2025
|
const { device: t, store: i, data: o } = this;
|
|
1774
|
-
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({
|
|
1775
2027
|
calculateCentermassUniforms: {
|
|
1776
2028
|
uniformTypes: {
|
|
1777
2029
|
pointsTextureSize: "f32",
|
|
@@ -1782,9 +2034,9 @@ class et extends w {
|
|
|
1782
2034
|
clustersTextureSize: this.clustersTextureSize ?? 0
|
|
1783
2035
|
}
|
|
1784
2036
|
}
|
|
1785
|
-
})), this.calculateCentermassCommand || (this.calculateCentermassCommand = new
|
|
1786
|
-
fs:
|
|
1787
|
-
vs:
|
|
2037
|
+
})), this.calculateCentermassCommand || (this.calculateCentermassCommand = new x(t, {
|
|
2038
|
+
fs: Le,
|
|
2039
|
+
vs: Ke,
|
|
1788
2040
|
topology: "point-list",
|
|
1789
2041
|
vertexCount: o.pointsNumber ?? 0,
|
|
1790
2042
|
attributes: {
|
|
@@ -1815,7 +2067,7 @@ class et extends w {
|
|
|
1815
2067
|
depthWriteEnabled: !1,
|
|
1816
2068
|
depthCompare: "always"
|
|
1817
2069
|
}
|
|
1818
|
-
})), this.applyForcesUniformStore || (this.applyForcesUniformStore = new
|
|
2070
|
+
})), this.applyForcesUniformStore || (this.applyForcesUniformStore = new R({
|
|
1819
2071
|
applyForcesUniforms: {
|
|
1820
2072
|
uniformTypes: {
|
|
1821
2073
|
alpha: "f32",
|
|
@@ -1825,13 +2077,13 @@ class et extends w {
|
|
|
1825
2077
|
defaultUniforms: {
|
|
1826
2078
|
alpha: i.alpha,
|
|
1827
2079
|
clustersTextureSize: this.clustersTextureSize ?? 0,
|
|
1828
|
-
clusterCoefficient: this.config.simulationCluster
|
|
2080
|
+
clusterCoefficient: this.config.simulationCluster
|
|
1829
2081
|
}
|
|
1830
2082
|
}
|
|
1831
2083
|
})), this.applyForcesVertexCoordBuffer || (this.applyForcesVertexCoordBuffer = t.createBuffer({
|
|
1832
2084
|
data: new Float32Array([-1, -1, 1, -1, -1, 1, 1, 1])
|
|
1833
|
-
})), this.applyForcesCommand || (this.applyForcesCommand = new
|
|
1834
|
-
fs:
|
|
2085
|
+
})), this.applyForcesCommand || (this.applyForcesCommand = new x(t, {
|
|
2086
|
+
fs: Ze,
|
|
1835
2087
|
vs: D,
|
|
1836
2088
|
topology: "triangle-strip",
|
|
1837
2089
|
vertexCount: 4,
|
|
@@ -1872,6 +2124,21 @@ class et extends w {
|
|
|
1872
2124
|
});
|
|
1873
2125
|
this.calculateCentermassCommand.draw(o), o.end();
|
|
1874
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
|
+
}
|
|
1875
2142
|
run() {
|
|
1876
2143
|
var i;
|
|
1877
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;
|
|
@@ -1879,7 +2146,7 @@ class et extends w {
|
|
|
1879
2146
|
applyForcesUniforms: {
|
|
1880
2147
|
alpha: this.store.alpha,
|
|
1881
2148
|
clustersTextureSize: this.clustersTextureSize ?? 0,
|
|
1882
|
-
clusterCoefficient: this.config.simulationCluster
|
|
2149
|
+
clusterCoefficient: this.config.simulationCluster
|
|
1883
2150
|
}
|
|
1884
2151
|
}), this.applyForcesCommand.setBindings({
|
|
1885
2152
|
clusterTexture: this.clusterTexture,
|
|
@@ -1900,10 +2167,10 @@ class et extends w {
|
|
|
1900
2167
|
*/
|
|
1901
2168
|
destroy() {
|
|
1902
2169
|
var t, i, o, s;
|
|
1903
|
-
(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;
|
|
1904
2171
|
}
|
|
1905
2172
|
}
|
|
1906
|
-
const
|
|
2173
|
+
const qe = `
|
|
1907
2174
|
#gl-bench {
|
|
1908
2175
|
position:absolute;
|
|
1909
2176
|
right:0;
|
|
@@ -1956,11 +2223,11 @@ const tt = `
|
|
|
1956
2223
|
stroke: #8288e4;
|
|
1957
2224
|
}
|
|
1958
2225
|
`;
|
|
1959
|
-
class
|
|
2226
|
+
class ee {
|
|
1960
2227
|
constructor(t) {
|
|
1961
2228
|
this.destroy();
|
|
1962
2229
|
const i = t.getContext("webgl") || t.getContext("experimental-webgl");
|
|
1963
|
-
this.bench = new
|
|
2230
|
+
this.bench = new pe(i, { css: qe });
|
|
1964
2231
|
}
|
|
1965
2232
|
begin() {
|
|
1966
2233
|
var t;
|
|
@@ -1974,206 +2241,7 @@ class G {
|
|
|
1974
2241
|
this.bench = void 0, b("#gl-bench").remove();
|
|
1975
2242
|
}
|
|
1976
2243
|
}
|
|
1977
|
-
|
|
1978
|
-
class ot {
|
|
1979
|
-
constructor(t) {
|
|
1980
|
-
this._config = t;
|
|
1981
|
-
}
|
|
1982
|
-
get pointsNumber() {
|
|
1983
|
-
return this.pointPositions && this.pointPositions.length / 2;
|
|
1984
|
-
}
|
|
1985
|
-
get linksNumber() {
|
|
1986
|
-
return this.links && this.links.length / 2;
|
|
1987
|
-
}
|
|
1988
|
-
updatePoints() {
|
|
1989
|
-
this.pointPositions = this.inputPointPositions;
|
|
1990
|
-
}
|
|
1991
|
-
/**
|
|
1992
|
-
* Updates the point colors based on the input data or default config value.
|
|
1993
|
-
*/
|
|
1994
|
-
updatePointColor() {
|
|
1995
|
-
if (this.pointsNumber === void 0) {
|
|
1996
|
-
this.pointColors = void 0;
|
|
1997
|
-
return;
|
|
1998
|
-
}
|
|
1999
|
-
const t = z(this._config.pointDefaultColor);
|
|
2000
|
-
if (this.inputPointColors === void 0 || this.inputPointColors.length / 4 !== this.pointsNumber) {
|
|
2001
|
-
this.pointColors = new Float32Array(this.pointsNumber * 4);
|
|
2002
|
-
for (let i = 0; i < this.pointColors.length / 4; i++)
|
|
2003
|
-
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];
|
|
2004
|
-
} else {
|
|
2005
|
-
this.pointColors = this.inputPointColors;
|
|
2006
|
-
for (let i = 0; i < this.pointColors.length / 4; i++)
|
|
2007
|
-
M(this.pointColors[i * 4]) || (this.pointColors[i * 4] = t[0]), M(this.pointColors[i * 4 + 1]) || (this.pointColors[i * 4 + 1] = t[1]), M(this.pointColors[i * 4 + 2]) || (this.pointColors[i * 4 + 2] = t[2]), M(this.pointColors[i * 4 + 3]) || (this.pointColors[i * 4 + 3] = t[3]);
|
|
2008
|
-
}
|
|
2009
|
-
}
|
|
2010
|
-
/**
|
|
2011
|
-
* Updates the point sizes based on the input data or default config value.
|
|
2012
|
-
*/
|
|
2013
|
-
updatePointSize() {
|
|
2014
|
-
if (this.pointsNumber === void 0) {
|
|
2015
|
-
this.pointSizes = void 0;
|
|
2016
|
-
return;
|
|
2017
|
-
}
|
|
2018
|
-
const t = this._config.pointDefaultSize;
|
|
2019
|
-
if (this.inputPointSizes === void 0 || this.inputPointSizes.length !== this.pointsNumber)
|
|
2020
|
-
this.pointSizes = new Float32Array(this.pointsNumber).fill(t);
|
|
2021
|
-
else {
|
|
2022
|
-
this.pointSizes = this.inputPointSizes;
|
|
2023
|
-
for (let i = 0; i < this.pointSizes.length; i++)
|
|
2024
|
-
M(this.pointSizes[i]) || (this.pointSizes[i] = t);
|
|
2025
|
-
}
|
|
2026
|
-
}
|
|
2027
|
-
/**
|
|
2028
|
-
* Updates the point shapes based on the input data or default shape.
|
|
2029
|
-
* Default behavior: Circle (0).
|
|
2030
|
-
* Images are rendered above shapes.
|
|
2031
|
-
*/
|
|
2032
|
-
updatePointShape() {
|
|
2033
|
-
if (this.pointsNumber === void 0) {
|
|
2034
|
-
this.pointShapes = void 0;
|
|
2035
|
-
return;
|
|
2036
|
-
}
|
|
2037
|
-
const t = 0;
|
|
2038
|
-
if (this.inputPointShapes === void 0 || this.inputPointShapes.length !== this.pointsNumber)
|
|
2039
|
-
this.pointShapes = new Float32Array(this.pointsNumber).fill(t);
|
|
2040
|
-
else {
|
|
2041
|
-
this.pointShapes = new Float32Array(this.inputPointShapes);
|
|
2042
|
-
const i = this.pointShapes;
|
|
2043
|
-
for (let o = 0; o < i.length; o++) {
|
|
2044
|
-
const s = i[o];
|
|
2045
|
-
(s == null || !M(s) || s < 0 || s > 8) && (i[o] = t);
|
|
2046
|
-
}
|
|
2047
|
-
}
|
|
2048
|
-
}
|
|
2049
|
-
/**
|
|
2050
|
-
* Updates the point image indices based on the input data or default value (-1 for no image).
|
|
2051
|
-
*/
|
|
2052
|
-
updatePointImageIndices() {
|
|
2053
|
-
if (this.pointsNumber === void 0) {
|
|
2054
|
-
this.pointImageIndices = void 0;
|
|
2055
|
-
return;
|
|
2056
|
-
}
|
|
2057
|
-
if (this.inputPointImageIndices === void 0 || this.inputPointImageIndices.length !== this.pointsNumber)
|
|
2058
|
-
this.pointImageIndices = new Float32Array(this.pointsNumber).fill(-1);
|
|
2059
|
-
else {
|
|
2060
|
-
const t = new Float32Array(this.inputPointImageIndices);
|
|
2061
|
-
for (let i = 0; i < t.length; i++) {
|
|
2062
|
-
const o = t[i], s = o === void 0 ? NaN : o;
|
|
2063
|
-
!Number.isFinite(s) || s < 0 ? t[i] = -1 : t[i] = Math.trunc(s);
|
|
2064
|
-
}
|
|
2065
|
-
this.pointImageIndices = t;
|
|
2066
|
-
}
|
|
2067
|
-
}
|
|
2068
|
-
/**
|
|
2069
|
-
* Updates the point image sizes based on the input data or default to point sizes.
|
|
2070
|
-
*/
|
|
2071
|
-
updatePointImageSizes() {
|
|
2072
|
-
var i;
|
|
2073
|
-
if (this.pointsNumber === void 0) {
|
|
2074
|
-
this.pointImageSizes = void 0;
|
|
2075
|
-
return;
|
|
2076
|
-
}
|
|
2077
|
-
const t = this._config.pointDefaultSize;
|
|
2078
|
-
if (this.inputPointImageSizes === void 0 || this.inputPointImageSizes.length !== this.pointsNumber)
|
|
2079
|
-
this.pointImageSizes = this.pointSizes ? new Float32Array(this.pointSizes) : new Float32Array(this.pointsNumber).fill(t);
|
|
2080
|
-
else {
|
|
2081
|
-
this.pointImageSizes = new Float32Array(this.inputPointImageSizes);
|
|
2082
|
-
for (let o = 0; o < this.pointImageSizes.length; o++)
|
|
2083
|
-
M(this.pointImageSizes[o]) || (this.pointImageSizes[o] = ((i = this.pointSizes) == null ? void 0 : i[o]) ?? t);
|
|
2084
|
-
}
|
|
2085
|
-
}
|
|
2086
|
-
updateLinks() {
|
|
2087
|
-
this.links = this.inputLinks;
|
|
2088
|
-
}
|
|
2089
|
-
/**
|
|
2090
|
-
* Updates the link colors based on the input data or default config value.
|
|
2091
|
-
*/
|
|
2092
|
-
updateLinkColor() {
|
|
2093
|
-
if (this.linksNumber === void 0) {
|
|
2094
|
-
this.linkColors = void 0;
|
|
2095
|
-
return;
|
|
2096
|
-
}
|
|
2097
|
-
const t = z(this._config.linkDefaultColor);
|
|
2098
|
-
if (this.inputLinkColors === void 0 || this.inputLinkColors.length / 4 !== this.linksNumber) {
|
|
2099
|
-
this.linkColors = new Float32Array(this.linksNumber * 4);
|
|
2100
|
-
for (let i = 0; i < this.linkColors.length / 4; i++)
|
|
2101
|
-
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];
|
|
2102
|
-
} else {
|
|
2103
|
-
this.linkColors = this.inputLinkColors;
|
|
2104
|
-
for (let i = 0; i < this.linkColors.length / 4; i++)
|
|
2105
|
-
M(this.linkColors[i * 4]) || (this.linkColors[i * 4] = t[0]), M(this.linkColors[i * 4 + 1]) || (this.linkColors[i * 4 + 1] = t[1]), M(this.linkColors[i * 4 + 2]) || (this.linkColors[i * 4 + 2] = t[2]), M(this.linkColors[i * 4 + 3]) || (this.linkColors[i * 4 + 3] = t[3]);
|
|
2106
|
-
}
|
|
2107
|
-
}
|
|
2108
|
-
/**
|
|
2109
|
-
* Updates the link width based on the input data or default config value.
|
|
2110
|
-
*/
|
|
2111
|
-
updateLinkWidth() {
|
|
2112
|
-
if (this.linksNumber === void 0) {
|
|
2113
|
-
this.linkWidths = void 0;
|
|
2114
|
-
return;
|
|
2115
|
-
}
|
|
2116
|
-
const t = this._config.linkDefaultWidth;
|
|
2117
|
-
if (this.inputLinkWidths === void 0 || this.inputLinkWidths.length !== this.linksNumber)
|
|
2118
|
-
this.linkWidths = new Float32Array(this.linksNumber).fill(t);
|
|
2119
|
-
else {
|
|
2120
|
-
this.linkWidths = this.inputLinkWidths;
|
|
2121
|
-
for (let i = 0; i < this.linkWidths.length; i++)
|
|
2122
|
-
M(this.linkWidths[i]) || (this.linkWidths[i] = t);
|
|
2123
|
-
}
|
|
2124
|
-
}
|
|
2125
|
-
/**
|
|
2126
|
-
* Updates the link arrows based on the input data or default config value.
|
|
2127
|
-
*/
|
|
2128
|
-
updateArrows() {
|
|
2129
|
-
if (this.linksNumber === void 0) {
|
|
2130
|
-
this.linkArrows = void 0;
|
|
2131
|
-
return;
|
|
2132
|
-
}
|
|
2133
|
-
const t = this._config.linkDefaultArrows;
|
|
2134
|
-
this.linkArrowsBoolean === void 0 || this.linkArrowsBoolean.length !== this.linksNumber ? this.linkArrows = new Array(this.linksNumber).fill(+t) : this.linkArrows = this.linkArrowsBoolean.map((i) => +i);
|
|
2135
|
-
}
|
|
2136
|
-
updateLinkStrength() {
|
|
2137
|
-
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;
|
|
2138
|
-
}
|
|
2139
|
-
updateClusters() {
|
|
2140
|
-
if (this.pointsNumber === void 0) {
|
|
2141
|
-
this.pointClusters = void 0, this.clusterPositions = void 0;
|
|
2142
|
-
return;
|
|
2143
|
-
}
|
|
2144
|
-
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;
|
|
2145
|
-
}
|
|
2146
|
-
update() {
|
|
2147
|
-
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();
|
|
2148
|
-
}
|
|
2149
|
-
getAdjacentIndices(t) {
|
|
2150
|
-
var i, o, s, n;
|
|
2151
|
-
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])) || []];
|
|
2152
|
-
}
|
|
2153
|
-
_createAdjacencyLists() {
|
|
2154
|
-
var t, i;
|
|
2155
|
-
if (this.linksNumber === void 0 || this.links === void 0) {
|
|
2156
|
-
this.sourceIndexToTargetIndices = void 0, this.targetIndexToSourceIndices = void 0;
|
|
2157
|
-
return;
|
|
2158
|
-
}
|
|
2159
|
-
this.sourceIndexToTargetIndices = new Array(this.pointsNumber).fill(void 0), this.targetIndexToSourceIndices = new Array(this.pointsNumber).fill(void 0);
|
|
2160
|
-
for (let o = 0; o < this.linksNumber; o++) {
|
|
2161
|
-
const s = this.links[o * 2], n = this.links[o * 2 + 1];
|
|
2162
|
-
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]));
|
|
2163
|
-
}
|
|
2164
|
-
}
|
|
2165
|
-
_calculateDegrees() {
|
|
2166
|
-
var t, i, o, s;
|
|
2167
|
-
if (this.pointsNumber === void 0) {
|
|
2168
|
-
this.degree = void 0, this.inDegree = void 0, this.outDegree = void 0;
|
|
2169
|
-
return;
|
|
2170
|
-
}
|
|
2171
|
-
this.degree = new Array(this.pointsNumber).fill(0), this.inDegree = new Array(this.pointsNumber).fill(0), this.outDegree = new Array(this.pointsNumber).fill(0);
|
|
2172
|
-
for (let n = 0; n < this.pointsNumber; n++)
|
|
2173
|
-
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);
|
|
2174
|
-
}
|
|
2175
|
-
}
|
|
2176
|
-
const st = (
|
|
2244
|
+
const Qe = (
|
|
2177
2245
|
/* glsl */
|
|
2178
2246
|
`
|
|
2179
2247
|
vec2 conicParametricCurve(vec2 A, vec2 B, vec2 ControlPoint, float t, float w) {
|
|
@@ -2182,10 +2250,10 @@ vec2 conicParametricCurve(vec2 A, vec2 B, vec2 ControlPoint, float t, float w) {
|
|
|
2182
2250
|
return divident / divisor;
|
|
2183
2251
|
}
|
|
2184
2252
|
`
|
|
2185
|
-
),
|
|
2253
|
+
), te = {
|
|
2186
2254
|
name: "conicParametricCurve",
|
|
2187
|
-
vs:
|
|
2188
|
-
},
|
|
2255
|
+
vs: Qe
|
|
2256
|
+
}, $e = `#version 300 es
|
|
2189
2257
|
#ifdef GL_ES
|
|
2190
2258
|
precision highp float;
|
|
2191
2259
|
#endif
|
|
@@ -2243,7 +2311,7 @@ void main() {
|
|
|
2243
2311
|
}
|
|
2244
2312
|
} else fragColor = vec4(color, opacity);
|
|
2245
2313
|
|
|
2246
|
-
}`,
|
|
2314
|
+
}`, Je = `#version 300 es
|
|
2247
2315
|
#ifdef GL_ES
|
|
2248
2316
|
precision highp float;
|
|
2249
2317
|
#endif
|
|
@@ -2484,7 +2552,7 @@ void main() {
|
|
|
2484
2552
|
#endif
|
|
2485
2553
|
|
|
2486
2554
|
gl_Position = vec4(final.rg, 0, 1);
|
|
2487
|
-
}`,
|
|
2555
|
+
}`, Ge = `#version 300 es
|
|
2488
2556
|
#ifdef GL_ES
|
|
2489
2557
|
precision highp float;
|
|
2490
2558
|
#endif
|
|
@@ -2496,7 +2564,7 @@ out vec4 fragColor;
|
|
|
2496
2564
|
void main() {
|
|
2497
2565
|
fragColor = rgba;
|
|
2498
2566
|
}
|
|
2499
|
-
`,
|
|
2567
|
+
`, et = `#version 300 es
|
|
2500
2568
|
#ifdef GL_ES
|
|
2501
2569
|
precision highp float;
|
|
2502
2570
|
#endif
|
|
@@ -2577,7 +2645,7 @@ void main() {
|
|
|
2577
2645
|
|
|
2578
2646
|
gl_PointSize = 1.0;
|
|
2579
2647
|
}
|
|
2580
|
-
`,
|
|
2648
|
+
`, tt = `#version 300 es
|
|
2581
2649
|
#ifdef GL_ES
|
|
2582
2650
|
precision highp float;
|
|
2583
2651
|
#endif
|
|
@@ -2617,7 +2685,7 @@ void main() {
|
|
|
2617
2685
|
// No link at this position, output -1 to indicate no hover
|
|
2618
2686
|
fragColor = vec4(-1.0, 0.0, 0.0, 0.0);
|
|
2619
2687
|
}
|
|
2620
|
-
} `,
|
|
2688
|
+
} `, it = `#version 300 es
|
|
2621
2689
|
#ifdef GL_ES
|
|
2622
2690
|
precision highp float;
|
|
2623
2691
|
#endif
|
|
@@ -2626,15 +2694,15 @@ in vec2 vertexCoord;
|
|
|
2626
2694
|
|
|
2627
2695
|
void main() {
|
|
2628
2696
|
gl_Position = vec4(vertexCoord, 0.0, 1.0);
|
|
2629
|
-
} `,
|
|
2630
|
-
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);
|
|
2631
2699
|
i.push(0.5);
|
|
2632
2700
|
const o = new Array(i.length * 2);
|
|
2633
2701
|
return i.forEach((s, n) => {
|
|
2634
2702
|
o[n * 2] = [t(s * 2), 0.5], o[n * 2 + 1] = [t(s * 2), -0.5];
|
|
2635
2703
|
}), o;
|
|
2636
2704
|
};
|
|
2637
|
-
class
|
|
2705
|
+
class st extends w {
|
|
2638
2706
|
initPrograms() {
|
|
2639
2707
|
var r;
|
|
2640
2708
|
const { device: t, config: i, store: o, data: s } = this;
|
|
@@ -2642,7 +2710,7 @@ class ht extends w {
|
|
|
2642
2710
|
width: 1,
|
|
2643
2711
|
height: 1,
|
|
2644
2712
|
format: "rgba32float",
|
|
2645
|
-
usage:
|
|
2713
|
+
usage: g.SAMPLE | g.RENDER | g.COPY_DST,
|
|
2646
2714
|
data: new Float32Array(4).fill(0)
|
|
2647
2715
|
})), this.hoveredLineIndexFbo || (this.hoveredLineIndexFbo = t.createFramebuffer({
|
|
2648
2716
|
width: 1,
|
|
@@ -2668,7 +2736,7 @@ class ht extends w {
|
|
|
2668
2736
|
})), this.linkIndexBuffer || (this.linkIndexBuffer = t.createBuffer({
|
|
2669
2737
|
data: new Float32Array(n),
|
|
2670
2738
|
usage: S.VERTEX | S.COPY_DST
|
|
2671
|
-
})), this.drawLineUniformStore || (this.drawLineUniformStore = new
|
|
2739
|
+
})), this.drawLineUniformStore || (this.drawLineUniformStore = new R({
|
|
2672
2740
|
drawLineUniforms: {
|
|
2673
2741
|
uniformTypes: {
|
|
2674
2742
|
transformationMatrix: "mat4x4<f32>",
|
|
@@ -2694,23 +2762,23 @@ class ht extends w {
|
|
|
2694
2762
|
defaultUniforms: {
|
|
2695
2763
|
transformationMatrix: o.transformationMatrix4x4,
|
|
2696
2764
|
pointsTextureSize: o.pointsTextureSize,
|
|
2697
|
-
widthScale: i.linkWidthScale
|
|
2698
|
-
linkArrowsSizeScale: i.linkArrowsSizeScale
|
|
2699
|
-
spaceSize: o.adjustedSpaceSize
|
|
2700
|
-
screenSize:
|
|
2701
|
-
linkVisibilityDistanceRange:
|
|
2702
|
-
linkVisibilityMinTransparency: i.linkVisibilityMinTransparency
|
|
2703
|
-
linkOpacity: i.linkOpacity
|
|
2704
|
-
greyoutOpacity: i.linkGreyoutOpacity
|
|
2705
|
-
curvedWeight: i.curvedLinkWeight
|
|
2706
|
-
curvedLinkControlPointDistance: i.curvedLinkControlPointDistance
|
|
2707
|
-
curvedLinkSegments: i.curvedLinks ? i.curvedLinkSegments
|
|
2708
|
-
scaleLinksOnZoom: i.scaleLinksOnZoom
|
|
2709
|
-
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,
|
|
2710
2778
|
renderMode: 0,
|
|
2711
2779
|
hoveredLinkIndex: o.hoveredLinkIndex ?? -1,
|
|
2712
|
-
hoveredLinkColor:
|
|
2713
|
-
hoveredLinkWidthIncrease: i.hoveredLinkWidthIncrease
|
|
2780
|
+
hoveredLinkColor: A(o.hoveredLinkColor, [-1, -1, -1, -1]),
|
|
2781
|
+
hoveredLinkWidthIncrease: i.hoveredLinkWidthIncrease
|
|
2714
2782
|
}
|
|
2715
2783
|
},
|
|
2716
2784
|
drawLineFragmentUniforms: {
|
|
@@ -2721,10 +2789,10 @@ class ht extends w {
|
|
|
2721
2789
|
renderMode: 0
|
|
2722
2790
|
}
|
|
2723
2791
|
}
|
|
2724
|
-
})), this.drawCurveCommand || (this.drawCurveCommand = new
|
|
2725
|
-
vs:
|
|
2726
|
-
fs:
|
|
2727
|
-
modules: [
|
|
2792
|
+
})), this.drawCurveCommand || (this.drawCurveCommand = new x(t, {
|
|
2793
|
+
vs: Je,
|
|
2794
|
+
fs: $e,
|
|
2795
|
+
modules: [te],
|
|
2728
2796
|
topology: "triangle-strip",
|
|
2729
2797
|
vertexCount: ((r = this.curveLineGeometry) == null ? void 0 : r.length) ?? 0,
|
|
2730
2798
|
attributes: {
|
|
@@ -2779,20 +2847,20 @@ class ht extends w {
|
|
|
2779
2847
|
})), this.quadBuffer || (this.quadBuffer = t.createBuffer({
|
|
2780
2848
|
data: new Float32Array([-1, -1, 1, -1, -1, 1, 1, 1]),
|
|
2781
2849
|
usage: S.VERTEX | S.COPY_DST
|
|
2782
|
-
})), this.hoveredLineIndexUniformStore || (this.hoveredLineIndexUniformStore = new
|
|
2850
|
+
})), this.hoveredLineIndexUniformStore || (this.hoveredLineIndexUniformStore = new R({
|
|
2783
2851
|
hoveredLineIndexUniforms: {
|
|
2784
2852
|
uniformTypes: {
|
|
2785
2853
|
mousePosition: "vec2<f32>",
|
|
2786
2854
|
screenSize: "vec2<f32>"
|
|
2787
2855
|
},
|
|
2788
2856
|
defaultUniforms: {
|
|
2789
|
-
mousePosition:
|
|
2790
|
-
screenSize:
|
|
2857
|
+
mousePosition: _(o.screenMousePosition, [0, 0]),
|
|
2858
|
+
screenSize: _(o.screenSize, [0, 0])
|
|
2791
2859
|
}
|
|
2792
2860
|
}
|
|
2793
|
-
})), this.hoveredLineIndexCommand || (this.hoveredLineIndexCommand = new
|
|
2794
|
-
vs:
|
|
2795
|
-
fs:
|
|
2861
|
+
})), this.hoveredLineIndexCommand || (this.hoveredLineIndexCommand = new x(t, {
|
|
2862
|
+
vs: it,
|
|
2863
|
+
fs: tt,
|
|
2796
2864
|
topology: "triangle-strip",
|
|
2797
2865
|
vertexCount: 4,
|
|
2798
2866
|
attributes: {
|
|
@@ -2810,7 +2878,7 @@ class ht extends w {
|
|
|
2810
2878
|
hoveredLineIndexUniforms: this.hoveredLineIndexUniformStore.getManagedUniformBuffer(t, "hoveredLineIndexUniforms")
|
|
2811
2879
|
// All texture bindings will be set dynamically in findHoveredLine() method
|
|
2812
2880
|
}
|
|
2813
|
-
})), this.fillSampledLinksUniformStore || (this.fillSampledLinksUniformStore = new
|
|
2881
|
+
})), this.fillSampledLinksUniformStore || (this.fillSampledLinksUniformStore = new R({
|
|
2814
2882
|
fillSampledLinksUniforms: {
|
|
2815
2883
|
uniformTypes: {
|
|
2816
2884
|
pointsTextureSize: "f32",
|
|
@@ -2824,17 +2892,17 @@ class ht extends w {
|
|
|
2824
2892
|
defaultUniforms: {
|
|
2825
2893
|
pointsTextureSize: o.pointsTextureSize ?? 0,
|
|
2826
2894
|
transformationMatrix: o.transformationMatrix4x4,
|
|
2827
|
-
spaceSize: o.adjustedSpaceSize
|
|
2828
|
-
screenSize:
|
|
2829
|
-
curvedWeight: i.curvedLinkWeight
|
|
2830
|
-
curvedLinkControlPointDistance: i.curvedLinkControlPointDistance
|
|
2831
|
-
curvedLinkSegments: i.curvedLinks ? i.curvedLinkSegments
|
|
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
|
|
2832
2900
|
}
|
|
2833
2901
|
}
|
|
2834
|
-
})), this.fillSampledLinksFboCommand || (this.fillSampledLinksFboCommand = new
|
|
2835
|
-
fs:
|
|
2836
|
-
vs:
|
|
2837
|
-
modules: [
|
|
2902
|
+
})), this.fillSampledLinksFboCommand || (this.fillSampledLinksFboCommand = new x(t, {
|
|
2903
|
+
fs: Ge,
|
|
2904
|
+
vs: et,
|
|
2905
|
+
modules: [te],
|
|
2838
2906
|
topology: "point-list",
|
|
2839
2907
|
vertexCount: s.linksNumber ?? 0,
|
|
2840
2908
|
attributes: {
|
|
@@ -2866,24 +2934,24 @@ class ht extends w {
|
|
|
2866
2934
|
drawLineUniforms: {
|
|
2867
2935
|
transformationMatrix: s.transformationMatrix4x4,
|
|
2868
2936
|
pointsTextureSize: s.pointsTextureSize,
|
|
2869
|
-
widthScale: i.linkWidthScale
|
|
2870
|
-
linkArrowsSizeScale: i.linkArrowsSizeScale
|
|
2871
|
-
spaceSize: s.adjustedSpaceSize
|
|
2872
|
-
screenSize:
|
|
2873
|
-
linkVisibilityDistanceRange:
|
|
2874
|
-
linkVisibilityMinTransparency: i.linkVisibilityMinTransparency
|
|
2875
|
-
linkOpacity: i.linkOpacity
|
|
2876
|
-
greyoutOpacity: i.linkGreyoutOpacity
|
|
2877
|
-
curvedWeight: i.curvedLinkWeight
|
|
2878
|
-
curvedLinkControlPointDistance: i.curvedLinkControlPointDistance
|
|
2879
|
-
curvedLinkSegments: i.curvedLinks ? i.curvedLinkSegments
|
|
2880
|
-
scaleLinksOnZoom: i.scaleLinksOnZoom
|
|
2881
|
-
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,
|
|
2882
2950
|
renderMode: 0,
|
|
2883
2951
|
// Normal rendering
|
|
2884
2952
|
hoveredLinkIndex: s.hoveredLinkIndex ?? -1,
|
|
2885
|
-
hoveredLinkColor:
|
|
2886
|
-
hoveredLinkWidthIncrease: i.hoveredLinkWidthIncrease
|
|
2953
|
+
hoveredLinkColor: A(s.hoveredLinkColor, [-1, -1, -1, -1]),
|
|
2954
|
+
hoveredLinkWidthIncrease: i.hoveredLinkWidthIncrease
|
|
2887
2955
|
},
|
|
2888
2956
|
drawLineFragmentUniforms: {
|
|
2889
2957
|
renderMode: 0
|
|
@@ -2905,10 +2973,10 @@ class ht extends w {
|
|
|
2905
2973
|
width: s,
|
|
2906
2974
|
height: n,
|
|
2907
2975
|
format: "rgba32float",
|
|
2908
|
-
usage:
|
|
2976
|
+
usage: g.SAMPLE | g.RENDER | g.COPY_DST
|
|
2909
2977
|
}), this.linkIndexTexture.copyImageData({
|
|
2910
2978
|
data: new Float32Array(s * n * 4).fill(0),
|
|
2911
|
-
bytesPerRow:
|
|
2979
|
+
bytesPerRow: T("rgba32float", s),
|
|
2912
2980
|
mipLevel: 0,
|
|
2913
2981
|
x: 0,
|
|
2914
2982
|
y: 0
|
|
@@ -2921,7 +2989,7 @@ class ht extends w {
|
|
|
2921
2989
|
updateSampledLinksGrid() {
|
|
2922
2990
|
const { store: { screenSize: t }, config: { linkSamplingDistance: i }, device: o } = this;
|
|
2923
2991
|
let s = i ?? Math.min(...t) / 2;
|
|
2924
|
-
s === 0 && (s =
|
|
2992
|
+
s === 0 && (s = k.linkSamplingDistance);
|
|
2925
2993
|
const n = Math.ceil(t[0] / s), r = Math.ceil(t[1] / s);
|
|
2926
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({
|
|
2927
2995
|
width: n,
|
|
@@ -2935,8 +3003,8 @@ class ht extends w {
|
|
|
2935
3003
|
if (i.linksNumber === void 0 || i.links === void 0 || !o.pointsTextureSize) return;
|
|
2936
3004
|
const s = new Float32Array(i.linksNumber * 2), n = new Float32Array(i.linksNumber * 2);
|
|
2937
3005
|
for (let l = 0; l < i.linksNumber; l++) {
|
|
2938
|
-
const c = i.links[l * 2],
|
|
2939
|
-
s[l * 2] =
|
|
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;
|
|
2940
3008
|
}
|
|
2941
3009
|
const r = (((d = this.pointABuffer) == null ? void 0 : d.byteLength) ?? 0) / (Float32Array.BYTES_PER_ELEMENT * 2);
|
|
2942
3010
|
!this.pointABuffer || r !== i.linksNumber ? (this.pointABuffer && !this.pointABuffer.destroyed && this.pointABuffer.destroy(), this.pointABuffer = t.createBuffer({
|
|
@@ -3000,7 +3068,7 @@ class ht extends w {
|
|
|
3000
3068
|
}
|
|
3001
3069
|
updateCurveLineGeometry() {
|
|
3002
3070
|
const { device: t, config: { curvedLinks: i, curvedLinkSegments: o } } = this;
|
|
3003
|
-
this.curveLineGeometry =
|
|
3071
|
+
this.curveLineGeometry = ot(i ? o : 1);
|
|
3004
3072
|
const s = new Float32Array(this.curveLineGeometry.length * 2);
|
|
3005
3073
|
for (let n = 0; n < this.curveLineGeometry.length; n++)
|
|
3006
3074
|
s[n * 2] = this.curveLineGeometry[n][0], s[n * 2 + 1] = this.curveLineGeometry[n][1];
|
|
@@ -3021,11 +3089,11 @@ class ht extends w {
|
|
|
3021
3089
|
fillSampledLinksUniforms: {
|
|
3022
3090
|
pointsTextureSize: this.store.pointsTextureSize ?? 0,
|
|
3023
3091
|
transformationMatrix: this.store.transformationMatrix4x4,
|
|
3024
|
-
spaceSize: this.store.adjustedSpaceSize
|
|
3025
|
-
screenSize:
|
|
3026
|
-
curvedWeight: this.config.curvedLinkWeight
|
|
3027
|
-
curvedLinkControlPointDistance: this.config.curvedLinkControlPointDistance
|
|
3028
|
-
curvedLinkSegments: this.config.curvedLinks ? this.config.curvedLinkSegments
|
|
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
|
|
3029
3097
|
}
|
|
3030
3098
|
}), this.fillSampledLinksFboCommand.setBindings({
|
|
3031
3099
|
positionsTexture: i.currentPositionTexture
|
|
@@ -3036,7 +3104,7 @@ class ht extends w {
|
|
|
3036
3104
|
});
|
|
3037
3105
|
this.fillSampledLinksFboCommand.draw(s), s.end();
|
|
3038
3106
|
}
|
|
3039
|
-
const o =
|
|
3107
|
+
const o = I(this.device, this.sampledLinksFbo);
|
|
3040
3108
|
for (let s = 0; s < o.length / 4; s++) {
|
|
3041
3109
|
const n = o[s * 4], r = o[s * 4 + 1], a = o[s * 4 + 2], d = o[s * 4 + 3];
|
|
3042
3110
|
n !== void 0 && n >= 0 && r !== void 0 && a !== void 0 && d !== void 0 && t.set(Math.round(n), [r, a, d]);
|
|
@@ -3053,11 +3121,11 @@ class ht extends w {
|
|
|
3053
3121
|
fillSampledLinksUniforms: {
|
|
3054
3122
|
pointsTextureSize: this.store.pointsTextureSize ?? 0,
|
|
3055
3123
|
transformationMatrix: this.store.transformationMatrix4x4,
|
|
3056
|
-
spaceSize: this.store.adjustedSpaceSize
|
|
3057
|
-
screenSize:
|
|
3058
|
-
curvedWeight: this.config.curvedLinkWeight
|
|
3059
|
-
curvedLinkControlPointDistance: this.config.curvedLinkControlPointDistance
|
|
3060
|
-
curvedLinkSegments: this.config.curvedLinks ? this.config.curvedLinkSegments
|
|
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
|
|
3061
3129
|
}
|
|
3062
3130
|
}), this.fillSampledLinksFboCommand.setBindings({
|
|
3063
3131
|
positionsTexture: s.currentPositionTexture
|
|
@@ -3068,7 +3136,7 @@ class ht extends w {
|
|
|
3068
3136
|
});
|
|
3069
3137
|
this.fillSampledLinksFboCommand.draw(r), r.end();
|
|
3070
3138
|
}
|
|
3071
|
-
const n =
|
|
3139
|
+
const n = I(this.device, this.sampledLinksFbo);
|
|
3072
3140
|
for (let r = 0; r < n.length / 4; r++) {
|
|
3073
3141
|
const a = n[r * 4], d = n[r * 4 + 1], l = n[r * 4 + 2], c = n[r * 4 + 3];
|
|
3074
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));
|
|
@@ -3082,24 +3150,24 @@ class ht extends w {
|
|
|
3082
3150
|
drawLineUniforms: {
|
|
3083
3151
|
transformationMatrix: o.transformationMatrix4x4,
|
|
3084
3152
|
pointsTextureSize: o.pointsTextureSize,
|
|
3085
|
-
widthScale: t.linkWidthScale
|
|
3086
|
-
linkArrowsSizeScale: t.linkArrowsSizeScale
|
|
3087
|
-
spaceSize: o.adjustedSpaceSize
|
|
3088
|
-
screenSize:
|
|
3089
|
-
linkVisibilityDistanceRange:
|
|
3090
|
-
linkVisibilityMinTransparency: t.linkVisibilityMinTransparency
|
|
3091
|
-
linkOpacity: t.linkOpacity
|
|
3092
|
-
greyoutOpacity: t.linkGreyoutOpacity
|
|
3093
|
-
curvedWeight: t.curvedLinkWeight
|
|
3094
|
-
curvedLinkControlPointDistance: t.curvedLinkControlPointDistance
|
|
3095
|
-
curvedLinkSegments: t.curvedLinks ? t.curvedLinkSegments
|
|
3096
|
-
scaleLinksOnZoom: t.scaleLinksOnZoom
|
|
3097
|
-
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,
|
|
3098
3166
|
renderMode: 1,
|
|
3099
3167
|
// Index rendering for picking
|
|
3100
3168
|
hoveredLinkIndex: o.hoveredLinkIndex ?? -1,
|
|
3101
|
-
hoveredLinkColor:
|
|
3102
|
-
hoveredLinkWidthIncrease: t.hoveredLinkWidthIncrease
|
|
3169
|
+
hoveredLinkColor: A(o.hoveredLinkColor, [-1, -1, -1, -1]),
|
|
3170
|
+
hoveredLinkWidthIncrease: t.hoveredLinkWidthIncrease
|
|
3103
3171
|
},
|
|
3104
3172
|
drawLineFragmentUniforms: {
|
|
3105
3173
|
renderMode: 1
|
|
@@ -3117,8 +3185,8 @@ class ht extends w {
|
|
|
3117
3185
|
if (this.drawCurveCommand.draw(s), s.end(), this.hoveredLineIndexCommand && this.hoveredLineIndexFbo && this.hoveredLineIndexUniformStore) {
|
|
3118
3186
|
this.hoveredLineIndexUniformStore.setUniforms({
|
|
3119
3187
|
hoveredLineIndexUniforms: {
|
|
3120
|
-
mousePosition:
|
|
3121
|
-
screenSize:
|
|
3188
|
+
mousePosition: _(o.screenMousePosition, [0, 0]),
|
|
3189
|
+
screenSize: _(o.screenSize, [0, 0])
|
|
3122
3190
|
}
|
|
3123
3191
|
}), this.hoveredLineIndexCommand.setBindings({
|
|
3124
3192
|
linkIndexTexture: this.linkIndexTexture
|
|
@@ -3138,7 +3206,7 @@ class ht extends w {
|
|
|
3138
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;
|
|
3139
3207
|
}
|
|
3140
3208
|
}
|
|
3141
|
-
const
|
|
3209
|
+
const nt = `#version 300 es
|
|
3142
3210
|
#ifdef GL_ES
|
|
3143
3211
|
precision highp float;
|
|
3144
3212
|
#endif
|
|
@@ -3397,7 +3465,7 @@ void main() {
|
|
|
3397
3465
|
finalPointAlpha
|
|
3398
3466
|
);
|
|
3399
3467
|
}
|
|
3400
|
-
`,
|
|
3468
|
+
`, rt = `#version 300 es
|
|
3401
3469
|
#ifdef GL_ES
|
|
3402
3470
|
precision highp float;
|
|
3403
3471
|
#endif
|
|
@@ -3599,7 +3667,7 @@ void main() {
|
|
|
3599
3667
|
imageAtlasUV = atlasCoords;
|
|
3600
3668
|
}
|
|
3601
3669
|
#endif
|
|
3602
|
-
} `,
|
|
3670
|
+
} `, at = `#version 300 es
|
|
3603
3671
|
#ifdef GL_ES
|
|
3604
3672
|
precision highp float;
|
|
3605
3673
|
#endif
|
|
@@ -3687,7 +3755,7 @@ void main() {
|
|
|
3687
3755
|
}
|
|
3688
3756
|
}
|
|
3689
3757
|
|
|
3690
|
-
`,
|
|
3758
|
+
`, dt = `#version 300 es
|
|
3691
3759
|
#ifdef GL_ES
|
|
3692
3760
|
precision highp float;
|
|
3693
3761
|
#endif
|
|
@@ -3775,7 +3843,7 @@ void main() {
|
|
|
3775
3843
|
if (pointInPolygon(screenPos, polygonPathTexture, polygonPathLength)) {
|
|
3776
3844
|
fragColor.r = 1.0;
|
|
3777
3845
|
}
|
|
3778
|
-
} `,
|
|
3846
|
+
} `, lt = `#version 300 es
|
|
3779
3847
|
#ifdef GL_ES
|
|
3780
3848
|
precision highp float;
|
|
3781
3849
|
#endif
|
|
@@ -3818,7 +3886,7 @@ void main () {
|
|
|
3818
3886
|
float opacity = smoothstep(r, r * smoothing, 1.0);
|
|
3819
3887
|
float stroke = smoothstep(width, width * smoothing, r);
|
|
3820
3888
|
fragColor = vec4(rgbColor, opacity * stroke * pointOpacity);
|
|
3821
|
-
}`,
|
|
3889
|
+
}`, ct = `#version 300 es
|
|
3822
3890
|
#ifdef GL_ES
|
|
3823
3891
|
precision highp float;
|
|
3824
3892
|
#endif
|
|
@@ -3962,7 +4030,7 @@ void main () {
|
|
|
3962
4030
|
#endif
|
|
3963
4031
|
|
|
3964
4032
|
gl_Position = vec4(final.rg, 0, 1);
|
|
3965
|
-
}`,
|
|
4033
|
+
}`, ft = `#version 300 es
|
|
3966
4034
|
#ifdef GL_ES
|
|
3967
4035
|
precision highp float;
|
|
3968
4036
|
#endif
|
|
@@ -3976,13 +4044,14 @@ void main() {
|
|
|
3976
4044
|
discard;
|
|
3977
4045
|
}
|
|
3978
4046
|
fragColor = rgba;
|
|
3979
|
-
}`,
|
|
4047
|
+
}`, ht = `#version 300 es
|
|
3980
4048
|
#ifdef GL_ES
|
|
3981
4049
|
precision highp float;
|
|
3982
4050
|
#endif
|
|
3983
4051
|
|
|
3984
4052
|
in vec2 pointIndices;
|
|
3985
4053
|
in float size;
|
|
4054
|
+
in float imageSize;
|
|
3986
4055
|
|
|
3987
4056
|
uniform sampler2D positionsTexture;
|
|
3988
4057
|
uniform sampler2D pointGreyoutStatus;
|
|
@@ -4075,7 +4144,9 @@ void main() {
|
|
|
4075
4144
|
vec3 finalPosition = transformationMatrix * vec3(normalizedPosition, 1);
|
|
4076
4145
|
#endif
|
|
4077
4146
|
|
|
4078
|
-
float
|
|
4147
|
+
float shapeSizeValue = calculatePointSize(size * sizeScale);
|
|
4148
|
+
float imageSizeValue = calculatePointSize(imageSize * sizeScale);
|
|
4149
|
+
float pointRadius = 0.5 * max(shapeSizeValue, imageSizeValue);
|
|
4079
4150
|
vec2 pointScreenPosition = (finalPosition.xy + 1.0) * screenSize / 2.0;
|
|
4080
4151
|
|
|
4081
4152
|
rgba = vec4(0.0);
|
|
@@ -4083,12 +4154,12 @@ void main() {
|
|
|
4083
4154
|
|
|
4084
4155
|
if (euclideanDistance(pointScreenPosition.x, mousePosition.x, pointScreenPosition.y, mousePosition.y) < pointRadius / ratio) {
|
|
4085
4156
|
float index = pointIndices.g * pointsTextureSize + pointIndices.r;
|
|
4086
|
-
rgba = vec4(index, size, pointPosition.xy);
|
|
4157
|
+
rgba = vec4(index, max(size, imageSize), pointPosition.xy);
|
|
4087
4158
|
gl_Position = vec4(-0.5, -0.5, 0.0, 1.0);
|
|
4088
4159
|
}
|
|
4089
4160
|
|
|
4090
4161
|
gl_PointSize = 1.0;
|
|
4091
|
-
}`,
|
|
4162
|
+
}`, ut = `#version 300 es
|
|
4092
4163
|
#ifdef GL_ES
|
|
4093
4164
|
precision highp float;
|
|
4094
4165
|
#endif
|
|
@@ -4099,7 +4170,7 @@ out vec4 fragColor;
|
|
|
4099
4170
|
|
|
4100
4171
|
void main() {
|
|
4101
4172
|
fragColor = rgba;
|
|
4102
|
-
}`,
|
|
4173
|
+
}`, St = `#version 300 es
|
|
4103
4174
|
#ifdef GL_ES
|
|
4104
4175
|
precision highp float;
|
|
4105
4176
|
#endif
|
|
@@ -4149,7 +4220,7 @@ void main() {
|
|
|
4149
4220
|
gl_Position = vec4(2.0 * vec2(i, j) - 1.0, 0.0, 1.0);
|
|
4150
4221
|
|
|
4151
4222
|
gl_PointSize = 1.0;
|
|
4152
|
-
}`,
|
|
4223
|
+
}`, pt = `#version 300 es
|
|
4153
4224
|
#ifdef GL_ES
|
|
4154
4225
|
precision highp float;
|
|
4155
4226
|
#endif
|
|
@@ -4199,7 +4270,7 @@ void main() {
|
|
|
4199
4270
|
pointPosition.g = clamp(pointPosition.g, 0.0, spaceSize);
|
|
4200
4271
|
|
|
4201
4272
|
fragColor = pointPosition;
|
|
4202
|
-
}`,
|
|
4273
|
+
}`, _t = `#version 300 es
|
|
4203
4274
|
#ifdef GL_ES
|
|
4204
4275
|
precision highp float;
|
|
4205
4276
|
#endif
|
|
@@ -4229,7 +4300,7 @@ void main() {
|
|
|
4229
4300
|
fragColor = vec4(pointPosition.rg, 1.0, 1.0);
|
|
4230
4301
|
}
|
|
4231
4302
|
|
|
4232
|
-
`,
|
|
4303
|
+
`, Tt = `#version 300 es
|
|
4233
4304
|
#ifdef GL_ES
|
|
4234
4305
|
precision highp float;
|
|
4235
4306
|
#endif
|
|
@@ -4263,7 +4334,7 @@ void main() {
|
|
|
4263
4334
|
|
|
4264
4335
|
fragColor = pointPosition;
|
|
4265
4336
|
}`;
|
|
4266
|
-
function
|
|
4337
|
+
function gt(e, t = 16384) {
|
|
4267
4338
|
if (!(e != null && e.length))
|
|
4268
4339
|
return null;
|
|
4269
4340
|
let i = 0;
|
|
@@ -4280,15 +4351,15 @@ function It(e, t = 16384) {
|
|
|
4280
4351
|
));
|
|
4281
4352
|
const a = new Uint8Array(n * n * 4).fill(0), d = new Float32Array(s * s * 4).fill(-1);
|
|
4282
4353
|
for (const [l, c] of e.entries()) {
|
|
4283
|
-
const
|
|
4284
|
-
if (
|
|
4354
|
+
const f = c.width, u = c.height;
|
|
4355
|
+
if (f === 0 || u === 0)
|
|
4285
4356
|
continue;
|
|
4286
|
-
const
|
|
4287
|
-
d[l * 4] =
|
|
4288
|
-
for (let
|
|
4289
|
-
for (let
|
|
4290
|
-
const
|
|
4291
|
-
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;
|
|
4292
4363
|
}
|
|
4293
4364
|
}
|
|
4294
4365
|
return {
|
|
@@ -4298,9 +4369,9 @@ function It(e, t = 16384) {
|
|
|
4298
4369
|
atlasCoordsSize: s
|
|
4299
4370
|
};
|
|
4300
4371
|
}
|
|
4301
|
-
class
|
|
4372
|
+
class Ct extends w {
|
|
4302
4373
|
constructor() {
|
|
4303
|
-
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;
|
|
4304
4375
|
}
|
|
4305
4376
|
updatePositions() {
|
|
4306
4377
|
const { device: t, store: i, data: o, config: { rescalePositions: s, enableSimulation: n } } = this, { pointsTextureSize: r } = i;
|
|
@@ -4313,17 +4384,17 @@ class yt extends w {
|
|
|
4313
4384
|
textureDataSize: a,
|
|
4314
4385
|
dataLength: d.length
|
|
4315
4386
|
});
|
|
4316
|
-
let
|
|
4317
|
-
s === void 0 && !n && (
|
|
4318
|
-
for (let
|
|
4319
|
-
d[
|
|
4387
|
+
let f = s;
|
|
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;
|
|
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;
|
|
4320
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({
|
|
4321
4392
|
width: r,
|
|
4322
4393
|
height: r,
|
|
4323
4394
|
format: "rgba32float"
|
|
4324
4395
|
}), this.currentPositionTexture.copyImageData({
|
|
4325
4396
|
data: d,
|
|
4326
|
-
bytesPerRow:
|
|
4397
|
+
bytesPerRow: T("rgba32float", r),
|
|
4327
4398
|
mipLevel: 0,
|
|
4328
4399
|
x: 0,
|
|
4329
4400
|
y: 0
|
|
@@ -4333,7 +4404,7 @@ class yt extends w {
|
|
|
4333
4404
|
colorAttachments: [this.currentPositionTexture]
|
|
4334
4405
|
})) : this.currentPositionTexture.copyImageData({
|
|
4335
4406
|
data: d,
|
|
4336
|
-
bytesPerRow:
|
|
4407
|
+
bytesPerRow: T("rgba32float", r),
|
|
4337
4408
|
mipLevel: 0,
|
|
4338
4409
|
x: 0,
|
|
4339
4410
|
y: 0
|
|
@@ -4343,7 +4414,7 @@ class yt extends w {
|
|
|
4343
4414
|
format: "rgba32float"
|
|
4344
4415
|
}), this.previousPositionTexture.copyImageData({
|
|
4345
4416
|
data: d,
|
|
4346
|
-
bytesPerRow:
|
|
4417
|
+
bytesPerRow: T("rgba32float", r),
|
|
4347
4418
|
mipLevel: 0,
|
|
4348
4419
|
x: 0,
|
|
4349
4420
|
y: 0
|
|
@@ -4353,19 +4424,19 @@ class yt extends w {
|
|
|
4353
4424
|
colorAttachments: [this.previousPositionTexture]
|
|
4354
4425
|
})) : this.previousPositionTexture.copyImageData({
|
|
4355
4426
|
data: d,
|
|
4356
|
-
bytesPerRow:
|
|
4427
|
+
bytesPerRow: T("rgba32float", r),
|
|
4357
4428
|
mipLevel: 0,
|
|
4358
4429
|
x: 0,
|
|
4359
4430
|
y: 0
|
|
4360
4431
|
}), this.config.enableSimulation) {
|
|
4361
|
-
const
|
|
4432
|
+
const p = new Float32Array(r * r * 4).fill(0);
|
|
4362
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({
|
|
4363
4434
|
width: r,
|
|
4364
4435
|
height: r,
|
|
4365
4436
|
format: "rgba32float"
|
|
4366
4437
|
}), this.velocityTexture.copyImageData({
|
|
4367
|
-
data:
|
|
4368
|
-
bytesPerRow:
|
|
4438
|
+
data: p,
|
|
4439
|
+
bytesPerRow: T("rgba32float", r),
|
|
4369
4440
|
mipLevel: 0,
|
|
4370
4441
|
x: 0,
|
|
4371
4442
|
y: 0
|
|
@@ -4374,8 +4445,8 @@ class yt extends w {
|
|
|
4374
4445
|
height: r,
|
|
4375
4446
|
colorAttachments: [this.velocityTexture]
|
|
4376
4447
|
})) : this.velocityTexture.copyImageData({
|
|
4377
|
-
data:
|
|
4378
|
-
bytesPerRow:
|
|
4448
|
+
data: p,
|
|
4449
|
+
bytesPerRow: T("rgba32float", r),
|
|
4379
4450
|
mipLevel: 0,
|
|
4380
4451
|
x: 0,
|
|
4381
4452
|
y: 0
|
|
@@ -4387,7 +4458,7 @@ class yt extends w {
|
|
|
4387
4458
|
format: "rgba32float"
|
|
4388
4459
|
}), this.selectedTexture.copyImageData({
|
|
4389
4460
|
data: d,
|
|
4390
|
-
bytesPerRow:
|
|
4461
|
+
bytesPerRow: T("rgba32float", r),
|
|
4391
4462
|
mipLevel: 0,
|
|
4392
4463
|
x: 0,
|
|
4393
4464
|
y: 0
|
|
@@ -4397,7 +4468,7 @@ class yt extends w {
|
|
|
4397
4468
|
colorAttachments: [this.selectedTexture]
|
|
4398
4469
|
})) : this.selectedTexture.copyImageData({
|
|
4399
4470
|
data: d,
|
|
4400
|
-
bytesPerRow:
|
|
4471
|
+
bytesPerRow: T("rgba32float", r),
|
|
4401
4472
|
mipLevel: 0,
|
|
4402
4473
|
x: 0,
|
|
4403
4474
|
y: 0
|
|
@@ -4406,19 +4477,19 @@ class yt extends w {
|
|
|
4406
4477
|
height: 2,
|
|
4407
4478
|
colorAttachments: ["rgba32float"]
|
|
4408
4479
|
}));
|
|
4409
|
-
const
|
|
4410
|
-
!this.drawPointIndices || this.drawPointIndices.byteLength !==
|
|
4411
|
-
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,
|
|
4412
4483
|
usage: S.VERTEX | S.COPY_DST
|
|
4413
|
-
})) : this.drawPointIndices.write(
|
|
4484
|
+
})) : this.drawPointIndices.write(u), this.drawCommand && this.drawCommand.setAttributes({
|
|
4414
4485
|
pointIndices: this.drawPointIndices
|
|
4415
|
-
}), !this.hoveredPointIndices || this.hoveredPointIndices.byteLength !==
|
|
4416
|
-
data:
|
|
4486
|
+
}), !this.hoveredPointIndices || this.hoveredPointIndices.byteLength !== h ? (this.hoveredPointIndices && !this.hoveredPointIndices.destroyed && this.hoveredPointIndices.destroy(), this.hoveredPointIndices = t.createBuffer({
|
|
4487
|
+
data: u,
|
|
4417
4488
|
usage: S.VERTEX | S.COPY_DST
|
|
4418
|
-
})) : this.hoveredPointIndices.write(
|
|
4419
|
-
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,
|
|
4420
4491
|
usage: S.VERTEX | S.COPY_DST
|
|
4421
|
-
})) : this.sampledPointIndices.write(
|
|
4492
|
+
})) : this.sampledPointIndices.write(u), this.fillSampledPointsFboCommand && this.fillSampledPointsFboCommand.setAttributes({
|
|
4422
4493
|
pointIndices: this.sampledPointIndices
|
|
4423
4494
|
}), this.updateGreyoutStatus(), this.updatePinnedStatus(), this.updateSampledPointsGrid(), this.trackPointsByIndices();
|
|
4424
4495
|
}
|
|
@@ -4427,7 +4498,7 @@ class yt extends w {
|
|
|
4427
4498
|
const { device: t, config: i, store: o, data: s } = this;
|
|
4428
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({
|
|
4429
4500
|
data: new Float32Array([-1, -1, 1, -1, -1, 1, 1, 1])
|
|
4430
|
-
})), this.updatePositionUniformStore || (this.updatePositionUniformStore = new
|
|
4501
|
+
})), this.updatePositionUniformStore || (this.updatePositionUniformStore = new R({
|
|
4431
4502
|
updatePositionUniforms: {
|
|
4432
4503
|
uniformTypes: {
|
|
4433
4504
|
// Order MUST match shader declaration order (std140 layout)
|
|
@@ -4435,12 +4506,12 @@ class yt extends w {
|
|
|
4435
4506
|
spaceSize: "f32"
|
|
4436
4507
|
},
|
|
4437
4508
|
defaultUniforms: {
|
|
4438
|
-
friction: i.simulationFriction
|
|
4439
|
-
spaceSize: o.adjustedSpaceSize
|
|
4509
|
+
friction: i.simulationFriction,
|
|
4510
|
+
spaceSize: o.adjustedSpaceSize
|
|
4440
4511
|
}
|
|
4441
4512
|
}
|
|
4442
|
-
})), this.updatePositionCommand || (this.updatePositionCommand = new
|
|
4443
|
-
fs:
|
|
4513
|
+
})), this.updatePositionCommand || (this.updatePositionCommand = new x(t, {
|
|
4514
|
+
fs: pt,
|
|
4444
4515
|
vs: D,
|
|
4445
4516
|
topology: "triangle-strip",
|
|
4446
4517
|
vertexCount: 4,
|
|
@@ -4461,7 +4532,7 @@ class yt extends w {
|
|
|
4461
4532
|
}
|
|
4462
4533
|
}))), this.dragPointVertexCoordBuffer || (this.dragPointVertexCoordBuffer = t.createBuffer({
|
|
4463
4534
|
data: new Float32Array([-1, -1, 1, -1, -1, 1, 1, 1])
|
|
4464
|
-
})), this.dragPointUniformStore || (this.dragPointUniformStore = new
|
|
4535
|
+
})), this.dragPointUniformStore || (this.dragPointUniformStore = new R({
|
|
4465
4536
|
dragPointUniforms: {
|
|
4466
4537
|
uniformTypes: {
|
|
4467
4538
|
// Order MUST match shader declaration order (std140 layout)
|
|
@@ -4469,12 +4540,12 @@ class yt extends w {
|
|
|
4469
4540
|
index: "f32"
|
|
4470
4541
|
},
|
|
4471
4542
|
defaultUniforms: {
|
|
4472
|
-
mousePos:
|
|
4543
|
+
mousePos: _(o.mousePosition, [0, 0]),
|
|
4473
4544
|
index: ((n = o.hoveredPoint) == null ? void 0 : n.index) ?? -1
|
|
4474
4545
|
}
|
|
4475
4546
|
}
|
|
4476
|
-
})), this.dragPointCommand || (this.dragPointCommand = new
|
|
4477
|
-
fs:
|
|
4547
|
+
})), this.dragPointCommand || (this.dragPointCommand = new x(t, {
|
|
4548
|
+
fs: Tt,
|
|
4478
4549
|
vs: D,
|
|
4479
4550
|
topology: "triangle-strip",
|
|
4480
4551
|
vertexCount: 4,
|
|
@@ -4493,7 +4564,7 @@ class yt extends w {
|
|
|
4493
4564
|
dragPointUniforms: this.dragPointUniformStore.getManagedUniformBuffer(t, "dragPointUniforms")
|
|
4494
4565
|
// All texture bindings will be set dynamically in drag() method
|
|
4495
4566
|
}
|
|
4496
|
-
})), this.drawUniformStore || (this.drawUniformStore = new
|
|
4567
|
+
})), this.drawUniformStore || (this.drawUniformStore = new R({
|
|
4497
4568
|
drawVertexUniforms: {
|
|
4498
4569
|
uniformTypes: {
|
|
4499
4570
|
// Order MUST match shader declaration order (std140 layout)
|
|
@@ -4516,7 +4587,7 @@ class yt extends w {
|
|
|
4516
4587
|
},
|
|
4517
4588
|
defaultUniforms: {
|
|
4518
4589
|
// Order MUST match uniformTypes and shader declaration
|
|
4519
|
-
ratio: i.pixelRatio
|
|
4590
|
+
ratio: i.pixelRatio,
|
|
4520
4591
|
transformationMatrix: (() => {
|
|
4521
4592
|
const d = o.transform ?? [1, 0, 0, 0, 1, 0, 0, 0, 1];
|
|
4522
4593
|
return [
|
|
@@ -4539,14 +4610,14 @@ class yt extends w {
|
|
|
4539
4610
|
];
|
|
4540
4611
|
})(),
|
|
4541
4612
|
pointsTextureSize: o.pointsTextureSize ?? 0,
|
|
4542
|
-
sizeScale: i.pointSizeScale
|
|
4543
|
-
spaceSize: o.adjustedSpaceSize
|
|
4544
|
-
screenSize:
|
|
4545
|
-
greyoutColor:
|
|
4546
|
-
backgroundColor:
|
|
4547
|
-
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,
|
|
4548
4619
|
// Convert boolean to float
|
|
4549
|
-
maxPointSize: o.maxPointSize
|
|
4620
|
+
maxPointSize: o.maxPointSize,
|
|
4550
4621
|
isDarkenGreyout: o.isDarkenGreyout ?? !1 ? 1 : 0,
|
|
4551
4622
|
// Convert boolean to float
|
|
4552
4623
|
skipSelected: 0,
|
|
@@ -4567,16 +4638,17 @@ class yt extends w {
|
|
|
4567
4638
|
backgroundColor: "vec4<f32>"
|
|
4568
4639
|
},
|
|
4569
4640
|
defaultUniforms: {
|
|
4641
|
+
// -1 is a sentinel value for the shader: when greyoutOpacity is -1, the shader skips opacity override (i.e. "not set")
|
|
4570
4642
|
greyoutOpacity: i.pointGreyoutOpacity ?? -1,
|
|
4571
|
-
pointOpacity: i.pointOpacity
|
|
4643
|
+
pointOpacity: i.pointOpacity,
|
|
4572
4644
|
isDarkenGreyout: o.isDarkenGreyout ?? !1 ? 1 : 0,
|
|
4573
4645
|
// Convert boolean to float
|
|
4574
|
-
backgroundColor:
|
|
4646
|
+
backgroundColor: A(o.backgroundColor, [0, 0, 0, 1])
|
|
4575
4647
|
}
|
|
4576
4648
|
}
|
|
4577
|
-
})), this.drawCommand || (this.drawCommand = new
|
|
4578
|
-
fs:
|
|
4579
|
-
vs:
|
|
4649
|
+
})), this.drawCommand || (this.drawCommand = new x(t, {
|
|
4650
|
+
fs: nt,
|
|
4651
|
+
vs: rt,
|
|
4580
4652
|
topology: "point-list",
|
|
4581
4653
|
vertexCount: s.pointsNumber ?? 0,
|
|
4582
4654
|
attributes: {
|
|
@@ -4618,7 +4690,7 @@ class yt extends w {
|
|
|
4618
4690
|
}
|
|
4619
4691
|
})), this.findPointsOnAreaSelectionVertexCoordBuffer || (this.findPointsOnAreaSelectionVertexCoordBuffer = t.createBuffer({
|
|
4620
4692
|
data: new Float32Array([-1, -1, 1, -1, -1, 1, 1, 1])
|
|
4621
|
-
})), this.findPointsOnAreaSelectionUniformStore || (this.findPointsOnAreaSelectionUniformStore = new
|
|
4693
|
+
})), this.findPointsOnAreaSelectionUniformStore || (this.findPointsOnAreaSelectionUniformStore = new R({
|
|
4622
4694
|
findPointsOnAreaSelectionUniforms: {
|
|
4623
4695
|
uniformTypes: {
|
|
4624
4696
|
// Order MUST match shader declaration order (std140 layout)
|
|
@@ -4633,19 +4705,19 @@ class yt extends w {
|
|
|
4633
4705
|
maxPointSize: "f32"
|
|
4634
4706
|
},
|
|
4635
4707
|
defaultUniforms: {
|
|
4636
|
-
sizeScale: i.pointSizeScale
|
|
4637
|
-
spaceSize: o.adjustedSpaceSize
|
|
4638
|
-
screenSize:
|
|
4639
|
-
ratio: i.pixelRatio
|
|
4708
|
+
sizeScale: i.pointSizeScale,
|
|
4709
|
+
spaceSize: o.adjustedSpaceSize,
|
|
4710
|
+
screenSize: _(o.screenSize, [0, 0]),
|
|
4711
|
+
ratio: i.pixelRatio,
|
|
4640
4712
|
transformationMatrix: o.transformationMatrix4x4,
|
|
4641
|
-
selection0:
|
|
4642
|
-
selection1:
|
|
4643
|
-
scalePointsOnZoom: i.scalePointsOnZoom
|
|
4644
|
-
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
|
|
4645
4717
|
}
|
|
4646
4718
|
}
|
|
4647
|
-
})), this.findPointsOnAreaSelectionCommand || (this.findPointsOnAreaSelectionCommand = new
|
|
4648
|
-
fs:
|
|
4719
|
+
})), this.findPointsOnAreaSelectionCommand || (this.findPointsOnAreaSelectionCommand = new x(t, {
|
|
4720
|
+
fs: at,
|
|
4649
4721
|
vs: D,
|
|
4650
4722
|
topology: "triangle-strip",
|
|
4651
4723
|
vertexCount: 4,
|
|
@@ -4666,7 +4738,7 @@ class yt extends w {
|
|
|
4666
4738
|
}
|
|
4667
4739
|
})), this.findPointsOnPolygonSelectionVertexCoordBuffer || (this.findPointsOnPolygonSelectionVertexCoordBuffer = t.createBuffer({
|
|
4668
4740
|
data: new Float32Array([-1, -1, 1, -1, -1, 1, 1, 1])
|
|
4669
|
-
})), this.findPointsOnPolygonSelectionUniformStore || (this.findPointsOnPolygonSelectionUniformStore = new
|
|
4741
|
+
})), this.findPointsOnPolygonSelectionUniformStore || (this.findPointsOnPolygonSelectionUniformStore = new R({
|
|
4670
4742
|
findPointsOnPolygonSelectionUniforms: {
|
|
4671
4743
|
uniformTypes: {
|
|
4672
4744
|
// Order MUST match shader declaration order (std140 layout)
|
|
@@ -4676,14 +4748,14 @@ class yt extends w {
|
|
|
4676
4748
|
polygonPathLength: "f32"
|
|
4677
4749
|
},
|
|
4678
4750
|
defaultUniforms: {
|
|
4679
|
-
spaceSize: o.adjustedSpaceSize
|
|
4680
|
-
screenSize:
|
|
4751
|
+
spaceSize: o.adjustedSpaceSize,
|
|
4752
|
+
screenSize: _(o.screenSize, [0, 0]),
|
|
4681
4753
|
transformationMatrix: o.transformationMatrix4x4,
|
|
4682
4754
|
polygonPathLength: this.polygonPathLength
|
|
4683
4755
|
}
|
|
4684
4756
|
}
|
|
4685
|
-
})), this.findPointsOnPolygonSelectionCommand || (this.findPointsOnPolygonSelectionCommand = new
|
|
4686
|
-
fs:
|
|
4757
|
+
})), this.findPointsOnPolygonSelectionCommand || (this.findPointsOnPolygonSelectionCommand = new x(t, {
|
|
4758
|
+
fs: dt,
|
|
4687
4759
|
vs: D,
|
|
4688
4760
|
topology: "triangle-strip",
|
|
4689
4761
|
vertexCount: 4,
|
|
@@ -4702,7 +4774,7 @@ class yt extends w {
|
|
|
4702
4774
|
findPointsOnPolygonSelectionUniforms: this.findPointsOnPolygonSelectionUniformStore.getManagedUniformBuffer(t, "findPointsOnPolygonSelectionUniforms")
|
|
4703
4775
|
// All texture bindings will be set dynamically in findPointsOnPolygonSelection() method
|
|
4704
4776
|
}
|
|
4705
|
-
})), this.findHoveredPointUniformStore || (this.findHoveredPointUniformStore = new
|
|
4777
|
+
})), this.findHoveredPointUniformStore || (this.findHoveredPointUniformStore = new R({
|
|
4706
4778
|
findHoveredPointUniforms: {
|
|
4707
4779
|
uniformTypes: {
|
|
4708
4780
|
// Order MUST match shader declaration order (std140 layout)
|
|
@@ -4720,30 +4792,32 @@ class yt extends w {
|
|
|
4720
4792
|
},
|
|
4721
4793
|
defaultUniforms: {
|
|
4722
4794
|
pointsTextureSize: o.pointsTextureSize ?? 0,
|
|
4723
|
-
sizeScale: i.pointSizeScale
|
|
4724
|
-
spaceSize: o.adjustedSpaceSize
|
|
4725
|
-
screenSize:
|
|
4726
|
-
ratio: i.pixelRatio
|
|
4795
|
+
sizeScale: i.pointSizeScale,
|
|
4796
|
+
spaceSize: o.adjustedSpaceSize,
|
|
4797
|
+
screenSize: _(o.screenSize, [0, 0]),
|
|
4798
|
+
ratio: i.pixelRatio,
|
|
4727
4799
|
transformationMatrix: o.transformationMatrix4x4,
|
|
4728
|
-
mousePosition:
|
|
4729
|
-
scalePointsOnZoom: i.scalePointsOnZoom
|
|
4730
|
-
maxPointSize: o.maxPointSize
|
|
4800
|
+
mousePosition: _(o.screenMousePosition, [0, 0]),
|
|
4801
|
+
scalePointsOnZoom: i.scalePointsOnZoom ? 1 : 0,
|
|
4802
|
+
maxPointSize: o.maxPointSize,
|
|
4731
4803
|
skipSelected: 0,
|
|
4732
4804
|
skipUnselected: 0
|
|
4733
4805
|
}
|
|
4734
4806
|
}
|
|
4735
|
-
})), this.findHoveredPointCommand || (this.findHoveredPointCommand = new
|
|
4736
|
-
fs:
|
|
4737
|
-
vs:
|
|
4807
|
+
})), this.findHoveredPointCommand || (this.findHoveredPointCommand = new x(t, {
|
|
4808
|
+
fs: ft,
|
|
4809
|
+
vs: ht,
|
|
4738
4810
|
topology: "point-list",
|
|
4739
4811
|
vertexCount: s.pointsNumber ?? 0,
|
|
4740
4812
|
attributes: {
|
|
4741
4813
|
...this.hoveredPointIndices && { pointIndices: this.hoveredPointIndices },
|
|
4742
|
-
...this.sizeBuffer && { size: this.sizeBuffer }
|
|
4814
|
+
...this.sizeBuffer && { size: this.sizeBuffer },
|
|
4815
|
+
...this.imageSizesBuffer && { imageSize: this.imageSizesBuffer }
|
|
4743
4816
|
},
|
|
4744
4817
|
bufferLayout: [
|
|
4745
4818
|
{ name: "pointIndices", format: "float32x2" },
|
|
4746
|
-
{ name: "size", format: "float32" }
|
|
4819
|
+
{ name: "size", format: "float32" },
|
|
4820
|
+
{ name: "imageSize", format: "float32" }
|
|
4747
4821
|
],
|
|
4748
4822
|
defines: {
|
|
4749
4823
|
USE_UNIFORM_BUFFERS: !0
|
|
@@ -4760,7 +4834,7 @@ class yt extends w {
|
|
|
4760
4834
|
blend: !1
|
|
4761
4835
|
// Disable blending - we want to overwrite, not blend
|
|
4762
4836
|
}
|
|
4763
|
-
})), this.fillSampledPointsUniformStore || (this.fillSampledPointsUniformStore = new
|
|
4837
|
+
})), this.fillSampledPointsUniformStore || (this.fillSampledPointsUniformStore = new R({
|
|
4764
4838
|
fillSampledPointsUniforms: {
|
|
4765
4839
|
uniformTypes: {
|
|
4766
4840
|
// Order MUST match shader declaration order (std140 layout)
|
|
@@ -4772,13 +4846,13 @@ class yt extends w {
|
|
|
4772
4846
|
defaultUniforms: {
|
|
4773
4847
|
pointsTextureSize: o.pointsTextureSize ?? 0,
|
|
4774
4848
|
transformationMatrix: o.transformationMatrix4x4,
|
|
4775
|
-
spaceSize: o.adjustedSpaceSize
|
|
4776
|
-
screenSize:
|
|
4849
|
+
spaceSize: o.adjustedSpaceSize,
|
|
4850
|
+
screenSize: _(o.screenSize, [0, 0])
|
|
4777
4851
|
}
|
|
4778
4852
|
}
|
|
4779
|
-
})), this.fillSampledPointsFboCommand || (this.fillSampledPointsFboCommand = new
|
|
4780
|
-
fs:
|
|
4781
|
-
vs:
|
|
4853
|
+
})), this.fillSampledPointsFboCommand || (this.fillSampledPointsFboCommand = new x(t, {
|
|
4854
|
+
fs: ut,
|
|
4855
|
+
vs: St,
|
|
4782
4856
|
topology: "point-list",
|
|
4783
4857
|
vertexCount: s.pointsNumber ?? 0,
|
|
4784
4858
|
attributes: {
|
|
@@ -4802,7 +4876,7 @@ class yt extends w {
|
|
|
4802
4876
|
}
|
|
4803
4877
|
})), this.drawHighlightedVertexCoordBuffer || (this.drawHighlightedVertexCoordBuffer = t.createBuffer({
|
|
4804
4878
|
data: new Float32Array([-1, -1, 1, -1, -1, 1, 1, 1])
|
|
4805
|
-
})), this.drawHighlightedUniformStore || (this.drawHighlightedUniformStore = new
|
|
4879
|
+
})), this.drawHighlightedUniformStore || (this.drawHighlightedUniformStore = new R({
|
|
4806
4880
|
drawHighlightedUniforms: {
|
|
4807
4881
|
uniformTypes: {
|
|
4808
4882
|
// Order MUST match shader declaration order (std140 layout)
|
|
@@ -4829,24 +4903,25 @@ class yt extends w {
|
|
|
4829
4903
|
size: 1,
|
|
4830
4904
|
transformationMatrix: o.transformationMatrix4x4,
|
|
4831
4905
|
pointsTextureSize: o.pointsTextureSize ?? 0,
|
|
4832
|
-
sizeScale: i.pointSizeScale
|
|
4833
|
-
spaceSize: o.adjustedSpaceSize
|
|
4834
|
-
screenSize:
|
|
4835
|
-
scalePointsOnZoom: i.scalePointsOnZoom
|
|
4906
|
+
sizeScale: i.pointSizeScale,
|
|
4907
|
+
spaceSize: o.adjustedSpaceSize,
|
|
4908
|
+
screenSize: _(o.screenSize, [0, 0]),
|
|
4909
|
+
scalePointsOnZoom: i.scalePointsOnZoom ? 1 : 0,
|
|
4836
4910
|
pointIndex: -1,
|
|
4837
|
-
maxPointSize: o.maxPointSize
|
|
4911
|
+
maxPointSize: o.maxPointSize,
|
|
4838
4912
|
color: [0, 0, 0, 1],
|
|
4839
|
-
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")
|
|
4840
4915
|
greyoutOpacity: i.pointGreyoutOpacity ?? -1,
|
|
4841
4916
|
isDarkenGreyout: o.isDarkenGreyout ?? !1 ? 1 : 0,
|
|
4842
|
-
backgroundColor:
|
|
4843
|
-
greyoutColor:
|
|
4917
|
+
backgroundColor: A(o.backgroundColor, [0, 0, 0, 1]),
|
|
4918
|
+
greyoutColor: A(o.greyoutPointColor, [0, 0, 0, 1]),
|
|
4844
4919
|
width: 0.85
|
|
4845
4920
|
}
|
|
4846
4921
|
}
|
|
4847
|
-
})), this.drawHighlightedCommand || (this.drawHighlightedCommand = new
|
|
4848
|
-
fs:
|
|
4849
|
-
vs:
|
|
4922
|
+
})), this.drawHighlightedCommand || (this.drawHighlightedCommand = new x(t, {
|
|
4923
|
+
fs: lt,
|
|
4924
|
+
vs: ct,
|
|
4850
4925
|
topology: "triangle-strip",
|
|
4851
4926
|
vertexCount: 4,
|
|
4852
4927
|
attributes: {
|
|
@@ -4877,7 +4952,7 @@ class yt extends w {
|
|
|
4877
4952
|
}
|
|
4878
4953
|
})), this.trackPointsVertexCoordBuffer || (this.trackPointsVertexCoordBuffer = t.createBuffer({
|
|
4879
4954
|
data: new Float32Array([-1, -1, 1, -1, -1, 1, 1, 1])
|
|
4880
|
-
})), this.trackPointsUniformStore || (this.trackPointsUniformStore = new
|
|
4955
|
+
})), this.trackPointsUniformStore || (this.trackPointsUniformStore = new R({
|
|
4881
4956
|
trackPointsUniforms: {
|
|
4882
4957
|
uniformTypes: {
|
|
4883
4958
|
// Order MUST match shader declaration order (std140 layout)
|
|
@@ -4887,8 +4962,8 @@ class yt extends w {
|
|
|
4887
4962
|
pointsTextureSize: o.pointsTextureSize ?? 0
|
|
4888
4963
|
}
|
|
4889
4964
|
}
|
|
4890
|
-
})), this.trackPointsCommand || (this.trackPointsCommand = new
|
|
4891
|
-
fs:
|
|
4965
|
+
})), this.trackPointsCommand || (this.trackPointsCommand = new x(t, {
|
|
4966
|
+
fs: _t,
|
|
4892
4967
|
vs: D,
|
|
4893
4968
|
topology: "triangle-strip",
|
|
4894
4969
|
vertexCount: 4,
|
|
@@ -4933,13 +5008,13 @@ class yt extends w {
|
|
|
4933
5008
|
format: "rgba32float"
|
|
4934
5009
|
}), this.greyoutStatusTexture.copyImageData({
|
|
4935
5010
|
data: s,
|
|
4936
|
-
bytesPerRow:
|
|
5011
|
+
bytesPerRow: T("rgba32float", o),
|
|
4937
5012
|
mipLevel: 0,
|
|
4938
5013
|
x: 0,
|
|
4939
5014
|
y: 0
|
|
4940
5015
|
})) : this.greyoutStatusTexture.copyImageData({
|
|
4941
5016
|
data: s,
|
|
4942
|
-
bytesPerRow:
|
|
5017
|
+
bytesPerRow: T("rgba32float", o),
|
|
4943
5018
|
mipLevel: 0,
|
|
4944
5019
|
x: 0,
|
|
4945
5020
|
y: 0
|
|
@@ -4958,19 +5033,20 @@ class yt extends w {
|
|
|
4958
5033
|
format: "rgba32float"
|
|
4959
5034
|
}), this.pinnedStatusTexture.copyImageData({
|
|
4960
5035
|
data: s,
|
|
4961
|
-
bytesPerRow:
|
|
5036
|
+
bytesPerRow: T("rgba32float", i),
|
|
4962
5037
|
mipLevel: 0,
|
|
4963
5038
|
x: 0,
|
|
4964
5039
|
y: 0
|
|
4965
5040
|
})) : this.pinnedStatusTexture.copyImageData({
|
|
4966
5041
|
data: s,
|
|
4967
|
-
bytesPerRow:
|
|
5042
|
+
bytesPerRow: T("rgba32float", i),
|
|
4968
5043
|
mipLevel: 0,
|
|
4969
5044
|
x: 0,
|
|
4970
5045
|
y: 0
|
|
4971
5046
|
});
|
|
4972
5047
|
}
|
|
4973
5048
|
updateSize() {
|
|
5049
|
+
var a;
|
|
4974
5050
|
const { device: t, store: { pointsTextureSize: i }, data: o } = this;
|
|
4975
5051
|
if (!i || o.pointsNumber === void 0 || o.pointSizes === void 0) return;
|
|
4976
5052
|
const s = o.pointSizes, n = s.byteLength;
|
|
@@ -4981,21 +5057,23 @@ class yt extends w {
|
|
|
4981
5057
|
size: this.sizeBuffer
|
|
4982
5058
|
});
|
|
4983
5059
|
const r = new Float32Array(i * i * 4);
|
|
4984
|
-
for (let
|
|
4985
|
-
|
|
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
|
+
}
|
|
4986
5064
|
!this.sizeTexture || this.sizeTexture.width !== i || this.sizeTexture.height !== i ? (this.sizeTexture && !this.sizeTexture.destroyed && this.sizeTexture.destroy(), this.sizeTexture = t.createTexture({
|
|
4987
5065
|
width: i,
|
|
4988
5066
|
height: i,
|
|
4989
5067
|
format: "rgba32float"
|
|
4990
5068
|
}), this.sizeTexture.copyImageData({
|
|
4991
5069
|
data: r,
|
|
4992
|
-
bytesPerRow:
|
|
5070
|
+
bytesPerRow: T("rgba32float", i),
|
|
4993
5071
|
mipLevel: 0,
|
|
4994
5072
|
x: 0,
|
|
4995
5073
|
y: 0
|
|
4996
5074
|
})) : this.sizeTexture.copyImageData({
|
|
4997
5075
|
data: r,
|
|
4998
|
-
bytesPerRow:
|
|
5076
|
+
bytesPerRow: T("rgba32float", i),
|
|
4999
5077
|
mipLevel: 0,
|
|
5000
5078
|
x: 0,
|
|
5001
5079
|
y: 0
|
|
@@ -5032,6 +5110,8 @@ class yt extends w {
|
|
|
5032
5110
|
usage: S.VERTEX | S.COPY_DST
|
|
5033
5111
|
})) : this.imageSizesBuffer.write(o), this.drawCommand && this.drawCommand.setAttributes({
|
|
5034
5112
|
imageSize: this.imageSizesBuffer
|
|
5113
|
+
}), this.findHoveredPointCommand && this.findHoveredPointCommand.setAttributes({
|
|
5114
|
+
imageSize: this.imageSizesBuffer
|
|
5035
5115
|
});
|
|
5036
5116
|
}
|
|
5037
5117
|
createAtlas() {
|
|
@@ -5051,7 +5131,7 @@ class yt extends w {
|
|
|
5051
5131
|
}));
|
|
5052
5132
|
return;
|
|
5053
5133
|
}
|
|
5054
|
-
const s =
|
|
5134
|
+
const s = gt(i.inputImageData, o.webglMaxTextureSize);
|
|
5055
5135
|
if (!s) {
|
|
5056
5136
|
console.warn("Failed to create atlas from image data");
|
|
5057
5137
|
return;
|
|
@@ -5064,7 +5144,7 @@ class yt extends w {
|
|
|
5064
5144
|
format: "rgba8unorm"
|
|
5065
5145
|
}), this.imageAtlasTexture.copyImageData({
|
|
5066
5146
|
data: n,
|
|
5067
|
-
bytesPerRow:
|
|
5147
|
+
bytesPerRow: T("rgba8unorm", r),
|
|
5068
5148
|
rowsPerImage: r,
|
|
5069
5149
|
mipLevel: 0,
|
|
5070
5150
|
x: 0,
|
|
@@ -5075,7 +5155,7 @@ class yt extends w {
|
|
|
5075
5155
|
format: "rgba32float"
|
|
5076
5156
|
}), this.imageAtlasCoordsTexture.copyImageData({
|
|
5077
5157
|
data: a,
|
|
5078
|
-
bytesPerRow:
|
|
5158
|
+
bytesPerRow: T("rgba32float", d),
|
|
5079
5159
|
rowsPerImage: d,
|
|
5080
5160
|
mipLevel: 0,
|
|
5081
5161
|
x: 0,
|
|
@@ -5085,7 +5165,7 @@ class yt extends w {
|
|
|
5085
5165
|
updateSampledPointsGrid() {
|
|
5086
5166
|
const { store: { screenSize: t }, config: { pointSamplingDistance: i }, device: o } = this;
|
|
5087
5167
|
let s = i ?? Math.min(...t) / 2;
|
|
5088
|
-
s === 0 && (s =
|
|
5168
|
+
s === 0 && (s = k.pointSamplingDistance);
|
|
5089
5169
|
const n = Math.ceil(t[0] / s), r = Math.ceil(t[1] / s);
|
|
5090
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({
|
|
5091
5171
|
width: n,
|
|
@@ -5110,23 +5190,23 @@ class yt extends w {
|
|
|
5110
5190
|
this.trackPointsCommand.draw(t), t.end();
|
|
5111
5191
|
}
|
|
5112
5192
|
draw(t) {
|
|
5113
|
-
var a, d;
|
|
5193
|
+
var a, d, l, c;
|
|
5114
5194
|
const { data: i, config: o, store: s } = this;
|
|
5115
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)
|
|
5116
5196
|
return;
|
|
5117
5197
|
this.drawCommand.setVertexCount(i.pointsNumber);
|
|
5118
5198
|
const n = {
|
|
5119
|
-
ratio: o.pixelRatio
|
|
5199
|
+
ratio: o.pixelRatio,
|
|
5120
5200
|
transformationMatrix: s.transformationMatrix4x4,
|
|
5121
5201
|
pointsTextureSize: s.pointsTextureSize ?? 0,
|
|
5122
|
-
sizeScale: o.pointSizeScale
|
|
5123
|
-
spaceSize: s.adjustedSpaceSize
|
|
5124
|
-
screenSize:
|
|
5125
|
-
greyoutColor:
|
|
5126
|
-
backgroundColor:
|
|
5127
|
-
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,
|
|
5128
5208
|
// Convert boolean to float
|
|
5129
|
-
maxPointSize: s.maxPointSize
|
|
5209
|
+
maxPointSize: s.maxPointSize,
|
|
5130
5210
|
isDarkenGreyout: s.isDarkenGreyout ?? !1 ? 1 : 0,
|
|
5131
5211
|
// Convert boolean to float
|
|
5132
5212
|
hasImages: this.imageCount > 0 ? 1 : 0,
|
|
@@ -5134,11 +5214,12 @@ class yt extends w {
|
|
|
5134
5214
|
imageCount: this.imageCount,
|
|
5135
5215
|
imageAtlasCoordsTextureSize: this.imageAtlasCoordsTextureSize ?? 0
|
|
5136
5216
|
}, r = {
|
|
5217
|
+
// -1 is a sentinel value for the shader: when greyoutOpacity is -1, the shader skips opacity override (i.e. "not set")
|
|
5137
5218
|
greyoutOpacity: o.pointGreyoutOpacity ?? -1,
|
|
5138
|
-
pointOpacity: o.pointOpacity
|
|
5219
|
+
pointOpacity: o.pointOpacity,
|
|
5139
5220
|
isDarkenGreyout: s.isDarkenGreyout ?? !1 ? 1 : 0,
|
|
5140
5221
|
// Convert boolean to float
|
|
5141
|
-
backgroundColor:
|
|
5222
|
+
backgroundColor: A(s.backgroundColor, [0, 0, 0, 1])
|
|
5142
5223
|
};
|
|
5143
5224
|
if (s.selectedIndices && s.selectedIndices.length > 0 ? (this.drawUniformStore.setUniforms({
|
|
5144
5225
|
drawVertexUniforms: {
|
|
@@ -5184,24 +5265,25 @@ class yt extends w {
|
|
|
5184
5265
|
imageAtlasCoords: this.imageAtlasCoordsTexture
|
|
5185
5266
|
}), this.drawCommand.draw(t)), o.renderHoveredPointRing && s.hoveredPoint && this.drawHighlightedCommand && this.drawHighlightedUniformStore) {
|
|
5186
5267
|
if (!this.currentPositionTexture || this.currentPositionTexture.destroyed || !this.greyoutStatusTexture || this.greyoutStatusTexture.destroyed) return;
|
|
5187
|
-
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;
|
|
5188
5269
|
this.drawHighlightedUniformStore.setUniforms({
|
|
5189
5270
|
drawHighlightedUniforms: {
|
|
5190
|
-
size:
|
|
5271
|
+
size: Math.max(f, u),
|
|
5191
5272
|
transformationMatrix: s.transformationMatrix4x4,
|
|
5192
5273
|
pointsTextureSize: s.pointsTextureSize ?? 0,
|
|
5193
|
-
sizeScale: o.pointSizeScale
|
|
5194
|
-
spaceSize: s.adjustedSpaceSize
|
|
5195
|
-
screenSize:
|
|
5196
|
-
scalePointsOnZoom: o.scalePointsOnZoom
|
|
5274
|
+
sizeScale: o.pointSizeScale,
|
|
5275
|
+
spaceSize: s.adjustedSpaceSize,
|
|
5276
|
+
screenSize: _(s.screenSize, [0, 0]),
|
|
5277
|
+
scalePointsOnZoom: o.scalePointsOnZoom ? 1 : 0,
|
|
5197
5278
|
pointIndex: s.hoveredPoint.index,
|
|
5198
|
-
maxPointSize: s.maxPointSize
|
|
5199
|
-
color:
|
|
5200
|
-
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")
|
|
5201
5283
|
greyoutOpacity: o.pointGreyoutOpacity ?? -1,
|
|
5202
5284
|
isDarkenGreyout: s.isDarkenGreyout ?? !1 ? 1 : 0,
|
|
5203
|
-
backgroundColor:
|
|
5204
|
-
greyoutColor:
|
|
5285
|
+
backgroundColor: A(s.backgroundColor, [0, 0, 0, 1]),
|
|
5286
|
+
greyoutColor: A(s.greyoutPointColor, [0, 0, 0, 1]),
|
|
5205
5287
|
width: 0.85
|
|
5206
5288
|
}
|
|
5207
5289
|
}), this.drawHighlightedCommand.setBindings({
|
|
@@ -5211,24 +5293,25 @@ class yt extends w {
|
|
|
5211
5293
|
}
|
|
5212
5294
|
if (s.focusedPoint && this.drawHighlightedCommand && this.drawHighlightedUniformStore) {
|
|
5213
5295
|
if (!this.currentPositionTexture || this.currentPositionTexture.destroyed || !this.greyoutStatusTexture || this.greyoutStatusTexture.destroyed) return;
|
|
5214
|
-
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;
|
|
5215
5297
|
this.drawHighlightedUniformStore.setUniforms({
|
|
5216
5298
|
drawHighlightedUniforms: {
|
|
5217
|
-
size:
|
|
5299
|
+
size: Math.max(f, u),
|
|
5218
5300
|
transformationMatrix: s.transformationMatrix4x4,
|
|
5219
5301
|
pointsTextureSize: s.pointsTextureSize ?? 0,
|
|
5220
|
-
sizeScale: o.pointSizeScale
|
|
5221
|
-
spaceSize: s.adjustedSpaceSize
|
|
5222
|
-
screenSize:
|
|
5223
|
-
scalePointsOnZoom: o.scalePointsOnZoom
|
|
5302
|
+
sizeScale: o.pointSizeScale,
|
|
5303
|
+
spaceSize: s.adjustedSpaceSize,
|
|
5304
|
+
screenSize: _(s.screenSize, [0, 0]),
|
|
5305
|
+
scalePointsOnZoom: o.scalePointsOnZoom ? 1 : 0,
|
|
5224
5306
|
pointIndex: s.focusedPoint.index,
|
|
5225
|
-
maxPointSize: s.maxPointSize
|
|
5226
|
-
color:
|
|
5227
|
-
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")
|
|
5228
5311
|
greyoutOpacity: o.pointGreyoutOpacity ?? -1,
|
|
5229
5312
|
isDarkenGreyout: s.isDarkenGreyout ?? !1 ? 1 : 0,
|
|
5230
|
-
backgroundColor:
|
|
5231
|
-
greyoutColor:
|
|
5313
|
+
backgroundColor: A(s.backgroundColor, [0, 0, 0, 1]),
|
|
5314
|
+
greyoutColor: A(s.greyoutPointColor, [0, 0, 0, 1]),
|
|
5232
5315
|
width: 0.85
|
|
5233
5316
|
}
|
|
5234
5317
|
}), this.drawHighlightedCommand.setBindings({
|
|
@@ -5241,8 +5324,8 @@ class yt extends w {
|
|
|
5241
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;
|
|
5242
5325
|
this.updatePositionUniformStore.setUniforms({
|
|
5243
5326
|
updatePositionUniforms: {
|
|
5244
|
-
friction: this.config.simulationFriction
|
|
5245
|
-
spaceSize: this.store.adjustedSpaceSize
|
|
5327
|
+
friction: this.config.simulationFriction,
|
|
5328
|
+
spaceSize: this.store.adjustedSpaceSize
|
|
5246
5329
|
}
|
|
5247
5330
|
}), this.updatePositionCommand.setBindings({
|
|
5248
5331
|
positionsTexture: this.previousPositionTexture,
|
|
@@ -5259,7 +5342,7 @@ class yt extends w {
|
|
|
5259
5342
|
if (!this.dragPointCommand || !this.dragPointUniformStore || !this.currentPositionFbo || this.currentPositionFbo.destroyed || !this.previousPositionTexture || this.previousPositionTexture.destroyed) return;
|
|
5260
5343
|
this.dragPointUniformStore.setUniforms({
|
|
5261
5344
|
dragPointUniforms: {
|
|
5262
|
-
mousePos:
|
|
5345
|
+
mousePos: _(this.store.mousePosition, [0, 0]),
|
|
5263
5346
|
index: ((i = this.store.hoveredPoint) == null ? void 0 : i.index) ?? -1
|
|
5264
5347
|
}
|
|
5265
5348
|
}), this.dragPointCommand.setBindings({
|
|
@@ -5275,16 +5358,16 @@ class yt extends w {
|
|
|
5275
5358
|
if (!this.findPointsOnAreaSelectionCommand || !this.findPointsOnAreaSelectionUniformStore || !this.selectedFbo || this.selectedFbo.destroyed || !this.currentPositionTexture || this.currentPositionTexture.destroyed || !this.sizeTexture || this.sizeTexture.destroyed) return;
|
|
5276
5359
|
this.findPointsOnAreaSelectionUniformStore.setUniforms({
|
|
5277
5360
|
findPointsOnAreaSelectionUniforms: {
|
|
5278
|
-
spaceSize: this.store.adjustedSpaceSize
|
|
5279
|
-
screenSize:
|
|
5280
|
-
sizeScale: this.config.pointSizeScale
|
|
5361
|
+
spaceSize: this.store.adjustedSpaceSize,
|
|
5362
|
+
screenSize: _(this.store.screenSize, [0, 0]),
|
|
5363
|
+
sizeScale: this.config.pointSizeScale,
|
|
5281
5364
|
transformationMatrix: this.store.transformationMatrix4x4,
|
|
5282
|
-
ratio: this.config.pixelRatio
|
|
5283
|
-
selection0:
|
|
5284
|
-
selection1:
|
|
5285
|
-
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,
|
|
5286
5369
|
// Convert boolean to number
|
|
5287
|
-
maxPointSize: this.store.maxPointSize
|
|
5370
|
+
maxPointSize: this.store.maxPointSize
|
|
5288
5371
|
}
|
|
5289
5372
|
}), this.findPointsOnAreaSelectionCommand.setBindings({
|
|
5290
5373
|
positionsTexture: this.currentPositionTexture,
|
|
@@ -5299,8 +5382,8 @@ class yt extends w {
|
|
|
5299
5382
|
if (!this.findPointsOnPolygonSelectionCommand || !this.findPointsOnPolygonSelectionUniformStore || !this.selectedFbo || this.selectedFbo.destroyed || !this.currentPositionTexture || this.currentPositionTexture.destroyed || !this.polygonPathTexture || this.polygonPathTexture.destroyed) return;
|
|
5300
5383
|
this.findPointsOnPolygonSelectionUniformStore.setUniforms({
|
|
5301
5384
|
findPointsOnPolygonSelectionUniforms: {
|
|
5302
|
-
spaceSize: this.store.adjustedSpaceSize
|
|
5303
|
-
screenSize:
|
|
5385
|
+
spaceSize: this.store.adjustedSpaceSize,
|
|
5386
|
+
screenSize: _(this.store.screenSize, [0, 0]),
|
|
5304
5387
|
transformationMatrix: this.store.transformationMatrix4x4,
|
|
5305
5388
|
polygonPathLength: this.polygonPathLength
|
|
5306
5389
|
}
|
|
@@ -5330,13 +5413,13 @@ class yt extends w {
|
|
|
5330
5413
|
format: "rgba32float"
|
|
5331
5414
|
}), this.polygonPathTexture.copyImageData({
|
|
5332
5415
|
data: s,
|
|
5333
|
-
bytesPerRow:
|
|
5416
|
+
bytesPerRow: T("rgba32float", o),
|
|
5334
5417
|
mipLevel: 0,
|
|
5335
5418
|
x: 0,
|
|
5336
5419
|
y: 0
|
|
5337
5420
|
})) : this.polygonPathTexture.copyImageData({
|
|
5338
5421
|
data: s,
|
|
5339
|
-
bytesPerRow:
|
|
5422
|
+
bytesPerRow: T("rgba32float", o),
|
|
5340
5423
|
mipLevel: 0,
|
|
5341
5424
|
x: 0,
|
|
5342
5425
|
y: 0
|
|
@@ -5346,18 +5429,19 @@ class yt extends w {
|
|
|
5346
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;
|
|
5347
5430
|
this.findHoveredPointCommand.setVertexCount(this.data.pointsNumber ?? 0), this.findHoveredPointCommand.setAttributes({
|
|
5348
5431
|
...this.hoveredPointIndices && { pointIndices: this.hoveredPointIndices },
|
|
5349
|
-
...this.sizeBuffer && { size: this.sizeBuffer }
|
|
5432
|
+
...this.sizeBuffer && { size: this.sizeBuffer },
|
|
5433
|
+
...this.imageSizesBuffer && { imageSize: this.imageSizesBuffer }
|
|
5350
5434
|
});
|
|
5351
5435
|
const t = {
|
|
5352
|
-
ratio: this.config.pixelRatio
|
|
5353
|
-
sizeScale: this.config.pointSizeScale
|
|
5436
|
+
ratio: this.config.pixelRatio,
|
|
5437
|
+
sizeScale: this.config.pointSizeScale,
|
|
5354
5438
|
pointsTextureSize: this.store.pointsTextureSize ?? 0,
|
|
5355
5439
|
transformationMatrix: this.store.transformationMatrix4x4,
|
|
5356
|
-
spaceSize: this.store.adjustedSpaceSize
|
|
5357
|
-
screenSize:
|
|
5358
|
-
scalePointsOnZoom: this.config.scalePointsOnZoom
|
|
5359
|
-
mousePosition:
|
|
5360
|
-
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
|
|
5361
5445
|
}, i = {
|
|
5362
5446
|
positionsTexture: this.currentPositionTexture,
|
|
5363
5447
|
pointGreyoutStatus: this.greyoutStatusTexture
|
|
@@ -5397,13 +5481,13 @@ class yt extends w {
|
|
|
5397
5481
|
format: "rgba32float"
|
|
5398
5482
|
}), this.trackedIndicesTexture.copyImageData({
|
|
5399
5483
|
data: n,
|
|
5400
|
-
bytesPerRow:
|
|
5484
|
+
bytesPerRow: T("rgba32float", s),
|
|
5401
5485
|
mipLevel: 0,
|
|
5402
5486
|
x: 0,
|
|
5403
5487
|
y: 0
|
|
5404
5488
|
})) : this.trackedIndicesTexture.copyImageData({
|
|
5405
5489
|
data: n,
|
|
5406
|
-
bytesPerRow:
|
|
5490
|
+
bytesPerRow: T("rgba32float", s),
|
|
5407
5491
|
mipLevel: 0,
|
|
5408
5492
|
x: 0,
|
|
5409
5493
|
y: 0
|
|
@@ -5427,7 +5511,7 @@ class yt extends w {
|
|
|
5427
5511
|
if ((!t || !i) && this.isPositionsUpToDate && this.trackedPositions)
|
|
5428
5512
|
return this.trackedPositions;
|
|
5429
5513
|
if (!this.trackedPositionsFbo || this.trackedPositionsFbo.destroyed) return /* @__PURE__ */ new Map();
|
|
5430
|
-
const o =
|
|
5514
|
+
const o = I(this.device, this.trackedPositionsFbo), s = /* @__PURE__ */ new Map();
|
|
5431
5515
|
for (let n = 0; n < o.length / 4; n += 1) {
|
|
5432
5516
|
const r = o[n * 4], a = o[n * 4 + 1], d = this.trackedIndices[n];
|
|
5433
5517
|
r !== void 0 && a !== void 0 && d !== void 0 && s.set(d, [r, a]);
|
|
@@ -5443,8 +5527,8 @@ class yt extends w {
|
|
|
5443
5527
|
fillSampledPointsUniforms: {
|
|
5444
5528
|
pointsTextureSize: this.store.pointsTextureSize ?? 0,
|
|
5445
5529
|
transformationMatrix: this.store.transformationMatrix4x4,
|
|
5446
|
-
spaceSize: this.store.adjustedSpaceSize
|
|
5447
|
-
screenSize:
|
|
5530
|
+
spaceSize: this.store.adjustedSpaceSize,
|
|
5531
|
+
screenSize: _(this.store.screenSize, [0, 0])
|
|
5448
5532
|
}
|
|
5449
5533
|
}), this.fillSampledPointsFboCommand.setBindings({
|
|
5450
5534
|
positionsTexture: this.currentPositionTexture
|
|
@@ -5455,7 +5539,7 @@ class yt extends w {
|
|
|
5455
5539
|
});
|
|
5456
5540
|
this.fillSampledPointsFboCommand.draw(o), o.end();
|
|
5457
5541
|
}
|
|
5458
|
-
const i =
|
|
5542
|
+
const i = I(this.device, this.sampledPointsFbo);
|
|
5459
5543
|
for (let o = 0; o < i.length / 4; o++) {
|
|
5460
5544
|
const s = i[o * 4], n = !!i[o * 4 + 1], r = i[o * 4 + 2], a = i[o * 4 + 3];
|
|
5461
5545
|
n && s !== void 0 && r !== void 0 && a !== void 0 && t.set(s, [r, a]);
|
|
@@ -5471,8 +5555,8 @@ class yt extends w {
|
|
|
5471
5555
|
fillSampledPointsUniforms: {
|
|
5472
5556
|
pointsTextureSize: this.store.pointsTextureSize ?? 0,
|
|
5473
5557
|
transformationMatrix: this.store.transformationMatrix4x4,
|
|
5474
|
-
spaceSize: this.store.adjustedSpaceSize
|
|
5475
|
-
screenSize:
|
|
5558
|
+
spaceSize: this.store.adjustedSpaceSize,
|
|
5559
|
+
screenSize: _(this.store.screenSize, [0, 0])
|
|
5476
5560
|
}
|
|
5477
5561
|
}), this.fillSampledPointsFboCommand.setBindings({
|
|
5478
5562
|
positionsTexture: this.currentPositionTexture
|
|
@@ -5483,7 +5567,7 @@ class yt extends w {
|
|
|
5483
5567
|
});
|
|
5484
5568
|
this.fillSampledPointsFboCommand.draw(s), s.end();
|
|
5485
5569
|
}
|
|
5486
|
-
const o =
|
|
5570
|
+
const o = I(this.device, this.sampledPointsFbo);
|
|
5487
5571
|
for (let s = 0; s < o.length / 4; s++) {
|
|
5488
5572
|
const n = o[s * 4], r = !!o[s * 4 + 1], a = o[s * 4 + 2], d = o[s * 4 + 3];
|
|
5489
5573
|
r && n !== void 0 && a !== void 0 && d !== void 0 && (t.push(n), i.push(a, d));
|
|
@@ -5494,7 +5578,7 @@ class yt extends w {
|
|
|
5494
5578
|
const t = [];
|
|
5495
5579
|
if (!this.trackedIndices || !this.trackedPositionsFbo || this.trackedPositionsFbo.destroyed) return t;
|
|
5496
5580
|
t.length = this.trackedIndices.length * 2;
|
|
5497
|
-
const i =
|
|
5581
|
+
const i = I(this.device, this.trackedPositionsFbo);
|
|
5498
5582
|
for (let o = 0; o < i.length / 4; o += 1) {
|
|
5499
5583
|
const s = i[o * 4], n = i[o * 4 + 1], r = this.trackedIndices[o];
|
|
5500
5584
|
s !== void 0 && n !== void 0 && r !== void 0 && (t[o * 2] = s, t[o * 2 + 1] = n);
|
|
@@ -5506,56 +5590,56 @@ class yt extends w {
|
|
|
5506
5590
|
* Models -> Framebuffers -> Textures -> UniformStores -> Buffers
|
|
5507
5591
|
* */
|
|
5508
5592
|
destroy() {
|
|
5509
|
-
var t, i, o, s, n, r, a, d, l, c,
|
|
5510
|
-
(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, (
|
|
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;
|
|
5511
5595
|
}
|
|
5512
5596
|
swapFbo() {
|
|
5513
5597
|
if (!this.currentPositionTexture || this.currentPositionTexture.destroyed || !this.previousPositionTexture || this.previousPositionTexture.destroyed || !this.currentPositionFbo || this.currentPositionFbo.destroyed || !this.previousPositionFbo || this.previousPositionFbo.destroyed)
|
|
5514
5598
|
return;
|
|
5515
5599
|
const t = this.previousPositionTexture, i = this.previousPositionFbo;
|
|
5516
|
-
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;
|
|
5517
5601
|
}
|
|
5518
5602
|
rescaleInitialNodePositions() {
|
|
5519
5603
|
const { config: { spaceSize: t } } = this;
|
|
5520
5604
|
if (!this.data.pointPositions || !t) return;
|
|
5521
5605
|
const i = this.data.pointPositions, o = i.length / 2;
|
|
5522
5606
|
let s = 1 / 0, n = -1 / 0, r = 1 / 0, a = -1 / 0;
|
|
5523
|
-
for (let
|
|
5524
|
-
const
|
|
5525
|
-
s = Math.min(s,
|
|
5607
|
+
for (let C = 0; C < i.length; C += 2) {
|
|
5608
|
+
const v = i[C], y = i[C + 1];
|
|
5609
|
+
s = Math.min(s, v), n = Math.max(n, v), r = Math.min(r, y), a = Math.max(a, y);
|
|
5526
5610
|
}
|
|
5527
5611
|
const d = n - s, l = a - r, c = Math.max(d, l);
|
|
5528
5612
|
if (c > t) {
|
|
5529
5613
|
this.scaleX = void 0, this.scaleY = void 0;
|
|
5530
5614
|
return;
|
|
5531
5615
|
}
|
|
5532
|
-
const
|
|
5533
|
-
this.scaleX = (
|
|
5534
|
-
for (let
|
|
5535
|
-
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]);
|
|
5536
5620
|
}
|
|
5537
5621
|
}
|
|
5538
|
-
class
|
|
5622
|
+
class Pt {
|
|
5539
5623
|
constructor(t, i) {
|
|
5540
|
-
this.eventTransform = W, this.behavior =
|
|
5624
|
+
this.eventTransform = W, this.behavior = Te().scaleExtent([1e-3, 1 / 0]).on("start", (o) => {
|
|
5541
5625
|
var n, r;
|
|
5542
5626
|
this.isRunning = !0;
|
|
5543
5627
|
const s = !!o.sourceEvent;
|
|
5544
|
-
(r = (n = this.config)
|
|
5628
|
+
s && (this.shouldEnableSimulationDuringZoomOverride = void 0), (r = (n = this.config).onZoomStart) == null || r.call(n, o, s);
|
|
5545
5629
|
}).on("zoom", (o) => {
|
|
5546
|
-
var
|
|
5630
|
+
var u, h;
|
|
5547
5631
|
this.eventTransform = o.transform;
|
|
5548
5632
|
const { eventTransform: { x: s, y: n, k: r }, store: { transform: a, screenSize: d } } = this, l = d[0], c = d[1];
|
|
5549
5633
|
if (!l || !c) return;
|
|
5550
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]);
|
|
5551
|
-
const
|
|
5552
|
-
(
|
|
5635
|
+
const f = !!o.sourceEvent;
|
|
5636
|
+
(h = (u = this.config).onZoom) == null || h.call(u, o, f);
|
|
5553
5637
|
}).on("end", (o) => {
|
|
5554
5638
|
var n, r;
|
|
5555
5639
|
this.isRunning = !1;
|
|
5556
5640
|
const s = !!o.sourceEvent;
|
|
5557
|
-
(r = (n = this.config)
|
|
5558
|
-
}), 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;
|
|
5559
5643
|
}
|
|
5560
5644
|
/**
|
|
5561
5645
|
* Returns the zoom transform that fits the given point positions into the viewport.
|
|
@@ -5569,22 +5653,22 @@ class Ft {
|
|
|
5569
5653
|
if (t.length === 0) return this.eventTransform;
|
|
5570
5654
|
const { store: { screenSize: s } } = this, n = s[0], r = s[1];
|
|
5571
5655
|
let a = 1 / 0, d = -1 / 0, l = 1 / 0, c = -1 / 0;
|
|
5572
|
-
for (let
|
|
5573
|
-
const
|
|
5574
|
-
|
|
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);
|
|
5575
5659
|
}
|
|
5576
|
-
const
|
|
5577
|
-
|
|
5578
|
-
const
|
|
5579
|
-
return W.translate(
|
|
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;
|
|
5663
|
+
return W.translate(v, y).scale(P);
|
|
5580
5664
|
}
|
|
5581
5665
|
getDistanceToPoint(t) {
|
|
5582
5666
|
const { x: i, y: o, k: s } = this.eventTransform, n = this.getTransform(t, s), r = i - n.x, a = o - n.y;
|
|
5583
5667
|
return Math.sqrt(r * r + a * a);
|
|
5584
5668
|
}
|
|
5585
5669
|
getMiddlePointTransform(t) {
|
|
5586
|
-
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]),
|
|
5587
|
-
return W.translate(
|
|
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);
|
|
5588
5672
|
}
|
|
5589
5673
|
convertScreenToSpacePosition(t) {
|
|
5590
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];
|
|
@@ -5600,23 +5684,28 @@ class Ft {
|
|
|
5600
5684
|
return i ? n *= s : n *= Math.min(5, Math.max(1, s * 0.01)), Math.min(n, o) / 2;
|
|
5601
5685
|
}
|
|
5602
5686
|
}
|
|
5603
|
-
class
|
|
5687
|
+
class Rt {
|
|
5604
5688
|
constructor(t, i) {
|
|
5605
|
-
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) => {
|
|
5606
5690
|
var s, n;
|
|
5607
|
-
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));
|
|
5608
5692
|
}).on("drag", (o) => {
|
|
5609
5693
|
var s, n;
|
|
5610
|
-
(n = (s = this.config)
|
|
5694
|
+
(n = (s = this.config).onDrag) == null || n.call(s, o);
|
|
5611
5695
|
}).on("end", (o) => {
|
|
5612
5696
|
var s, n;
|
|
5613
|
-
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);
|
|
5614
5698
|
}), this.store = t, this.config = i;
|
|
5615
5699
|
}
|
|
5616
5700
|
}
|
|
5617
|
-
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
|
+
*/
|
|
5618
5707
|
constructor(t, i, o) {
|
|
5619
|
-
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)
|
|
5620
5709
|
this.deviceInitPromise = o, this.shouldDestroyDevice = !1;
|
|
5621
5710
|
else {
|
|
5622
5711
|
const n = document.createElement("canvas");
|
|
@@ -5653,7 +5742,7 @@ class Lt {
|
|
|
5653
5742
|
this.dragInstance.isActive && this.updateMousePosition(c), this.currentEvent = c;
|
|
5654
5743
|
}).on("end.detect", (c) => {
|
|
5655
5744
|
this.currentEvent = c, this.updateCanvasCursor();
|
|
5656
|
-
}), 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 =
|
|
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;
|
|
5657
5746
|
}).catch((n) => {
|
|
5658
5747
|
throw this.device = void 0, this.isReady = !1, console.error("Device initialization failed:", n), n;
|
|
5659
5748
|
});
|
|
@@ -5680,14 +5769,31 @@ class Lt {
|
|
|
5680
5769
|
return this._isDestroyed ? 0 : this.store.maxPointSize;
|
|
5681
5770
|
}
|
|
5682
5771
|
/**
|
|
5683
|
-
*
|
|
5684
|
-
*
|
|
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.
|
|
5685
5779
|
*/
|
|
5686
5780
|
setConfig(t) {
|
|
5687
|
-
var o, s, n, r, a, d, l, c, h;
|
|
5688
5781
|
if (this._isDestroyed || this.ensureDevice(() => this.setConfig(t))) return;
|
|
5689
5782
|
const i = { ...this.config };
|
|
5690
|
-
|
|
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);
|
|
5691
5797
|
}
|
|
5692
5798
|
/**
|
|
5693
5799
|
* Sets the positions for the graph points.
|
|
@@ -5707,7 +5813,7 @@ class Lt {
|
|
|
5707
5813
|
*
|
|
5708
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],
|
|
5709
5815
|
* where each color is represented in RGBA format.
|
|
5710
|
-
* 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.
|
|
5711
5817
|
*/
|
|
5712
5818
|
setPointColors(t) {
|
|
5713
5819
|
this._isDestroyed || this.ensureDevice(() => this.setPointColors(t)) || (this.graph.inputPointColors = t, this.isPointColorUpdateNeeded = !0);
|
|
@@ -5801,7 +5907,7 @@ class Lt {
|
|
|
5801
5907
|
*
|
|
5802
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],
|
|
5803
5909
|
* where each color is in RGBA format.
|
|
5804
|
-
* 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.
|
|
5805
5911
|
*/
|
|
5806
5912
|
setLinkColors(t) {
|
|
5807
5913
|
this._isDestroyed || this.ensureDevice(() => this.setLinkColors(t)) || (this.graph.inputLinkColors = t, this.isLinkColorUpdateNeeded = !0);
|
|
@@ -5943,7 +6049,7 @@ class Lt {
|
|
|
5943
6049
|
void 0,
|
|
5944
6050
|
s
|
|
5945
6051
|
) : this.fitView(n, s);
|
|
5946
|
-
}, o)), this.update(t), this.startFrames(), this._isFirstRenderAfterInit = !1;
|
|
6052
|
+
}, o)), this.update(t), this._shouldForceHoverDetection = !0, this.startFrames(), this._isFirstRenderAfterInit = !1;
|
|
5947
6053
|
}
|
|
5948
6054
|
/**
|
|
5949
6055
|
* Center the view on a point and zoom in, by point index.
|
|
@@ -5951,36 +6057,40 @@ class Lt {
|
|
|
5951
6057
|
* @param duration Duration of the animation transition in milliseconds (`700` by default).
|
|
5952
6058
|
* @param scale Scale value to zoom in or out (`3` by default).
|
|
5953
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).
|
|
5954
6061
|
*/
|
|
5955
|
-
zoomToPointByIndex(t, i = 700, o =
|
|
5956
|
-
if (this._isDestroyed || this.ensureDevice(() => this.zoomToPointByIndex(t, i, o, s)) || !this.device || !this.points || !this.canvasD3Selection) return;
|
|
5957
|
-
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);
|
|
5958
6065
|
if (t === void 0) return;
|
|
5959
|
-
const
|
|
5960
|
-
if (
|
|
5961
|
-
const
|
|
5962
|
-
if (
|
|
5963
|
-
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);
|
|
5964
6071
|
else {
|
|
5965
|
-
|
|
5966
|
-
|
|
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);
|
|
5967
6075
|
}
|
|
5968
6076
|
}
|
|
5969
6077
|
/**
|
|
5970
6078
|
* Zoom the view in or out to the specified zoom level.
|
|
5971
6079
|
* @param value Zoom level
|
|
5972
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).
|
|
5973
6082
|
*/
|
|
5974
|
-
zoom(t, i = 0) {
|
|
5975
|
-
this._isDestroyed || this.setZoomLevel(t, i);
|
|
6083
|
+
zoom(t, i = 0, o = !0) {
|
|
6084
|
+
this._isDestroyed || this.setZoomLevel(t, i, o);
|
|
5976
6085
|
}
|
|
5977
6086
|
/**
|
|
5978
6087
|
* Zoom the view in or out to the specified zoom level.
|
|
5979
6088
|
* @param value Zoom level
|
|
5980
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).
|
|
5981
6091
|
*/
|
|
5982
|
-
setZoomLevel(t, i = 0) {
|
|
5983
|
-
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));
|
|
5984
6094
|
}
|
|
5985
6095
|
/**
|
|
5986
6096
|
* Get zoom level.
|
|
@@ -5996,7 +6106,7 @@ class Lt {
|
|
|
5996
6106
|
getPointPositions() {
|
|
5997
6107
|
if (this._isDestroyed || !this.device || !this.points) return [];
|
|
5998
6108
|
if (this.graph.pointsNumber === void 0) return [];
|
|
5999
|
-
const t = [], i =
|
|
6109
|
+
const t = [], i = I(this.device, this.points.currentPositionFbo);
|
|
6000
6110
|
t.length = this.graph.pointsNumber * 2;
|
|
6001
6111
|
for (let o = 0; o < this.graph.pointsNumber; o += 1) {
|
|
6002
6112
|
const s = i[o * 4 + 0], n = i[o * 4 + 1];
|
|
@@ -6006,49 +6116,43 @@ class Lt {
|
|
|
6006
6116
|
}
|
|
6007
6117
|
/**
|
|
6008
6118
|
* Get current X and Y coordinates of the clusters.
|
|
6009
|
-
* @returns Array of
|
|
6119
|
+
* @returns Array of cluster positions in `[x0, y0, x1, y1, ...]` order. Do not mutate the returned array.
|
|
6010
6120
|
*/
|
|
6011
6121
|
getClusterPositions() {
|
|
6012
|
-
|
|
6013
|
-
if (this.graph.pointClusters === void 0 || this.clusters.clusterCount === void 0) return [];
|
|
6014
|
-
this.clusters.calculateCentermass();
|
|
6015
|
-
const t = [], i = y(this.device, this.clusters.centermassFbo);
|
|
6016
|
-
t.length = this.clusters.clusterCount * 2;
|
|
6017
|
-
for (let o = 0; o < t.length / 2; o += 1) {
|
|
6018
|
-
const s = i[o * 4 + 0], n = i[o * 4 + 1], r = i[o * 4 + 2];
|
|
6019
|
-
s !== void 0 && n !== void 0 && r !== void 0 && (t[o * 2] = s / r, t[o * 2 + 1] = n / r);
|
|
6020
|
-
}
|
|
6021
|
-
return t;
|
|
6122
|
+
return this._isDestroyed || !this.device || !this.clusters ? [] : this.graph.pointClusters === void 0 || this.clusters.clusterCount === void 0 ? [] : this.clusters.getCentroidPositions();
|
|
6022
6123
|
}
|
|
6023
6124
|
/**
|
|
6024
6125
|
* Center and zoom in/out the view to fit all points in the scene.
|
|
6025
6126
|
* @param duration Duration of the center and zoom in/out animation in milliseconds (`250` by default).
|
|
6026
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).
|
|
6027
6129
|
*/
|
|
6028
|
-
fitView(t = 250, i = 0.1) {
|
|
6029
|
-
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);
|
|
6030
6132
|
}
|
|
6031
6133
|
/**
|
|
6032
6134
|
* Center and zoom in/out the view to fit points by their indices in the scene.
|
|
6033
6135
|
* @param indices Point indices to fit in the view.
|
|
6034
6136
|
* @param duration Duration of the center and zoom in/out animation in milliseconds (`250` by default).
|
|
6035
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).
|
|
6036
6139
|
*/
|
|
6037
|
-
fitViewByPointIndices(t, i = 250, o = 0.1) {
|
|
6038
|
-
if (this._isDestroyed || this.ensureDevice(() => this.fitViewByPointIndices(t, i, o))) return;
|
|
6039
|
-
const
|
|
6040
|
-
for (const [
|
|
6041
|
-
|
|
6042
|
-
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);
|
|
6043
6146
|
}
|
|
6044
6147
|
/**
|
|
6045
6148
|
* Center and zoom in/out the view to fit points by their positions in the scene.
|
|
6046
6149
|
* @param positions Flat array of point coordinates as `[x0, y0, x1, y1, ...]`.
|
|
6047
6150
|
* @param duration Duration of the center and zoom in/out animation in milliseconds (`250` by default).
|
|
6048
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).
|
|
6049
6153
|
*/
|
|
6050
|
-
fitViewByPointPositions(t, i = 250, o = 0.1) {
|
|
6051
|
-
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);
|
|
6052
6156
|
}
|
|
6053
6157
|
/**
|
|
6054
6158
|
* Sets the zoom transform so that the given point positions fit in the viewport, with optional animation.
|
|
@@ -6057,13 +6161,14 @@ class Lt {
|
|
|
6057
6161
|
* @param duration Animation duration in milliseconds. Default `250`.
|
|
6058
6162
|
* @param scale Optional scale factor; if omitted, scale is chosen to fit the positions.
|
|
6059
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).
|
|
6060
6165
|
*/
|
|
6061
|
-
setZoomTransformByPointPositions(t, i = 250, o, s = 0.1) {
|
|
6062
|
-
var
|
|
6063
|
-
if (this._isDestroyed || this.ensureDevice(() => this.setZoomTransformByPointPositions(t, i, o, s))) return;
|
|
6064
|
-
this.resizeCanvas();
|
|
6065
|
-
const
|
|
6066
|
-
(
|
|
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);
|
|
6067
6172
|
}
|
|
6068
6173
|
/**
|
|
6069
6174
|
* Get points indices inside a rectangular area.
|
|
@@ -6075,7 +6180,7 @@ class Lt {
|
|
|
6075
6180
|
getPointsInRect(t) {
|
|
6076
6181
|
if (this._isDestroyed || !this.device || !this.points) return new Float32Array();
|
|
6077
6182
|
const i = this.store.screenSize[1];
|
|
6078
|
-
return this.store.selectedArea = [[t[0][0], i - t[1][1]], [t[1][0], i - t[0][1]]], this.points.findPointsOnAreaSelection(),
|
|
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);
|
|
6079
6184
|
}
|
|
6080
6185
|
/**
|
|
6081
6186
|
* Get points indices inside a polygon area.
|
|
@@ -6087,7 +6192,7 @@ class Lt {
|
|
|
6087
6192
|
if (this._isDestroyed || !this.device || !this.points) return new Float32Array();
|
|
6088
6193
|
if (t.length < 3) return new Float32Array();
|
|
6089
6194
|
const i = this.store.screenSize[1], o = t.map(([n, r]) => [n, i - r]);
|
|
6090
|
-
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);
|
|
6091
6196
|
}
|
|
6092
6197
|
/** Select points inside a rectangular area.
|
|
6093
6198
|
* @param selection - Array of two corner points `[[left, top], [right, bottom]]`.
|
|
@@ -6098,7 +6203,7 @@ class Lt {
|
|
|
6098
6203
|
if (t) {
|
|
6099
6204
|
const i = this.store.screenSize[1];
|
|
6100
6205
|
this.store.selectedArea = [[t[0][0], i - t[1][1]], [t[1][0], i - t[0][1]]], this.points.findPointsOnAreaSelection();
|
|
6101
|
-
const o =
|
|
6206
|
+
const o = I(this.device, this.points.selectedFbo);
|
|
6102
6207
|
this.store.selectedIndices = o.map((s, n) => n % 4 === 0 && s !== 0 ? n / 4 : -1).filter((s) => s !== -1);
|
|
6103
6208
|
} else
|
|
6104
6209
|
this.store.selectedIndices = null;
|
|
@@ -6118,7 +6223,7 @@ class Lt {
|
|
|
6118
6223
|
}
|
|
6119
6224
|
const i = this.store.screenSize[1], o = t.map(([n, r]) => [n, i - r]);
|
|
6120
6225
|
this.points.updatePolygonPath(o), this.points.findPointsOnPolygonSelection();
|
|
6121
|
-
const s =
|
|
6226
|
+
const s = I(this.device, this.points.selectedFbo);
|
|
6122
6227
|
this.store.selectedIndices = s.map((n, r) => r % 4 === 0 && n !== 0 ? r / 4 : -1).filter((n) => n !== -1);
|
|
6123
6228
|
} else
|
|
6124
6229
|
this.store.selectedIndices = null;
|
|
@@ -6198,9 +6303,11 @@ class Lt {
|
|
|
6198
6303
|
* @returns Radius of the point.
|
|
6199
6304
|
*/
|
|
6200
6305
|
getPointRadiusByIndex(t) {
|
|
6201
|
-
var
|
|
6202
|
-
if (
|
|
6203
|
-
|
|
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);
|
|
6204
6311
|
}
|
|
6205
6312
|
/**
|
|
6206
6313
|
* Track multiple point positions by their indices on each Cosmos tick.
|
|
@@ -6326,19 +6433,21 @@ class Lt {
|
|
|
6326
6433
|
* Destroy this Cosmos instance.
|
|
6327
6434
|
*/
|
|
6328
6435
|
destroy() {
|
|
6329
|
-
var t, i, o, s, n, r, a, d, l, c,
|
|
6330
|
-
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(), (
|
|
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({
|
|
6331
6438
|
clearColor: this.store.backgroundColor,
|
|
6332
6439
|
clearDepth: 1,
|
|
6333
6440
|
clearStencil: 0
|
|
6334
|
-
}).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);
|
|
6335
6442
|
}
|
|
6336
6443
|
/**
|
|
6337
|
-
*
|
|
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()`.
|
|
6338
6447
|
*/
|
|
6339
6448
|
create() {
|
|
6340
6449
|
var t, i, o, s, n;
|
|
6341
|
-
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);
|
|
6342
6451
|
}
|
|
6343
6452
|
/**
|
|
6344
6453
|
* Converts an array of tuple positions to a single array containing all coordinates sequentially
|
|
@@ -6359,6 +6468,21 @@ class Lt {
|
|
|
6359
6468
|
i[o] = [t[o * 2], t[o * 2 + 1]];
|
|
6360
6469
|
return i;
|
|
6361
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
|
+
}
|
|
6362
6486
|
/**
|
|
6363
6487
|
* Ensures device is initialized before executing a method.
|
|
6364
6488
|
* If device is not ready, queues the method to run after initialization.
|
|
@@ -6391,9 +6515,9 @@ class Lt {
|
|
|
6391
6515
|
* Graph class decides what device to create with sensible defaults
|
|
6392
6516
|
*/
|
|
6393
6517
|
async createDevice(t) {
|
|
6394
|
-
return await
|
|
6518
|
+
return await le.createDevice({
|
|
6395
6519
|
type: "webgl",
|
|
6396
|
-
adapters: [
|
|
6520
|
+
adapters: [ce],
|
|
6397
6521
|
createCanvasContext: {
|
|
6398
6522
|
canvas: t,
|
|
6399
6523
|
// Provide existing canvas
|
|
@@ -6412,7 +6536,7 @@ class Lt {
|
|
|
6412
6536
|
*/
|
|
6413
6537
|
update(t = this.store.alpha) {
|
|
6414
6538
|
const { graph: i } = this;
|
|
6415
|
-
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;
|
|
6416
6540
|
}
|
|
6417
6541
|
/**
|
|
6418
6542
|
* Runs one step of the simulation (forces, position updates, alpha decay).
|
|
@@ -6425,15 +6549,17 @@ class Lt {
|
|
|
6425
6549
|
* to respect pause/unpause state.
|
|
6426
6550
|
*/
|
|
6427
6551
|
runSimulationStep(t = !1) {
|
|
6428
|
-
var
|
|
6552
|
+
var d, l, c, f, u, h, p, P, m, C, v, y, O, F, E, M, U, B, q;
|
|
6429
6553
|
const { config: { simulationGravity: i, simulationCenter: o, enableSimulation: s }, store: { isSimulationRunning: n } } = this;
|
|
6430
6554
|
if (!s) return;
|
|
6431
|
-
this.isRightClickMouse && this.config.enableRightClickRepulsion && ((
|
|
6432
|
-
|
|
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,
|
|
6433
6559
|
this.store.alpha,
|
|
6434
6560
|
(E = this.store.hoveredPoint) == null ? void 0 : E.index,
|
|
6435
|
-
(
|
|
6436
|
-
)), (
|
|
6561
|
+
(M = this.store.hoveredPoint) == null ? void 0 : M.position
|
|
6562
|
+
)), (q = this.points) == null || q.trackPoints();
|
|
6437
6563
|
}
|
|
6438
6564
|
initPrograms() {
|
|
6439
6565
|
var t, i, o, s, n, r;
|
|
@@ -6461,8 +6587,8 @@ class Lt {
|
|
|
6461
6587
|
clearColor: l,
|
|
6462
6588
|
clearDepth: 1,
|
|
6463
6589
|
clearStencil: 0
|
|
6464
|
-
}), { config: { renderLinks:
|
|
6465
|
-
|
|
6590
|
+
}), { config: { renderLinks: f } } = this;
|
|
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();
|
|
6466
6592
|
}
|
|
6467
6593
|
(d = this.fpsMonitor) == null || d.end(t ?? performance.now()), this.currentEvent = void 0;
|
|
6468
6594
|
}
|
|
@@ -6485,7 +6611,7 @@ class Lt {
|
|
|
6485
6611
|
this.store.isSimulationRunning = !1, this.store.simulationProgress = 1, (i = (t = this.config).onSimulationEnd) == null || i.call(t), this._shouldForceHoverDetection = !0;
|
|
6486
6612
|
}
|
|
6487
6613
|
onClick(t) {
|
|
6488
|
-
var i, o, s, n, r, a, d, l, c,
|
|
6614
|
+
var i, o, s, n, r, a, d, l, c, f;
|
|
6489
6615
|
(n = (s = this.config).onClick) == null || n.call(
|
|
6490
6616
|
s,
|
|
6491
6617
|
(i = this.store.hoveredPoint) == null ? void 0 : i.index,
|
|
@@ -6500,7 +6626,7 @@ class Lt {
|
|
|
6500
6626
|
d,
|
|
6501
6627
|
this.store.hoveredLinkIndex,
|
|
6502
6628
|
t
|
|
6503
|
-
) : (
|
|
6629
|
+
) : (f = (c = this.config).onBackgroundClick) == null || f.call(
|
|
6504
6630
|
c,
|
|
6505
6631
|
t
|
|
6506
6632
|
);
|
|
@@ -6520,7 +6646,7 @@ class Lt {
|
|
|
6520
6646
|
);
|
|
6521
6647
|
}
|
|
6522
6648
|
onContextMenu(t) {
|
|
6523
|
-
var i, o, s, n, r, a, d, l, c,
|
|
6649
|
+
var i, o, s, n, r, a, d, l, c, f;
|
|
6524
6650
|
t.preventDefault(), (n = (s = this.config).onContextMenu) == null || n.call(
|
|
6525
6651
|
s,
|
|
6526
6652
|
(i = this.store.hoveredPoint) == null ? void 0 : i.index,
|
|
@@ -6535,7 +6661,7 @@ class Lt {
|
|
|
6535
6661
|
d,
|
|
6536
6662
|
this.store.hoveredLinkIndex,
|
|
6537
6663
|
t
|
|
6538
|
-
) : (
|
|
6664
|
+
) : (f = (c = this.config).onBackgroundContextMenu) == null || f.call(
|
|
6539
6665
|
c,
|
|
6540
6666
|
t
|
|
6541
6667
|
);
|
|
@@ -6545,8 +6671,8 @@ class Lt {
|
|
|
6545
6671
|
if (this._isDestroyed) return;
|
|
6546
6672
|
const i = this.canvas.clientWidth, o = this.canvas.clientHeight, [s, n] = this.store.screenSize;
|
|
6547
6673
|
if (t || s !== i || n !== o) {
|
|
6548
|
-
const { k: c } = this.zoomInstance.eventTransform,
|
|
6549
|
-
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());
|
|
6550
6676
|
}
|
|
6551
6677
|
}
|
|
6552
6678
|
updateZoomDragBehaviors() {
|
|
@@ -6555,12 +6681,12 @@ class Lt {
|
|
|
6555
6681
|
}
|
|
6556
6682
|
findHoveredItem() {
|
|
6557
6683
|
if (this._isDestroyed || !this._isMouseOnCanvas) return;
|
|
6558
|
-
if (this._findHoveredItemExecutionCount <
|
|
6684
|
+
if (this._findHoveredItemExecutionCount < Ce) {
|
|
6559
6685
|
this._findHoveredItemExecutionCount += 1;
|
|
6560
6686
|
return;
|
|
6561
6687
|
}
|
|
6562
6688
|
const t = Math.abs(this._lastMouseX - this._lastCheckedMouseX), i = Math.abs(this._lastMouseY - this._lastCheckedMouseY);
|
|
6563
|
-
if (!(!(t >
|
|
6689
|
+
if (!(!(t > $ || i > $) && !this._shouldForceHoverDetection)) {
|
|
6564
6690
|
if (this._lastCheckedMouseX = this._lastMouseX, this._lastCheckedMouseY = this._lastMouseY, this._shouldForceHoverDetection = !1, this._findHoveredItemExecutionCount = 0, this.findHoveredPoint(), this.graph.linksNumber && this.store.isLinkHoveringEnabled)
|
|
6565
6691
|
this.findHoveredLine();
|
|
6566
6692
|
else if (this.store.hoveredLinkIndex !== void 0) {
|
|
@@ -6571,11 +6697,11 @@ class Lt {
|
|
|
6571
6697
|
}
|
|
6572
6698
|
}
|
|
6573
6699
|
findHoveredPoint() {
|
|
6574
|
-
var d, l, c,
|
|
6700
|
+
var d, l, c, f, u;
|
|
6575
6701
|
if (this._isDestroyed || !this.device || !this.points) return;
|
|
6576
6702
|
this.points.findHoveredPoint();
|
|
6577
6703
|
let t = !1, i = !1;
|
|
6578
|
-
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];
|
|
6579
6705
|
n > 0 ? ((this.store.hoveredPoint === void 0 || this.store.hoveredPoint.index !== s) && (t = !0), this.store.hoveredPoint = {
|
|
6580
6706
|
index: s,
|
|
6581
6707
|
position: [r, a]
|
|
@@ -6585,7 +6711,7 @@ class Lt {
|
|
|
6585
6711
|
this.store.hoveredPoint.position,
|
|
6586
6712
|
this.currentEvent,
|
|
6587
6713
|
((d = this.store.selectedIndices) == null ? void 0 : d.includes(this.store.hoveredPoint.index)) ?? !1
|
|
6588
|
-
)), i && ((
|
|
6714
|
+
)), i && ((u = (f = this.config).onPointMouseOut) == null || u.call(f, this.currentEvent));
|
|
6589
6715
|
}
|
|
6590
6716
|
findHoveredLine() {
|
|
6591
6717
|
var n, r, a, d, l, c;
|
|
@@ -6597,7 +6723,7 @@ class Lt {
|
|
|
6597
6723
|
this.lines.findHoveredLine();
|
|
6598
6724
|
let t = !1, i = !1;
|
|
6599
6725
|
if (!this.device) return;
|
|
6600
|
-
const s =
|
|
6726
|
+
const s = I(this.device, this.lines.hoveredLineIndexFbo)[0];
|
|
6601
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));
|
|
6602
6728
|
}
|
|
6603
6729
|
updateCanvasCursor() {
|
|
@@ -6615,40 +6741,29 @@ class Lt {
|
|
|
6615
6741
|
margin: 0 0.6rem 0.6rem 0;
|
|
6616
6742
|
font-size: 0.7rem;
|
|
6617
6743
|
font-family: inherit;
|
|
6618
|
-
`, this.attributionDivElement.innerHTML =
|
|
6744
|
+
`, this.attributionDivElement.innerHTML = Ie(this.config.attribution, {
|
|
6619
6745
|
ALLOWED_TAGS: ["a", "b", "i", "em", "strong", "span", "div", "p", "br", "img"],
|
|
6620
6746
|
ALLOWED_ATTR: ["href", "target", "class", "id", "style", "src", "alt", "title"]
|
|
6621
6747
|
}), (t = this.store.div) == null || t.appendChild(this.attributionDivElement));
|
|
6622
6748
|
}
|
|
6623
6749
|
}
|
|
6624
6750
|
export {
|
|
6625
|
-
|
|
6626
|
-
|
|
6627
|
-
|
|
6628
|
-
|
|
6629
|
-
|
|
6630
|
-
|
|
6631
|
-
Y as defaultGreyoutPointColor,
|
|
6632
|
-
ge as defaultGreyoutPointOpacity,
|
|
6633
|
-
Re as defaultLinkColor,
|
|
6634
|
-
ve as defaultLinkOpacity,
|
|
6635
|
-
Ae as defaultLinkWidth,
|
|
6636
|
-
Te as defaultPointColor,
|
|
6637
|
-
Ce as defaultPointOpacity,
|
|
6638
|
-
Pe as defaultPointSize,
|
|
6639
|
-
ye as defaultScaleToZoom,
|
|
6640
|
-
Ie as focusedPointRingOpacity,
|
|
6641
|
-
$ as getMaxPointSize,
|
|
6751
|
+
kt as Graph,
|
|
6752
|
+
oe as PointShape,
|
|
6753
|
+
me as clamp,
|
|
6754
|
+
k as defaultConfigValues,
|
|
6755
|
+
Ee as focusedPointRingOpacity,
|
|
6756
|
+
J as getMaxPointSize,
|
|
6642
6757
|
z as getRgbaColor,
|
|
6643
|
-
|
|
6644
|
-
|
|
6758
|
+
Fe as hoveredPointRingOpacity,
|
|
6759
|
+
ve as isAClassInstance,
|
|
6645
6760
|
ie as isArray,
|
|
6646
|
-
|
|
6647
|
-
|
|
6648
|
-
|
|
6649
|
-
|
|
6650
|
-
|
|
6651
|
-
|
|
6652
|
-
|
|
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
|
|
6653
6768
|
};
|
|
6654
6769
|
//# sourceMappingURL=index.js.map
|