@cosmos.gl/graph 3.0.0-beta.5 → 3.0.0-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config.d.ts +14 -29
- package/dist/index.d.ts +19 -22
- package/dist/index.js +782 -549
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +158 -65
- package/dist/index.min.js.map +1 -1
- package/dist/modules/Lines/conic-curve-module.d.ts +2 -0
- package/dist/modules/Lines/index.d.ts +10 -0
- package/dist/variables.d.ts +2 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
import { select as
|
|
1
|
+
import { select as b } from "d3-selection";
|
|
2
2
|
import "d3-transition";
|
|
3
|
-
import { easeQuadIn as
|
|
4
|
-
import { textureFormatDecoder as
|
|
5
|
-
import { webgl2Adapter as
|
|
6
|
-
import { color as
|
|
7
|
-
import
|
|
8
|
-
import { scaleLinear as j, scalePow as
|
|
3
|
+
import { easeQuadIn as oe, easeQuadOut as se, easeQuadInOut as ne } from "d3-ease";
|
|
4
|
+
import { textureFormatDecoder as re, Texture as C, Buffer as S, UniformStore as x, luma as ae } from "@luma.gl/core";
|
|
5
|
+
import { webgl2Adapter as de } from "@luma.gl/webgl";
|
|
6
|
+
import { color as le } from "d3-color";
|
|
7
|
+
import ce from "dompurify";
|
|
8
|
+
import { scaleLinear as j, scalePow as fe } from "d3-scale";
|
|
9
9
|
import { mat3 as V } from "gl-matrix";
|
|
10
10
|
import { Random as he } from "random";
|
|
11
|
-
import { Model as
|
|
12
|
-
import
|
|
13
|
-
import { range as
|
|
14
|
-
import { zoomIdentity as W, zoom as
|
|
15
|
-
import { drag as
|
|
16
|
-
const
|
|
11
|
+
import { Model as v } from "@luma.gl/engine";
|
|
12
|
+
import ue from "gl-bench";
|
|
13
|
+
import { range as Se } from "d3-array";
|
|
14
|
+
import { zoomIdentity as W, zoom as pe } from "d3-zoom";
|
|
15
|
+
import { drag as _e } from "d3-drag";
|
|
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
17
|
enableSimulation: !0,
|
|
18
|
-
|
|
18
|
+
/** Setting to 4096 because larger values crash the graph on iOS. More info: https://github.com/cosmosgl/graph/issues/203 */
|
|
19
|
+
spaceSize: 4096,
|
|
19
20
|
pointSizeScale: 1,
|
|
20
21
|
linkWidthScale: 1,
|
|
21
22
|
linkArrowsSizeScale: 1,
|
|
@@ -59,19 +60,20 @@ const _e = "#b3b3b3", Te = void 0, Y = void 0, ge = 1, Ce = 4, Re = "#666666", P
|
|
|
59
60
|
fitViewDelay: 250,
|
|
60
61
|
fitViewPadding: 0.1,
|
|
61
62
|
fitViewDuration: 250,
|
|
62
|
-
pointSamplingDistance:
|
|
63
|
+
pointSamplingDistance: 100,
|
|
64
|
+
linkSamplingDistance: 100,
|
|
63
65
|
attribution: "",
|
|
64
66
|
rescalePositions: void 0,
|
|
65
67
|
enableRightClickRepulsion: !1
|
|
66
|
-
},
|
|
67
|
-
var
|
|
68
|
+
}, me = 0.7, Ie = 0.95, ye = 3;
|
|
69
|
+
var L;
|
|
68
70
|
(function(e) {
|
|
69
71
|
e[e.DEPTH_BUFFER_BIT = 256] = "DEPTH_BUFFER_BIT", e[e.STENCIL_BUFFER_BIT = 1024] = "STENCIL_BUFFER_BIT", e[e.COLOR_BUFFER_BIT = 16384] = "COLOR_BUFFER_BIT", e[e.POINTS = 0] = "POINTS", e[e.LINES = 1] = "LINES", e[e.LINE_LOOP = 2] = "LINE_LOOP", e[e.LINE_STRIP = 3] = "LINE_STRIP", e[e.TRIANGLES = 4] = "TRIANGLES", e[e.TRIANGLE_STRIP = 5] = "TRIANGLE_STRIP", e[e.TRIANGLE_FAN = 6] = "TRIANGLE_FAN", e[e.ZERO = 0] = "ZERO", e[e.ONE = 1] = "ONE", e[e.SRC_COLOR = 768] = "SRC_COLOR", e[e.ONE_MINUS_SRC_COLOR = 769] = "ONE_MINUS_SRC_COLOR", e[e.SRC_ALPHA = 770] = "SRC_ALPHA", e[e.ONE_MINUS_SRC_ALPHA = 771] = "ONE_MINUS_SRC_ALPHA", e[e.DST_ALPHA = 772] = "DST_ALPHA", e[e.ONE_MINUS_DST_ALPHA = 773] = "ONE_MINUS_DST_ALPHA", e[e.DST_COLOR = 774] = "DST_COLOR", e[e.ONE_MINUS_DST_COLOR = 775] = "ONE_MINUS_DST_COLOR", e[e.SRC_ALPHA_SATURATE = 776] = "SRC_ALPHA_SATURATE", e[e.CONSTANT_COLOR = 32769] = "CONSTANT_COLOR", e[e.ONE_MINUS_CONSTANT_COLOR = 32770] = "ONE_MINUS_CONSTANT_COLOR", e[e.CONSTANT_ALPHA = 32771] = "CONSTANT_ALPHA", e[e.ONE_MINUS_CONSTANT_ALPHA = 32772] = "ONE_MINUS_CONSTANT_ALPHA", e[e.FUNC_ADD = 32774] = "FUNC_ADD", e[e.FUNC_SUBTRACT = 32778] = "FUNC_SUBTRACT", e[e.FUNC_REVERSE_SUBTRACT = 32779] = "FUNC_REVERSE_SUBTRACT", e[e.BLEND_EQUATION = 32777] = "BLEND_EQUATION", e[e.BLEND_EQUATION_RGB = 32777] = "BLEND_EQUATION_RGB", e[e.BLEND_EQUATION_ALPHA = 34877] = "BLEND_EQUATION_ALPHA", e[e.BLEND_DST_RGB = 32968] = "BLEND_DST_RGB", e[e.BLEND_SRC_RGB = 32969] = "BLEND_SRC_RGB", e[e.BLEND_DST_ALPHA = 32970] = "BLEND_DST_ALPHA", e[e.BLEND_SRC_ALPHA = 32971] = "BLEND_SRC_ALPHA", e[e.BLEND_COLOR = 32773] = "BLEND_COLOR", e[e.ARRAY_BUFFER_BINDING = 34964] = "ARRAY_BUFFER_BINDING", e[e.ELEMENT_ARRAY_BUFFER_BINDING = 34965] = "ELEMENT_ARRAY_BUFFER_BINDING", e[e.LINE_WIDTH = 2849] = "LINE_WIDTH", e[e.ALIASED_POINT_SIZE_RANGE = 33901] = "ALIASED_POINT_SIZE_RANGE", e[e.ALIASED_LINE_WIDTH_RANGE = 33902] = "ALIASED_LINE_WIDTH_RANGE", e[e.CULL_FACE_MODE = 2885] = "CULL_FACE_MODE", e[e.FRONT_FACE = 2886] = "FRONT_FACE", e[e.DEPTH_RANGE = 2928] = "DEPTH_RANGE", e[e.DEPTH_WRITEMASK = 2930] = "DEPTH_WRITEMASK", e[e.DEPTH_CLEAR_VALUE = 2931] = "DEPTH_CLEAR_VALUE", e[e.DEPTH_FUNC = 2932] = "DEPTH_FUNC", e[e.STENCIL_CLEAR_VALUE = 2961] = "STENCIL_CLEAR_VALUE", e[e.STENCIL_FUNC = 2962] = "STENCIL_FUNC", e[e.STENCIL_FAIL = 2964] = "STENCIL_FAIL", e[e.STENCIL_PASS_DEPTH_FAIL = 2965] = "STENCIL_PASS_DEPTH_FAIL", e[e.STENCIL_PASS_DEPTH_PASS = 2966] = "STENCIL_PASS_DEPTH_PASS", e[e.STENCIL_REF = 2967] = "STENCIL_REF", e[e.STENCIL_VALUE_MASK = 2963] = "STENCIL_VALUE_MASK", e[e.STENCIL_WRITEMASK = 2968] = "STENCIL_WRITEMASK", e[e.STENCIL_BACK_FUNC = 34816] = "STENCIL_BACK_FUNC", e[e.STENCIL_BACK_FAIL = 34817] = "STENCIL_BACK_FAIL", e[e.STENCIL_BACK_PASS_DEPTH_FAIL = 34818] = "STENCIL_BACK_PASS_DEPTH_FAIL", e[e.STENCIL_BACK_PASS_DEPTH_PASS = 34819] = "STENCIL_BACK_PASS_DEPTH_PASS", e[e.STENCIL_BACK_REF = 36003] = "STENCIL_BACK_REF", e[e.STENCIL_BACK_VALUE_MASK = 36004] = "STENCIL_BACK_VALUE_MASK", e[e.STENCIL_BACK_WRITEMASK = 36005] = "STENCIL_BACK_WRITEMASK", e[e.VIEWPORT = 2978] = "VIEWPORT", e[e.SCISSOR_BOX = 3088] = "SCISSOR_BOX", e[e.COLOR_CLEAR_VALUE = 3106] = "COLOR_CLEAR_VALUE", e[e.COLOR_WRITEMASK = 3107] = "COLOR_WRITEMASK", e[e.UNPACK_ALIGNMENT = 3317] = "UNPACK_ALIGNMENT", e[e.PACK_ALIGNMENT = 3333] = "PACK_ALIGNMENT", e[e.MAX_TEXTURE_SIZE = 3379] = "MAX_TEXTURE_SIZE", e[e.MAX_VIEWPORT_DIMS = 3386] = "MAX_VIEWPORT_DIMS", e[e.SUBPIXEL_BITS = 3408] = "SUBPIXEL_BITS", e[e.RED_BITS = 3410] = "RED_BITS", e[e.GREEN_BITS = 3411] = "GREEN_BITS", e[e.BLUE_BITS = 3412] = "BLUE_BITS", e[e.ALPHA_BITS = 3413] = "ALPHA_BITS", e[e.DEPTH_BITS = 3414] = "DEPTH_BITS", e[e.STENCIL_BITS = 3415] = "STENCIL_BITS", e[e.POLYGON_OFFSET_UNITS = 10752] = "POLYGON_OFFSET_UNITS", e[e.POLYGON_OFFSET_FACTOR = 32824] = "POLYGON_OFFSET_FACTOR", e[e.TEXTURE_BINDING_2D = 32873] = "TEXTURE_BINDING_2D", e[e.SAMPLE_BUFFERS = 32936] = "SAMPLE_BUFFERS", e[e.SAMPLES = 32937] = "SAMPLES", e[e.SAMPLE_COVERAGE_VALUE = 32938] = "SAMPLE_COVERAGE_VALUE", e[e.SAMPLE_COVERAGE_INVERT = 32939] = "SAMPLE_COVERAGE_INVERT", e[e.COMPRESSED_TEXTURE_FORMATS = 34467] = "COMPRESSED_TEXTURE_FORMATS", e[e.VENDOR = 7936] = "VENDOR", e[e.RENDERER = 7937] = "RENDERER", e[e.VERSION = 7938] = "VERSION", e[e.IMPLEMENTATION_COLOR_READ_TYPE = 35738] = "IMPLEMENTATION_COLOR_READ_TYPE", e[e.IMPLEMENTATION_COLOR_READ_FORMAT = 35739] = "IMPLEMENTATION_COLOR_READ_FORMAT", e[e.BROWSER_DEFAULT_WEBGL = 37444] = "BROWSER_DEFAULT_WEBGL", e[e.STATIC_DRAW = 35044] = "STATIC_DRAW", e[e.STREAM_DRAW = 35040] = "STREAM_DRAW", e[e.DYNAMIC_DRAW = 35048] = "DYNAMIC_DRAW", e[e.ARRAY_BUFFER = 34962] = "ARRAY_BUFFER", e[e.ELEMENT_ARRAY_BUFFER = 34963] = "ELEMENT_ARRAY_BUFFER", e[e.BUFFER_SIZE = 34660] = "BUFFER_SIZE", e[e.BUFFER_USAGE = 34661] = "BUFFER_USAGE", e[e.CURRENT_VERTEX_ATTRIB = 34342] = "CURRENT_VERTEX_ATTRIB", e[e.VERTEX_ATTRIB_ARRAY_ENABLED = 34338] = "VERTEX_ATTRIB_ARRAY_ENABLED", e[e.VERTEX_ATTRIB_ARRAY_SIZE = 34339] = "VERTEX_ATTRIB_ARRAY_SIZE", e[e.VERTEX_ATTRIB_ARRAY_STRIDE = 34340] = "VERTEX_ATTRIB_ARRAY_STRIDE", e[e.VERTEX_ATTRIB_ARRAY_TYPE = 34341] = "VERTEX_ATTRIB_ARRAY_TYPE", e[e.VERTEX_ATTRIB_ARRAY_NORMALIZED = 34922] = "VERTEX_ATTRIB_ARRAY_NORMALIZED", e[e.VERTEX_ATTRIB_ARRAY_POINTER = 34373] = "VERTEX_ATTRIB_ARRAY_POINTER", e[e.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING = 34975] = "VERTEX_ATTRIB_ARRAY_BUFFER_BINDING", e[e.CULL_FACE = 2884] = "CULL_FACE", e[e.FRONT = 1028] = "FRONT", e[e.BACK = 1029] = "BACK", e[e.FRONT_AND_BACK = 1032] = "FRONT_AND_BACK", e[e.BLEND = 3042] = "BLEND", e[e.DEPTH_TEST = 2929] = "DEPTH_TEST", e[e.DITHER = 3024] = "DITHER", e[e.POLYGON_OFFSET_FILL = 32823] = "POLYGON_OFFSET_FILL", e[e.SAMPLE_ALPHA_TO_COVERAGE = 32926] = "SAMPLE_ALPHA_TO_COVERAGE", e[e.SAMPLE_COVERAGE = 32928] = "SAMPLE_COVERAGE", e[e.SCISSOR_TEST = 3089] = "SCISSOR_TEST", e[e.STENCIL_TEST = 2960] = "STENCIL_TEST", e[e.NO_ERROR = 0] = "NO_ERROR", e[e.INVALID_ENUM = 1280] = "INVALID_ENUM", e[e.INVALID_VALUE = 1281] = "INVALID_VALUE", e[e.INVALID_OPERATION = 1282] = "INVALID_OPERATION", e[e.OUT_OF_MEMORY = 1285] = "OUT_OF_MEMORY", e[e.CONTEXT_LOST_WEBGL = 37442] = "CONTEXT_LOST_WEBGL", e[e.CW = 2304] = "CW", e[e.CCW = 2305] = "CCW", e[e.DONT_CARE = 4352] = "DONT_CARE", e[e.FASTEST = 4353] = "FASTEST", e[e.NICEST = 4354] = "NICEST", e[e.GENERATE_MIPMAP_HINT = 33170] = "GENERATE_MIPMAP_HINT", e[e.BYTE = 5120] = "BYTE", e[e.UNSIGNED_BYTE = 5121] = "UNSIGNED_BYTE", e[e.SHORT = 5122] = "SHORT", e[e.UNSIGNED_SHORT = 5123] = "UNSIGNED_SHORT", e[e.INT = 5124] = "INT", e[e.UNSIGNED_INT = 5125] = "UNSIGNED_INT", e[e.FLOAT = 5126] = "FLOAT", e[e.DOUBLE = 5130] = "DOUBLE", e[e.DEPTH_COMPONENT = 6402] = "DEPTH_COMPONENT", e[e.ALPHA = 6406] = "ALPHA", e[e.RGB = 6407] = "RGB", e[e.RGBA = 6408] = "RGBA", e[e.LUMINANCE = 6409] = "LUMINANCE", e[e.LUMINANCE_ALPHA = 6410] = "LUMINANCE_ALPHA", e[e.UNSIGNED_SHORT_4_4_4_4 = 32819] = "UNSIGNED_SHORT_4_4_4_4", e[e.UNSIGNED_SHORT_5_5_5_1 = 32820] = "UNSIGNED_SHORT_5_5_5_1", e[e.UNSIGNED_SHORT_5_6_5 = 33635] = "UNSIGNED_SHORT_5_6_5", e[e.FRAGMENT_SHADER = 35632] = "FRAGMENT_SHADER", e[e.VERTEX_SHADER = 35633] = "VERTEX_SHADER", e[e.COMPILE_STATUS = 35713] = "COMPILE_STATUS", e[e.DELETE_STATUS = 35712] = "DELETE_STATUS", e[e.LINK_STATUS = 35714] = "LINK_STATUS", e[e.VALIDATE_STATUS = 35715] = "VALIDATE_STATUS", e[e.ATTACHED_SHADERS = 35717] = "ATTACHED_SHADERS", e[e.ACTIVE_ATTRIBUTES = 35721] = "ACTIVE_ATTRIBUTES", e[e.ACTIVE_UNIFORMS = 35718] = "ACTIVE_UNIFORMS", e[e.MAX_VERTEX_ATTRIBS = 34921] = "MAX_VERTEX_ATTRIBS", e[e.MAX_VERTEX_UNIFORM_VECTORS = 36347] = "MAX_VERTEX_UNIFORM_VECTORS", e[e.MAX_VARYING_VECTORS = 36348] = "MAX_VARYING_VECTORS", e[e.MAX_COMBINED_TEXTURE_IMAGE_UNITS = 35661] = "MAX_COMBINED_TEXTURE_IMAGE_UNITS", e[e.MAX_VERTEX_TEXTURE_IMAGE_UNITS = 35660] = "MAX_VERTEX_TEXTURE_IMAGE_UNITS", e[e.MAX_TEXTURE_IMAGE_UNITS = 34930] = "MAX_TEXTURE_IMAGE_UNITS", e[e.MAX_FRAGMENT_UNIFORM_VECTORS = 36349] = "MAX_FRAGMENT_UNIFORM_VECTORS", e[e.SHADER_TYPE = 35663] = "SHADER_TYPE", e[e.SHADING_LANGUAGE_VERSION = 35724] = "SHADING_LANGUAGE_VERSION", e[e.CURRENT_PROGRAM = 35725] = "CURRENT_PROGRAM", e[e.NEVER = 512] = "NEVER", e[e.LESS = 513] = "LESS", e[e.EQUAL = 514] = "EQUAL", e[e.LEQUAL = 515] = "LEQUAL", e[e.GREATER = 516] = "GREATER", e[e.NOTEQUAL = 517] = "NOTEQUAL", e[e.GEQUAL = 518] = "GEQUAL", e[e.ALWAYS = 519] = "ALWAYS", e[e.KEEP = 7680] = "KEEP", e[e.REPLACE = 7681] = "REPLACE", e[e.INCR = 7682] = "INCR", e[e.DECR = 7683] = "DECR", e[e.INVERT = 5386] = "INVERT", e[e.INCR_WRAP = 34055] = "INCR_WRAP", e[e.DECR_WRAP = 34056] = "DECR_WRAP", e[e.NEAREST = 9728] = "NEAREST", e[e.LINEAR = 9729] = "LINEAR", e[e.NEAREST_MIPMAP_NEAREST = 9984] = "NEAREST_MIPMAP_NEAREST", e[e.LINEAR_MIPMAP_NEAREST = 9985] = "LINEAR_MIPMAP_NEAREST", e[e.NEAREST_MIPMAP_LINEAR = 9986] = "NEAREST_MIPMAP_LINEAR", e[e.LINEAR_MIPMAP_LINEAR = 9987] = "LINEAR_MIPMAP_LINEAR", e[e.TEXTURE_MAG_FILTER = 10240] = "TEXTURE_MAG_FILTER", e[e.TEXTURE_MIN_FILTER = 10241] = "TEXTURE_MIN_FILTER", e[e.TEXTURE_WRAP_S = 10242] = "TEXTURE_WRAP_S", e[e.TEXTURE_WRAP_T = 10243] = "TEXTURE_WRAP_T", e[e.TEXTURE_2D = 3553] = "TEXTURE_2D", e[e.TEXTURE = 5890] = "TEXTURE", e[e.TEXTURE_CUBE_MAP = 34067] = "TEXTURE_CUBE_MAP", e[e.TEXTURE_BINDING_CUBE_MAP = 34068] = "TEXTURE_BINDING_CUBE_MAP", e[e.TEXTURE_CUBE_MAP_POSITIVE_X = 34069] = "TEXTURE_CUBE_MAP_POSITIVE_X", e[e.TEXTURE_CUBE_MAP_NEGATIVE_X = 34070] = "TEXTURE_CUBE_MAP_NEGATIVE_X", e[e.TEXTURE_CUBE_MAP_POSITIVE_Y = 34071] = "TEXTURE_CUBE_MAP_POSITIVE_Y", e[e.TEXTURE_CUBE_MAP_NEGATIVE_Y = 34072] = "TEXTURE_CUBE_MAP_NEGATIVE_Y", e[e.TEXTURE_CUBE_MAP_POSITIVE_Z = 34073] = "TEXTURE_CUBE_MAP_POSITIVE_Z", e[e.TEXTURE_CUBE_MAP_NEGATIVE_Z = 34074] = "TEXTURE_CUBE_MAP_NEGATIVE_Z", e[e.MAX_CUBE_MAP_TEXTURE_SIZE = 34076] = "MAX_CUBE_MAP_TEXTURE_SIZE", e[e.TEXTURE0 = 33984] = "TEXTURE0", e[e.ACTIVE_TEXTURE = 34016] = "ACTIVE_TEXTURE", e[e.REPEAT = 10497] = "REPEAT", e[e.CLAMP_TO_EDGE = 33071] = "CLAMP_TO_EDGE", e[e.MIRRORED_REPEAT = 33648] = "MIRRORED_REPEAT", e[e.TEXTURE_WIDTH = 4096] = "TEXTURE_WIDTH", e[e.TEXTURE_HEIGHT = 4097] = "TEXTURE_HEIGHT", e[e.FLOAT_VEC2 = 35664] = "FLOAT_VEC2", e[e.FLOAT_VEC3 = 35665] = "FLOAT_VEC3", e[e.FLOAT_VEC4 = 35666] = "FLOAT_VEC4", e[e.INT_VEC2 = 35667] = "INT_VEC2", e[e.INT_VEC3 = 35668] = "INT_VEC3", e[e.INT_VEC4 = 35669] = "INT_VEC4", e[e.BOOL = 35670] = "BOOL", e[e.BOOL_VEC2 = 35671] = "BOOL_VEC2", e[e.BOOL_VEC3 = 35672] = "BOOL_VEC3", e[e.BOOL_VEC4 = 35673] = "BOOL_VEC4", e[e.FLOAT_MAT2 = 35674] = "FLOAT_MAT2", e[e.FLOAT_MAT3 = 35675] = "FLOAT_MAT3", e[e.FLOAT_MAT4 = 35676] = "FLOAT_MAT4", e[e.SAMPLER_2D = 35678] = "SAMPLER_2D", e[e.SAMPLER_CUBE = 35680] = "SAMPLER_CUBE", e[e.LOW_FLOAT = 36336] = "LOW_FLOAT", e[e.MEDIUM_FLOAT = 36337] = "MEDIUM_FLOAT", e[e.HIGH_FLOAT = 36338] = "HIGH_FLOAT", e[e.LOW_INT = 36339] = "LOW_INT", e[e.MEDIUM_INT = 36340] = "MEDIUM_INT", e[e.HIGH_INT = 36341] = "HIGH_INT", e[e.FRAMEBUFFER = 36160] = "FRAMEBUFFER", e[e.RENDERBUFFER = 36161] = "RENDERBUFFER", e[e.RGBA4 = 32854] = "RGBA4", e[e.RGB5_A1 = 32855] = "RGB5_A1", e[e.RGB565 = 36194] = "RGB565", e[e.DEPTH_COMPONENT16 = 33189] = "DEPTH_COMPONENT16", e[e.STENCIL_INDEX = 6401] = "STENCIL_INDEX", e[e.STENCIL_INDEX8 = 36168] = "STENCIL_INDEX8", e[e.DEPTH_STENCIL = 34041] = "DEPTH_STENCIL", e[e.RENDERBUFFER_WIDTH = 36162] = "RENDERBUFFER_WIDTH", e[e.RENDERBUFFER_HEIGHT = 36163] = "RENDERBUFFER_HEIGHT", e[e.RENDERBUFFER_INTERNAL_FORMAT = 36164] = "RENDERBUFFER_INTERNAL_FORMAT", e[e.RENDERBUFFER_RED_SIZE = 36176] = "RENDERBUFFER_RED_SIZE", e[e.RENDERBUFFER_GREEN_SIZE = 36177] = "RENDERBUFFER_GREEN_SIZE", e[e.RENDERBUFFER_BLUE_SIZE = 36178] = "RENDERBUFFER_BLUE_SIZE", e[e.RENDERBUFFER_ALPHA_SIZE = 36179] = "RENDERBUFFER_ALPHA_SIZE", e[e.RENDERBUFFER_DEPTH_SIZE = 36180] = "RENDERBUFFER_DEPTH_SIZE", e[e.RENDERBUFFER_STENCIL_SIZE = 36181] = "RENDERBUFFER_STENCIL_SIZE", e[e.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE = 36048] = "FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE", e[e.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME = 36049] = "FRAMEBUFFER_ATTACHMENT_OBJECT_NAME", e[e.FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL = 36050] = "FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL", e[e.FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE = 36051] = "FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE", e[e.COLOR_ATTACHMENT0 = 36064] = "COLOR_ATTACHMENT0", e[e.DEPTH_ATTACHMENT = 36096] = "DEPTH_ATTACHMENT", e[e.STENCIL_ATTACHMENT = 36128] = "STENCIL_ATTACHMENT", e[e.DEPTH_STENCIL_ATTACHMENT = 33306] = "DEPTH_STENCIL_ATTACHMENT", e[e.NONE = 0] = "NONE", e[e.FRAMEBUFFER_COMPLETE = 36053] = "FRAMEBUFFER_COMPLETE", e[e.FRAMEBUFFER_INCOMPLETE_ATTACHMENT = 36054] = "FRAMEBUFFER_INCOMPLETE_ATTACHMENT", e[e.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = 36055] = "FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT", e[e.FRAMEBUFFER_INCOMPLETE_DIMENSIONS = 36057] = "FRAMEBUFFER_INCOMPLETE_DIMENSIONS", e[e.FRAMEBUFFER_UNSUPPORTED = 36061] = "FRAMEBUFFER_UNSUPPORTED", e[e.FRAMEBUFFER_BINDING = 36006] = "FRAMEBUFFER_BINDING", e[e.RENDERBUFFER_BINDING = 36007] = "RENDERBUFFER_BINDING", e[e.READ_FRAMEBUFFER = 36008] = "READ_FRAMEBUFFER", e[e.DRAW_FRAMEBUFFER = 36009] = "DRAW_FRAMEBUFFER", e[e.MAX_RENDERBUFFER_SIZE = 34024] = "MAX_RENDERBUFFER_SIZE", e[e.INVALID_FRAMEBUFFER_OPERATION = 1286] = "INVALID_FRAMEBUFFER_OPERATION", e[e.UNPACK_FLIP_Y_WEBGL = 37440] = "UNPACK_FLIP_Y_WEBGL", e[e.UNPACK_PREMULTIPLY_ALPHA_WEBGL = 37441] = "UNPACK_PREMULTIPLY_ALPHA_WEBGL", e[e.UNPACK_COLORSPACE_CONVERSION_WEBGL = 37443] = "UNPACK_COLORSPACE_CONVERSION_WEBGL", e[e.READ_BUFFER = 3074] = "READ_BUFFER", e[e.UNPACK_ROW_LENGTH = 3314] = "UNPACK_ROW_LENGTH", e[e.UNPACK_SKIP_ROWS = 3315] = "UNPACK_SKIP_ROWS", e[e.UNPACK_SKIP_PIXELS = 3316] = "UNPACK_SKIP_PIXELS", e[e.PACK_ROW_LENGTH = 3330] = "PACK_ROW_LENGTH", e[e.PACK_SKIP_ROWS = 3331] = "PACK_SKIP_ROWS", e[e.PACK_SKIP_PIXELS = 3332] = "PACK_SKIP_PIXELS", e[e.TEXTURE_BINDING_3D = 32874] = "TEXTURE_BINDING_3D", e[e.UNPACK_SKIP_IMAGES = 32877] = "UNPACK_SKIP_IMAGES", e[e.UNPACK_IMAGE_HEIGHT = 32878] = "UNPACK_IMAGE_HEIGHT", e[e.MAX_3D_TEXTURE_SIZE = 32883] = "MAX_3D_TEXTURE_SIZE", e[e.MAX_ELEMENTS_VERTICES = 33e3] = "MAX_ELEMENTS_VERTICES", e[e.MAX_ELEMENTS_INDICES = 33001] = "MAX_ELEMENTS_INDICES", e[e.MAX_TEXTURE_LOD_BIAS = 34045] = "MAX_TEXTURE_LOD_BIAS", e[e.MAX_FRAGMENT_UNIFORM_COMPONENTS = 35657] = "MAX_FRAGMENT_UNIFORM_COMPONENTS", e[e.MAX_VERTEX_UNIFORM_COMPONENTS = 35658] = "MAX_VERTEX_UNIFORM_COMPONENTS", e[e.MAX_ARRAY_TEXTURE_LAYERS = 35071] = "MAX_ARRAY_TEXTURE_LAYERS", e[e.MIN_PROGRAM_TEXEL_OFFSET = 35076] = "MIN_PROGRAM_TEXEL_OFFSET", e[e.MAX_PROGRAM_TEXEL_OFFSET = 35077] = "MAX_PROGRAM_TEXEL_OFFSET", e[e.MAX_VARYING_COMPONENTS = 35659] = "MAX_VARYING_COMPONENTS", e[e.FRAGMENT_SHADER_DERIVATIVE_HINT = 35723] = "FRAGMENT_SHADER_DERIVATIVE_HINT", e[e.RASTERIZER_DISCARD = 35977] = "RASTERIZER_DISCARD", e[e.VERTEX_ARRAY_BINDING = 34229] = "VERTEX_ARRAY_BINDING", e[e.MAX_VERTEX_OUTPUT_COMPONENTS = 37154] = "MAX_VERTEX_OUTPUT_COMPONENTS", e[e.MAX_FRAGMENT_INPUT_COMPONENTS = 37157] = "MAX_FRAGMENT_INPUT_COMPONENTS", e[e.MAX_SERVER_WAIT_TIMEOUT = 37137] = "MAX_SERVER_WAIT_TIMEOUT", e[e.MAX_ELEMENT_INDEX = 36203] = "MAX_ELEMENT_INDEX", e[e.RED = 6403] = "RED", e[e.RGB8 = 32849] = "RGB8", e[e.RGBA8 = 32856] = "RGBA8", e[e.RGB10_A2 = 32857] = "RGB10_A2", e[e.TEXTURE_3D = 32879] = "TEXTURE_3D", e[e.TEXTURE_WRAP_R = 32882] = "TEXTURE_WRAP_R", e[e.TEXTURE_MIN_LOD = 33082] = "TEXTURE_MIN_LOD", e[e.TEXTURE_MAX_LOD = 33083] = "TEXTURE_MAX_LOD", e[e.TEXTURE_BASE_LEVEL = 33084] = "TEXTURE_BASE_LEVEL", e[e.TEXTURE_MAX_LEVEL = 33085] = "TEXTURE_MAX_LEVEL", e[e.TEXTURE_COMPARE_MODE = 34892] = "TEXTURE_COMPARE_MODE", e[e.TEXTURE_COMPARE_FUNC = 34893] = "TEXTURE_COMPARE_FUNC", e[e.SRGB = 35904] = "SRGB", e[e.SRGB8 = 35905] = "SRGB8", e[e.SRGB8_ALPHA8 = 35907] = "SRGB8_ALPHA8", e[e.COMPARE_REF_TO_TEXTURE = 34894] = "COMPARE_REF_TO_TEXTURE", e[e.RGBA32F = 34836] = "RGBA32F", e[e.RGB32F = 34837] = "RGB32F", e[e.RGBA16F = 34842] = "RGBA16F", e[e.RGB16F = 34843] = "RGB16F", e[e.TEXTURE_2D_ARRAY = 35866] = "TEXTURE_2D_ARRAY", e[e.TEXTURE_BINDING_2D_ARRAY = 35869] = "TEXTURE_BINDING_2D_ARRAY", e[e.R11F_G11F_B10F = 35898] = "R11F_G11F_B10F", e[e.RGB9_E5 = 35901] = "RGB9_E5", e[e.RGBA32UI = 36208] = "RGBA32UI", e[e.RGB32UI = 36209] = "RGB32UI", e[e.RGBA16UI = 36214] = "RGBA16UI", e[e.RGB16UI = 36215] = "RGB16UI", e[e.RGBA8UI = 36220] = "RGBA8UI", e[e.RGB8UI = 36221] = "RGB8UI", e[e.RGBA32I = 36226] = "RGBA32I", e[e.RGB32I = 36227] = "RGB32I", e[e.RGBA16I = 36232] = "RGBA16I", e[e.RGB16I = 36233] = "RGB16I", e[e.RGBA8I = 36238] = "RGBA8I", e[e.RGB8I = 36239] = "RGB8I", e[e.RED_INTEGER = 36244] = "RED_INTEGER", e[e.RGB_INTEGER = 36248] = "RGB_INTEGER", e[e.RGBA_INTEGER = 36249] = "RGBA_INTEGER", e[e.R8 = 33321] = "R8", e[e.RG8 = 33323] = "RG8", e[e.R16F = 33325] = "R16F", e[e.R32F = 33326] = "R32F", e[e.RG16F = 33327] = "RG16F", e[e.RG32F = 33328] = "RG32F", e[e.R8I = 33329] = "R8I", e[e.R8UI = 33330] = "R8UI", e[e.R16I = 33331] = "R16I", e[e.R16UI = 33332] = "R16UI", e[e.R32I = 33333] = "R32I", e[e.R32UI = 33334] = "R32UI", e[e.RG8I = 33335] = "RG8I", e[e.RG8UI = 33336] = "RG8UI", e[e.RG16I = 33337] = "RG16I", e[e.RG16UI = 33338] = "RG16UI", e[e.RG32I = 33339] = "RG32I", e[e.RG32UI = 33340] = "RG32UI", e[e.R8_SNORM = 36756] = "R8_SNORM", e[e.RG8_SNORM = 36757] = "RG8_SNORM", e[e.RGB8_SNORM = 36758] = "RGB8_SNORM", e[e.RGBA8_SNORM = 36759] = "RGBA8_SNORM", e[e.RGB10_A2UI = 36975] = "RGB10_A2UI", e[e.TEXTURE_IMMUTABLE_FORMAT = 37167] = "TEXTURE_IMMUTABLE_FORMAT", e[e.TEXTURE_IMMUTABLE_LEVELS = 33503] = "TEXTURE_IMMUTABLE_LEVELS", e[e.UNSIGNED_INT_2_10_10_10_REV = 33640] = "UNSIGNED_INT_2_10_10_10_REV", e[e.UNSIGNED_INT_10F_11F_11F_REV = 35899] = "UNSIGNED_INT_10F_11F_11F_REV", e[e.UNSIGNED_INT_5_9_9_9_REV = 35902] = "UNSIGNED_INT_5_9_9_9_REV", e[e.FLOAT_32_UNSIGNED_INT_24_8_REV = 36269] = "FLOAT_32_UNSIGNED_INT_24_8_REV", e[e.UNSIGNED_INT_24_8 = 34042] = "UNSIGNED_INT_24_8", e[e.HALF_FLOAT = 5131] = "HALF_FLOAT", e[e.RG = 33319] = "RG", e[e.RG_INTEGER = 33320] = "RG_INTEGER", e[e.INT_2_10_10_10_REV = 36255] = "INT_2_10_10_10_REV", e[e.CURRENT_QUERY = 34917] = "CURRENT_QUERY", e[e.QUERY_RESULT = 34918] = "QUERY_RESULT", e[e.QUERY_RESULT_AVAILABLE = 34919] = "QUERY_RESULT_AVAILABLE", e[e.ANY_SAMPLES_PASSED = 35887] = "ANY_SAMPLES_PASSED", e[e.ANY_SAMPLES_PASSED_CONSERVATIVE = 36202] = "ANY_SAMPLES_PASSED_CONSERVATIVE", e[e.MAX_DRAW_BUFFERS = 34852] = "MAX_DRAW_BUFFERS", e[e.DRAW_BUFFER0 = 34853] = "DRAW_BUFFER0", e[e.DRAW_BUFFER1 = 34854] = "DRAW_BUFFER1", e[e.DRAW_BUFFER2 = 34855] = "DRAW_BUFFER2", e[e.DRAW_BUFFER3 = 34856] = "DRAW_BUFFER3", e[e.DRAW_BUFFER4 = 34857] = "DRAW_BUFFER4", e[e.DRAW_BUFFER5 = 34858] = "DRAW_BUFFER5", e[e.DRAW_BUFFER6 = 34859] = "DRAW_BUFFER6", e[e.DRAW_BUFFER7 = 34860] = "DRAW_BUFFER7", e[e.DRAW_BUFFER8 = 34861] = "DRAW_BUFFER8", e[e.DRAW_BUFFER9 = 34862] = "DRAW_BUFFER9", e[e.DRAW_BUFFER10 = 34863] = "DRAW_BUFFER10", e[e.DRAW_BUFFER11 = 34864] = "DRAW_BUFFER11", e[e.DRAW_BUFFER12 = 34865] = "DRAW_BUFFER12", e[e.DRAW_BUFFER13 = 34866] = "DRAW_BUFFER13", e[e.DRAW_BUFFER14 = 34867] = "DRAW_BUFFER14", e[e.DRAW_BUFFER15 = 34868] = "DRAW_BUFFER15", e[e.MAX_COLOR_ATTACHMENTS = 36063] = "MAX_COLOR_ATTACHMENTS", e[e.COLOR_ATTACHMENT1 = 36065] = "COLOR_ATTACHMENT1", e[e.COLOR_ATTACHMENT2 = 36066] = "COLOR_ATTACHMENT2", e[e.COLOR_ATTACHMENT3 = 36067] = "COLOR_ATTACHMENT3", e[e.COLOR_ATTACHMENT4 = 36068] = "COLOR_ATTACHMENT4", e[e.COLOR_ATTACHMENT5 = 36069] = "COLOR_ATTACHMENT5", e[e.COLOR_ATTACHMENT6 = 36070] = "COLOR_ATTACHMENT6", e[e.COLOR_ATTACHMENT7 = 36071] = "COLOR_ATTACHMENT7", e[e.COLOR_ATTACHMENT8 = 36072] = "COLOR_ATTACHMENT8", e[e.COLOR_ATTACHMENT9 = 36073] = "COLOR_ATTACHMENT9", e[e.COLOR_ATTACHMENT10 = 36074] = "COLOR_ATTACHMENT10", e[e.COLOR_ATTACHMENT11 = 36075] = "COLOR_ATTACHMENT11", e[e.COLOR_ATTACHMENT12 = 36076] = "COLOR_ATTACHMENT12", e[e.COLOR_ATTACHMENT13 = 36077] = "COLOR_ATTACHMENT13", e[e.COLOR_ATTACHMENT14 = 36078] = "COLOR_ATTACHMENT14", e[e.COLOR_ATTACHMENT15 = 36079] = "COLOR_ATTACHMENT15", e[e.SAMPLER_3D = 35679] = "SAMPLER_3D", e[e.SAMPLER_2D_SHADOW = 35682] = "SAMPLER_2D_SHADOW", e[e.SAMPLER_2D_ARRAY = 36289] = "SAMPLER_2D_ARRAY", e[e.SAMPLER_2D_ARRAY_SHADOW = 36292] = "SAMPLER_2D_ARRAY_SHADOW", e[e.SAMPLER_CUBE_SHADOW = 36293] = "SAMPLER_CUBE_SHADOW", e[e.INT_SAMPLER_2D = 36298] = "INT_SAMPLER_2D", e[e.INT_SAMPLER_3D = 36299] = "INT_SAMPLER_3D", e[e.INT_SAMPLER_CUBE = 36300] = "INT_SAMPLER_CUBE", e[e.INT_SAMPLER_2D_ARRAY = 36303] = "INT_SAMPLER_2D_ARRAY", e[e.UNSIGNED_INT_SAMPLER_2D = 36306] = "UNSIGNED_INT_SAMPLER_2D", e[e.UNSIGNED_INT_SAMPLER_3D = 36307] = "UNSIGNED_INT_SAMPLER_3D", e[e.UNSIGNED_INT_SAMPLER_CUBE = 36308] = "UNSIGNED_INT_SAMPLER_CUBE", e[e.UNSIGNED_INT_SAMPLER_2D_ARRAY = 36311] = "UNSIGNED_INT_SAMPLER_2D_ARRAY", e[e.MAX_SAMPLES = 36183] = "MAX_SAMPLES", e[e.SAMPLER_BINDING = 35097] = "SAMPLER_BINDING", e[e.PIXEL_PACK_BUFFER = 35051] = "PIXEL_PACK_BUFFER", e[e.PIXEL_UNPACK_BUFFER = 35052] = "PIXEL_UNPACK_BUFFER", e[e.PIXEL_PACK_BUFFER_BINDING = 35053] = "PIXEL_PACK_BUFFER_BINDING", e[e.PIXEL_UNPACK_BUFFER_BINDING = 35055] = "PIXEL_UNPACK_BUFFER_BINDING", e[e.COPY_READ_BUFFER = 36662] = "COPY_READ_BUFFER", e[e.COPY_WRITE_BUFFER = 36663] = "COPY_WRITE_BUFFER", e[e.COPY_READ_BUFFER_BINDING = 36662] = "COPY_READ_BUFFER_BINDING", e[e.COPY_WRITE_BUFFER_BINDING = 36663] = "COPY_WRITE_BUFFER_BINDING", e[e.FLOAT_MAT2x3 = 35685] = "FLOAT_MAT2x3", e[e.FLOAT_MAT2x4 = 35686] = "FLOAT_MAT2x4", e[e.FLOAT_MAT3x2 = 35687] = "FLOAT_MAT3x2", e[e.FLOAT_MAT3x4 = 35688] = "FLOAT_MAT3x4", e[e.FLOAT_MAT4x2 = 35689] = "FLOAT_MAT4x2", e[e.FLOAT_MAT4x3 = 35690] = "FLOAT_MAT4x3", e[e.UNSIGNED_INT_VEC2 = 36294] = "UNSIGNED_INT_VEC2", e[e.UNSIGNED_INT_VEC3 = 36295] = "UNSIGNED_INT_VEC3", e[e.UNSIGNED_INT_VEC4 = 36296] = "UNSIGNED_INT_VEC4", e[e.UNSIGNED_NORMALIZED = 35863] = "UNSIGNED_NORMALIZED", e[e.SIGNED_NORMALIZED = 36764] = "SIGNED_NORMALIZED", e[e.VERTEX_ATTRIB_ARRAY_INTEGER = 35069] = "VERTEX_ATTRIB_ARRAY_INTEGER", e[e.VERTEX_ATTRIB_ARRAY_DIVISOR = 35070] = "VERTEX_ATTRIB_ARRAY_DIVISOR", e[e.TRANSFORM_FEEDBACK_BUFFER_MODE = 35967] = "TRANSFORM_FEEDBACK_BUFFER_MODE", e[e.MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS = 35968] = "MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS", e[e.TRANSFORM_FEEDBACK_VARYINGS = 35971] = "TRANSFORM_FEEDBACK_VARYINGS", e[e.TRANSFORM_FEEDBACK_BUFFER_START = 35972] = "TRANSFORM_FEEDBACK_BUFFER_START", e[e.TRANSFORM_FEEDBACK_BUFFER_SIZE = 35973] = "TRANSFORM_FEEDBACK_BUFFER_SIZE", e[e.TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN = 35976] = "TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN", e[e.MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS = 35978] = "MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS", e[e.MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS = 35979] = "MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS", e[e.INTERLEAVED_ATTRIBS = 35980] = "INTERLEAVED_ATTRIBS", e[e.SEPARATE_ATTRIBS = 35981] = "SEPARATE_ATTRIBS", e[e.TRANSFORM_FEEDBACK_BUFFER = 35982] = "TRANSFORM_FEEDBACK_BUFFER", e[e.TRANSFORM_FEEDBACK_BUFFER_BINDING = 35983] = "TRANSFORM_FEEDBACK_BUFFER_BINDING", e[e.TRANSFORM_FEEDBACK = 36386] = "TRANSFORM_FEEDBACK", e[e.TRANSFORM_FEEDBACK_PAUSED = 36387] = "TRANSFORM_FEEDBACK_PAUSED", e[e.TRANSFORM_FEEDBACK_ACTIVE = 36388] = "TRANSFORM_FEEDBACK_ACTIVE", e[e.TRANSFORM_FEEDBACK_BINDING = 36389] = "TRANSFORM_FEEDBACK_BINDING", e[e.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING = 33296] = "FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING", e[e.FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE = 33297] = "FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE", e[e.FRAMEBUFFER_ATTACHMENT_RED_SIZE = 33298] = "FRAMEBUFFER_ATTACHMENT_RED_SIZE", e[e.FRAMEBUFFER_ATTACHMENT_GREEN_SIZE = 33299] = "FRAMEBUFFER_ATTACHMENT_GREEN_SIZE", e[e.FRAMEBUFFER_ATTACHMENT_BLUE_SIZE = 33300] = "FRAMEBUFFER_ATTACHMENT_BLUE_SIZE", e[e.FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE = 33301] = "FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE", e[e.FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE = 33302] = "FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE", e[e.FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE = 33303] = "FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE", e[e.FRAMEBUFFER_DEFAULT = 33304] = "FRAMEBUFFER_DEFAULT", e[e.DEPTH24_STENCIL8 = 35056] = "DEPTH24_STENCIL8", e[e.DRAW_FRAMEBUFFER_BINDING = 36006] = "DRAW_FRAMEBUFFER_BINDING", e[e.READ_FRAMEBUFFER_BINDING = 36010] = "READ_FRAMEBUFFER_BINDING", e[e.RENDERBUFFER_SAMPLES = 36011] = "RENDERBUFFER_SAMPLES", e[e.FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER = 36052] = "FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER", e[e.FRAMEBUFFER_INCOMPLETE_MULTISAMPLE = 36182] = "FRAMEBUFFER_INCOMPLETE_MULTISAMPLE", e[e.UNIFORM_BUFFER = 35345] = "UNIFORM_BUFFER", e[e.UNIFORM_BUFFER_BINDING = 35368] = "UNIFORM_BUFFER_BINDING", e[e.UNIFORM_BUFFER_START = 35369] = "UNIFORM_BUFFER_START", e[e.UNIFORM_BUFFER_SIZE = 35370] = "UNIFORM_BUFFER_SIZE", e[e.MAX_VERTEX_UNIFORM_BLOCKS = 35371] = "MAX_VERTEX_UNIFORM_BLOCKS", e[e.MAX_FRAGMENT_UNIFORM_BLOCKS = 35373] = "MAX_FRAGMENT_UNIFORM_BLOCKS", e[e.MAX_COMBINED_UNIFORM_BLOCKS = 35374] = "MAX_COMBINED_UNIFORM_BLOCKS", e[e.MAX_UNIFORM_BUFFER_BINDINGS = 35375] = "MAX_UNIFORM_BUFFER_BINDINGS", e[e.MAX_UNIFORM_BLOCK_SIZE = 35376] = "MAX_UNIFORM_BLOCK_SIZE", e[e.MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS = 35377] = "MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS", e[e.MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS = 35379] = "MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS", e[e.UNIFORM_BUFFER_OFFSET_ALIGNMENT = 35380] = "UNIFORM_BUFFER_OFFSET_ALIGNMENT", e[e.ACTIVE_UNIFORM_BLOCKS = 35382] = "ACTIVE_UNIFORM_BLOCKS", e[e.UNIFORM_TYPE = 35383] = "UNIFORM_TYPE", e[e.UNIFORM_SIZE = 35384] = "UNIFORM_SIZE", e[e.UNIFORM_BLOCK_INDEX = 35386] = "UNIFORM_BLOCK_INDEX", e[e.UNIFORM_OFFSET = 35387] = "UNIFORM_OFFSET", e[e.UNIFORM_ARRAY_STRIDE = 35388] = "UNIFORM_ARRAY_STRIDE", e[e.UNIFORM_MATRIX_STRIDE = 35389] = "UNIFORM_MATRIX_STRIDE", e[e.UNIFORM_IS_ROW_MAJOR = 35390] = "UNIFORM_IS_ROW_MAJOR", e[e.UNIFORM_BLOCK_BINDING = 35391] = "UNIFORM_BLOCK_BINDING", e[e.UNIFORM_BLOCK_DATA_SIZE = 35392] = "UNIFORM_BLOCK_DATA_SIZE", e[e.UNIFORM_BLOCK_ACTIVE_UNIFORMS = 35394] = "UNIFORM_BLOCK_ACTIVE_UNIFORMS", e[e.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES = 35395] = "UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES", e[e.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER = 35396] = "UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER", e[e.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER = 35398] = "UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER", e[e.OBJECT_TYPE = 37138] = "OBJECT_TYPE", e[e.SYNC_CONDITION = 37139] = "SYNC_CONDITION", e[e.SYNC_STATUS = 37140] = "SYNC_STATUS", e[e.SYNC_FLAGS = 37141] = "SYNC_FLAGS", e[e.SYNC_FENCE = 37142] = "SYNC_FENCE", e[e.SYNC_GPU_COMMANDS_COMPLETE = 37143] = "SYNC_GPU_COMMANDS_COMPLETE", e[e.UNSIGNALED = 37144] = "UNSIGNALED", e[e.SIGNALED = 37145] = "SIGNALED", e[e.ALREADY_SIGNALED = 37146] = "ALREADY_SIGNALED", e[e.TIMEOUT_EXPIRED = 37147] = "TIMEOUT_EXPIRED", e[e.CONDITION_SATISFIED = 37148] = "CONDITION_SATISFIED", e[e.WAIT_FAILED = 37149] = "WAIT_FAILED", e[e.SYNC_FLUSH_COMMANDS_BIT = 1] = "SYNC_FLUSH_COMMANDS_BIT", e[e.COLOR = 6144] = "COLOR", e[e.DEPTH = 6145] = "DEPTH", e[e.STENCIL = 6146] = "STENCIL", e[e.MIN = 32775] = "MIN", e[e.MAX = 32776] = "MAX", e[e.DEPTH_COMPONENT24 = 33190] = "DEPTH_COMPONENT24", e[e.STREAM_READ = 35041] = "STREAM_READ", e[e.STREAM_COPY = 35042] = "STREAM_COPY", e[e.STATIC_READ = 35045] = "STATIC_READ", e[e.STATIC_COPY = 35046] = "STATIC_COPY", e[e.DYNAMIC_READ = 35049] = "DYNAMIC_READ", e[e.DYNAMIC_COPY = 35050] = "DYNAMIC_COPY", e[e.DEPTH_COMPONENT32F = 36012] = "DEPTH_COMPONENT32F", e[e.DEPTH32F_STENCIL8 = 36013] = "DEPTH32F_STENCIL8", e[e.INVALID_INDEX = 4294967295] = "INVALID_INDEX", e[e.TIMEOUT_IGNORED = -1] = "TIMEOUT_IGNORED", e[e.MAX_CLIENT_WAIT_TIMEOUT_WEBGL = 37447] = "MAX_CLIENT_WAIT_TIMEOUT_WEBGL", e[e.UNMASKED_VENDOR_WEBGL = 37445] = "UNMASKED_VENDOR_WEBGL", e[e.UNMASKED_RENDERER_WEBGL = 37446] = "UNMASKED_RENDERER_WEBGL", e[e.MAX_TEXTURE_MAX_ANISOTROPY_EXT = 34047] = "MAX_TEXTURE_MAX_ANISOTROPY_EXT", e[e.TEXTURE_MAX_ANISOTROPY_EXT = 34046] = "TEXTURE_MAX_ANISOTROPY_EXT", e[e.R16_EXT = 33322] = "R16_EXT", e[e.RG16_EXT = 33324] = "RG16_EXT", e[e.RGB16_EXT = 32852] = "RGB16_EXT", e[e.RGBA16_EXT = 32859] = "RGBA16_EXT", e[e.R16_SNORM_EXT = 36760] = "R16_SNORM_EXT", e[e.RG16_SNORM_EXT = 36761] = "RG16_SNORM_EXT", e[e.RGB16_SNORM_EXT = 36762] = "RGB16_SNORM_EXT", e[e.RGBA16_SNORM_EXT = 36763] = "RGBA16_SNORM_EXT", e[e.COMPRESSED_RGB_S3TC_DXT1_EXT = 33776] = "COMPRESSED_RGB_S3TC_DXT1_EXT", e[e.COMPRESSED_RGBA_S3TC_DXT1_EXT = 33777] = "COMPRESSED_RGBA_S3TC_DXT1_EXT", e[e.COMPRESSED_RGBA_S3TC_DXT3_EXT = 33778] = "COMPRESSED_RGBA_S3TC_DXT3_EXT", e[e.COMPRESSED_RGBA_S3TC_DXT5_EXT = 33779] = "COMPRESSED_RGBA_S3TC_DXT5_EXT", e[e.COMPRESSED_SRGB_S3TC_DXT1_EXT = 35916] = "COMPRESSED_SRGB_S3TC_DXT1_EXT", e[e.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT = 35917] = "COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT", e[e.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT = 35918] = "COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT", e[e.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT = 35919] = "COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT", e[e.COMPRESSED_RED_RGTC1_EXT = 36283] = "COMPRESSED_RED_RGTC1_EXT", e[e.COMPRESSED_SIGNED_RED_RGTC1_EXT = 36284] = "COMPRESSED_SIGNED_RED_RGTC1_EXT", e[e.COMPRESSED_RED_GREEN_RGTC2_EXT = 36285] = "COMPRESSED_RED_GREEN_RGTC2_EXT", e[e.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT = 36286] = "COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT", e[e.COMPRESSED_RGBA_BPTC_UNORM_EXT = 36492] = "COMPRESSED_RGBA_BPTC_UNORM_EXT", e[e.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT = 36493] = "COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT", e[e.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT = 36494] = "COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT", e[e.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT = 36495] = "COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT", e[e.COMPRESSED_R11_EAC = 37488] = "COMPRESSED_R11_EAC", e[e.COMPRESSED_SIGNED_R11_EAC = 37489] = "COMPRESSED_SIGNED_R11_EAC", e[e.COMPRESSED_RG11_EAC = 37490] = "COMPRESSED_RG11_EAC", e[e.COMPRESSED_SIGNED_RG11_EAC = 37491] = "COMPRESSED_SIGNED_RG11_EAC", e[e.COMPRESSED_RGB8_ETC2 = 37492] = "COMPRESSED_RGB8_ETC2", e[e.COMPRESSED_RGBA8_ETC2_EAC = 37493] = "COMPRESSED_RGBA8_ETC2_EAC", e[e.COMPRESSED_SRGB8_ETC2 = 37494] = "COMPRESSED_SRGB8_ETC2", e[e.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC = 37495] = "COMPRESSED_SRGB8_ALPHA8_ETC2_EAC", e[e.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 37496] = "COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2", e[e.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 37497] = "COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2", e[e.COMPRESSED_RGB_PVRTC_4BPPV1_IMG = 35840] = "COMPRESSED_RGB_PVRTC_4BPPV1_IMG", e[e.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG = 35842] = "COMPRESSED_RGBA_PVRTC_4BPPV1_IMG", e[e.COMPRESSED_RGB_PVRTC_2BPPV1_IMG = 35841] = "COMPRESSED_RGB_PVRTC_2BPPV1_IMG", e[e.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG = 35843] = "COMPRESSED_RGBA_PVRTC_2BPPV1_IMG", e[e.COMPRESSED_RGB_ETC1_WEBGL = 36196] = "COMPRESSED_RGB_ETC1_WEBGL", e[e.COMPRESSED_RGB_ATC_WEBGL = 35986] = "COMPRESSED_RGB_ATC_WEBGL", e[e.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL = 35986] = "COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL", e[e.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL = 34798] = "COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL", e[e.COMPRESSED_RGBA_ASTC_4x4_KHR = 37808] = "COMPRESSED_RGBA_ASTC_4x4_KHR", e[e.COMPRESSED_RGBA_ASTC_5x4_KHR = 37809] = "COMPRESSED_RGBA_ASTC_5x4_KHR", e[e.COMPRESSED_RGBA_ASTC_5x5_KHR = 37810] = "COMPRESSED_RGBA_ASTC_5x5_KHR", e[e.COMPRESSED_RGBA_ASTC_6x5_KHR = 37811] = "COMPRESSED_RGBA_ASTC_6x5_KHR", e[e.COMPRESSED_RGBA_ASTC_6x6_KHR = 37812] = "COMPRESSED_RGBA_ASTC_6x6_KHR", e[e.COMPRESSED_RGBA_ASTC_8x5_KHR = 37813] = "COMPRESSED_RGBA_ASTC_8x5_KHR", e[e.COMPRESSED_RGBA_ASTC_8x6_KHR = 37814] = "COMPRESSED_RGBA_ASTC_8x6_KHR", e[e.COMPRESSED_RGBA_ASTC_8x8_KHR = 37815] = "COMPRESSED_RGBA_ASTC_8x8_KHR", e[e.COMPRESSED_RGBA_ASTC_10x5_KHR = 37816] = "COMPRESSED_RGBA_ASTC_10x5_KHR", e[e.COMPRESSED_RGBA_ASTC_10x6_KHR = 37817] = "COMPRESSED_RGBA_ASTC_10x6_KHR", e[e.COMPRESSED_RGBA_ASTC_10x8_KHR = 37818] = "COMPRESSED_RGBA_ASTC_10x8_KHR", e[e.COMPRESSED_RGBA_ASTC_10x10_KHR = 37819] = "COMPRESSED_RGBA_ASTC_10x10_KHR", e[e.COMPRESSED_RGBA_ASTC_12x10_KHR = 37820] = "COMPRESSED_RGBA_ASTC_12x10_KHR", e[e.COMPRESSED_RGBA_ASTC_12x12_KHR = 37821] = "COMPRESSED_RGBA_ASTC_12x12_KHR", e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR = 37840] = "COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR", e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR = 37841] = "COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR", e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR = 37842] = "COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR", e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR = 37843] = "COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR", e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR = 37844] = "COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR", e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR = 37845] = "COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR", e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR = 37846] = "COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR", e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR = 37847] = "COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR", e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR = 37848] = "COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR", e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR = 37849] = "COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR", e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR = 37850] = "COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR", e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR = 37851] = "COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR", e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR = 37852] = "COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR", e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR = 37853] = "COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR", e[e.QUERY_COUNTER_BITS_EXT = 34916] = "QUERY_COUNTER_BITS_EXT", e[e.CURRENT_QUERY_EXT = 34917] = "CURRENT_QUERY_EXT", e[e.QUERY_RESULT_EXT = 34918] = "QUERY_RESULT_EXT", e[e.QUERY_RESULT_AVAILABLE_EXT = 34919] = "QUERY_RESULT_AVAILABLE_EXT", e[e.TIME_ELAPSED_EXT = 35007] = "TIME_ELAPSED_EXT", e[e.TIMESTAMP_EXT = 36392] = "TIMESTAMP_EXT", e[e.GPU_DISJOINT_EXT = 36795] = "GPU_DISJOINT_EXT", e[e.COMPLETION_STATUS_KHR = 37297] = "COMPLETION_STATUS_KHR", e[e.DEPTH_CLAMP_EXT = 34383] = "DEPTH_CLAMP_EXT", e[e.FIRST_VERTEX_CONVENTION_WEBGL = 36429] = "FIRST_VERTEX_CONVENTION_WEBGL", e[e.LAST_VERTEX_CONVENTION_WEBGL = 36430] = "LAST_VERTEX_CONVENTION_WEBGL", e[e.PROVOKING_VERTEX_WEBL = 36431] = "PROVOKING_VERTEX_WEBL", e[e.POLYGON_MODE_WEBGL = 2880] = "POLYGON_MODE_WEBGL", e[e.POLYGON_OFFSET_LINE_WEBGL = 10754] = "POLYGON_OFFSET_LINE_WEBGL", e[e.LINE_WEBGL = 6913] = "LINE_WEBGL", e[e.FILL_WEBGL = 6914] = "FILL_WEBGL", e[e.MAX_CLIP_DISTANCES_WEBGL = 3378] = "MAX_CLIP_DISTANCES_WEBGL", e[e.MAX_CULL_DISTANCES_WEBGL = 33529] = "MAX_CULL_DISTANCES_WEBGL", e[e.MAX_COMBINED_CLIP_AND_CULL_DISTANCES_WEBGL = 33530] = "MAX_COMBINED_CLIP_AND_CULL_DISTANCES_WEBGL", e[e.CLIP_DISTANCE0_WEBGL = 12288] = "CLIP_DISTANCE0_WEBGL", e[e.CLIP_DISTANCE1_WEBGL = 12289] = "CLIP_DISTANCE1_WEBGL", e[e.CLIP_DISTANCE2_WEBGL = 12290] = "CLIP_DISTANCE2_WEBGL", e[e.CLIP_DISTANCE3_WEBGL = 12291] = "CLIP_DISTANCE3_WEBGL", e[e.CLIP_DISTANCE4_WEBGL = 12292] = "CLIP_DISTANCE4_WEBGL", e[e.CLIP_DISTANCE5_WEBGL = 12293] = "CLIP_DISTANCE5_WEBGL", e[e.CLIP_DISTANCE6_WEBGL = 12294] = "CLIP_DISTANCE6_WEBGL", e[e.CLIP_DISTANCE7_WEBGL = 12295] = "CLIP_DISTANCE7_WEBGL", e[e.POLYGON_OFFSET_CLAMP_EXT = 36379] = "POLYGON_OFFSET_CLAMP_EXT", e[e.LOWER_LEFT_EXT = 36001] = "LOWER_LEFT_EXT", e[e.UPPER_LEFT_EXT = 36002] = "UPPER_LEFT_EXT", e[e.NEGATIVE_ONE_TO_ONE_EXT = 37726] = "NEGATIVE_ONE_TO_ONE_EXT", e[e.ZERO_TO_ONE_EXT = 37727] = "ZERO_TO_ONE_EXT", e[e.CLIP_ORIGIN_EXT = 37724] = "CLIP_ORIGIN_EXT", e[e.CLIP_DEPTH_MODE_EXT = 37725] = "CLIP_DEPTH_MODE_EXT", e[e.SRC1_COLOR_WEBGL = 35065] = "SRC1_COLOR_WEBGL", e[e.SRC1_ALPHA_WEBGL = 34185] = "SRC1_ALPHA_WEBGL", e[e.ONE_MINUS_SRC1_COLOR_WEBGL = 35066] = "ONE_MINUS_SRC1_COLOR_WEBGL", e[e.ONE_MINUS_SRC1_ALPHA_WEBGL = 35067] = "ONE_MINUS_SRC1_ALPHA_WEBGL", e[e.MAX_DUAL_SOURCE_DRAW_BUFFERS_WEBGL = 35068] = "MAX_DUAL_SOURCE_DRAW_BUFFERS_WEBGL", e[e.MIRROR_CLAMP_TO_EDGE_EXT = 34627] = "MIRROR_CLAMP_TO_EDGE_EXT";
|
|
70
|
-
})(
|
|
71
|
-
const
|
|
72
|
+
})(L || (L = {}));
|
|
73
|
+
const K = 1e-3, H = 64, Fe = 4, q = 2;
|
|
72
74
|
class Ee {
|
|
73
75
|
constructor() {
|
|
74
|
-
this.pointsTextureSize = 0, this.linksTextureSize = 0, this.alpha = 1, this.transform = V.create(), this.screenSize = [0, 0], this.mousePosition = [0, 0], this.screenMousePosition = [0, 0], this.selectedArea = [[0, 0], [0, 0]], this.isSimulationRunning = !1, this.simulationProgress = 0, this.selectedIndices = null, this.maxPointSize = H, this.hoveredPoint = void 0, this.focusedPoint = void 0, this.draggingPointIndex = void 0, this.hoveredLinkIndex = void 0, this.adjustedSpaceSize =
|
|
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 = f.spaceSize, this.isSpaceKeyPressed = !1, this.webglMaxTextureSize = 16384, this.hoveredPointRingColor = [1, 1, 1, me], this.focusedPointRingColor = [1, 1, 1, Ie], this.hoveredLinkColor = [-1, -1, -1, -1], this.greyoutPointColor = [-1, -1, -1, -1], this.isDarkenGreyout = !1, this.isLinkHoveringEnabled = !1, this.alphaTarget = 0, this.scalePointX = j(), this.scalePointY = j(), this.random = new he(), this._backgroundColor = [0, 0, 0, 0], this.alphaDecay = (t) => 1 - Math.pow(K, 1 / t);
|
|
75
77
|
}
|
|
76
78
|
get backgroundColor() {
|
|
77
79
|
return this._backgroundColor;
|
|
@@ -192,7 +194,7 @@ class Ee {
|
|
|
192
194
|
}
|
|
193
195
|
set backgroundColor(t) {
|
|
194
196
|
this._backgroundColor = t;
|
|
195
|
-
const i =
|
|
197
|
+
const i = Oe(t[0], t[1], t[2]);
|
|
196
198
|
document.documentElement.style.setProperty("--cosmosgl-attribution-color", i > 0.65 ? "black" : "white"), document.documentElement.style.setProperty("--cosmosgl-error-message-color", i > 0.65 ? "black" : "white"), this.div && (this.div.style.backgroundColor = `rgba(${t[0] * 255}, ${t[1] * 255}, ${t[2] * 255}, ${t[3]})`), this.isDarkenGreyout = i < 0.65;
|
|
197
199
|
}
|
|
198
200
|
addRandomSeed(t) {
|
|
@@ -207,7 +209,7 @@ class Ee {
|
|
|
207
209
|
* Ensures `spaceSize` is always a positive number >= 2 (required for Math.log2).
|
|
208
210
|
*/
|
|
209
211
|
adjustSpaceSize(t, i) {
|
|
210
|
-
(t <= 0 || !isFinite(t)) && (console.error(`Invalid spaceSize value: ${t}. Using default value of ${
|
|
212
|
+
(t <= 0 || !isFinite(t)) && (console.error(`Invalid spaceSize value: ${t}. Using default value of ${f.spaceSize}`), t = f.spaceSize);
|
|
211
213
|
const o = 2;
|
|
212
214
|
if (t < o && (console.warn(`spaceSize (${t}) is too small. Using minimum value of ${o}`), t = o), !Number.isFinite(i) || i <= 0 || i < o) {
|
|
213
215
|
console.warn(`Invalid webglMaxTextureSize: ${i}. Using configSpaceSize without WebGL limit adjustment.`), this.adjustedSpaceSize = t;
|
|
@@ -232,11 +234,11 @@ class Ee {
|
|
|
232
234
|
return this.scalePointY(t);
|
|
233
235
|
}
|
|
234
236
|
setHoveredPointRingColor(t) {
|
|
235
|
-
const i =
|
|
237
|
+
const i = z(t);
|
|
236
238
|
this.hoveredPointRingColor[0] = i[0], this.hoveredPointRingColor[1] = i[1], this.hoveredPointRingColor[2] = i[2];
|
|
237
239
|
}
|
|
238
240
|
setFocusedPointRingColor(t) {
|
|
239
|
-
const i =
|
|
241
|
+
const i = z(t);
|
|
240
242
|
this.focusedPointRingColor[0] = i[0], this.focusedPointRingColor[1] = i[1], this.focusedPointRingColor[2] = i[2];
|
|
241
243
|
}
|
|
242
244
|
setGreyoutPointColor(t) {
|
|
@@ -244,7 +246,7 @@ class Ee {
|
|
|
244
246
|
this.greyoutPointColor = [-1, -1, -1, -1];
|
|
245
247
|
return;
|
|
246
248
|
}
|
|
247
|
-
const i =
|
|
249
|
+
const i = z(t);
|
|
248
250
|
this.greyoutPointColor[0] = i[0], this.greyoutPointColor[1] = i[1], this.greyoutPointColor[2] = i[2], this.greyoutPointColor[3] = i[3];
|
|
249
251
|
}
|
|
250
252
|
updateLinkHoveringEnabled(t) {
|
|
@@ -255,7 +257,7 @@ class Ee {
|
|
|
255
257
|
this.hoveredLinkColor = [-1, -1, -1, -1];
|
|
256
258
|
return;
|
|
257
259
|
}
|
|
258
|
-
const i =
|
|
260
|
+
const i = z(t);
|
|
259
261
|
this.hoveredLinkColor[0] = i[0], this.hoveredLinkColor[1] = i[1], this.hoveredLinkColor[2] = i[2], this.hoveredLinkColor[3] = i[3];
|
|
260
262
|
}
|
|
261
263
|
setFocusedPoint(t) {
|
|
@@ -265,13 +267,13 @@ class Ee {
|
|
|
265
267
|
return (this.alphaTarget - this.alpha) * this.alphaDecay(t);
|
|
266
268
|
}
|
|
267
269
|
}
|
|
268
|
-
const
|
|
269
|
-
function
|
|
270
|
+
const Ne = (e) => typeof e == "function", ie = (e) => Array.isArray(e), Me = (e) => e instanceof Object, De = (e) => e instanceof Object ? e.constructor.name !== "Function" && e.constructor.name !== "Object" : !1, Q = (e) => Me(e) && !ie(e) && !Ne(e) && !De(e);
|
|
271
|
+
function z(e) {
|
|
270
272
|
let t;
|
|
271
|
-
if (
|
|
273
|
+
if (ie(e))
|
|
272
274
|
t = e;
|
|
273
275
|
else {
|
|
274
|
-
const i =
|
|
276
|
+
const i = le(e), o = i == null ? void 0 : i.rgb();
|
|
275
277
|
t = [(o == null ? void 0 : o.r) || 0, (o == null ? void 0 : o.g) || 0, (o == null ? void 0 : o.b) || 0, (i == null ? void 0 : i.opacity) ?? 1];
|
|
276
278
|
}
|
|
277
279
|
return [
|
|
@@ -281,10 +283,10 @@ function k(e) {
|
|
|
281
283
|
t[3]
|
|
282
284
|
];
|
|
283
285
|
}
|
|
284
|
-
function
|
|
286
|
+
function Oe(e, t, i) {
|
|
285
287
|
return 0.2126 * e + 0.7152 * t + 0.0722 * i;
|
|
286
288
|
}
|
|
287
|
-
function
|
|
289
|
+
function y(e, t, i = 0, o = 0, s, n) {
|
|
288
290
|
return e.readPixelsToArrayWebGL(t, {
|
|
289
291
|
sourceX: i,
|
|
290
292
|
sourceY: o,
|
|
@@ -295,7 +297,7 @@ function N(e, t, i = 0, o = 0, s, n) {
|
|
|
295
297
|
function $(e, t) {
|
|
296
298
|
switch (e.info.type) {
|
|
297
299
|
case "webgl": {
|
|
298
|
-
const i = e.gl.getParameter(
|
|
300
|
+
const i = e.gl.getParameter(L.ALIASED_POINT_SIZE_RANGE);
|
|
299
301
|
return ((i == null ? void 0 : i[1]) ?? H) / t;
|
|
300
302
|
}
|
|
301
303
|
case "webgpu":
|
|
@@ -304,14 +306,14 @@ function $(e, t) {
|
|
|
304
306
|
return H / t;
|
|
305
307
|
}
|
|
306
308
|
}
|
|
307
|
-
function
|
|
309
|
+
function Ue(e, t, i) {
|
|
308
310
|
return Math.min(Math.max(e, t), i);
|
|
309
311
|
}
|
|
310
|
-
function
|
|
312
|
+
function M(e) {
|
|
311
313
|
return e != null && !Number.isNaN(e);
|
|
312
314
|
}
|
|
313
|
-
function
|
|
314
|
-
return
|
|
315
|
+
function Be(e, t) {
|
|
316
|
+
return ce.sanitize(e, {
|
|
315
317
|
// Default configuration: allow common safe HTML elements and attributes
|
|
316
318
|
ALLOWED_TAGS: ["a", "b", "i", "em", "strong", "span", "div", "p", "br"],
|
|
317
319
|
ALLOWED_ATTR: ["href", "target", "class", "id", "style"],
|
|
@@ -319,9 +321,9 @@ function Ue(e, t) {
|
|
|
319
321
|
...t
|
|
320
322
|
});
|
|
321
323
|
}
|
|
322
|
-
class
|
|
324
|
+
class ke {
|
|
323
325
|
constructor() {
|
|
324
|
-
this.enableSimulation =
|
|
326
|
+
this.enableSimulation = f.enableSimulation, this.backgroundColor = te, this.spaceSize = f.spaceSize, this.pointDefaultColor = Te, this.pointGreyoutOpacity = ge, this.pointGreyoutColor = Y, this.pointDefaultSize = Pe, this.pointOpacity = Ce, this.pointSizeScale = f.pointSizeScale, this.hoveredPointCursor = f.hoveredPointCursor, this.hoveredLinkCursor = f.hoveredLinkCursor, this.renderHoveredPointRing = f.renderHoveredPointRing, this.hoveredPointRingColor = f.hoveredPointRingColor, this.focusedPointRingColor = f.focusedPointRingColor, this.focusedPointIndex = f.focusedPointIndex, this.linkDefaultColor = Re, this.linkOpacity = ve, this.linkGreyoutOpacity = xe, this.linkDefaultWidth = Ae, this.linkWidthScale = f.linkWidthScale, this.hoveredLinkColor = f.hoveredLinkColor, this.hoveredLinkWidthIncrease = f.hoveredLinkWidthIncrease, this.renderLinks = f.renderLinks, this.curvedLinks = f.curvedLinks, this.curvedLinkSegments = f.curvedLinkSegments, this.curvedLinkWeight = f.curvedLinkWeight, this.curvedLinkControlPointDistance = f.curvedLinkControlPointDistance, this.linkDefaultArrows = f.linkArrows, this.linkArrowsSizeScale = f.linkArrowsSizeScale, this.scaleLinksOnZoom = f.scaleLinksOnZoom, this.linkVisibilityDistanceRange = f.linkVisibilityDistanceRange, this.linkVisibilityMinTransparency = f.linkVisibilityMinTransparency, this.simulationDecay = f.simulation.decay, this.simulationGravity = f.simulation.gravity, this.simulationCenter = f.simulation.center, this.simulationRepulsion = f.simulation.repulsion, this.simulationRepulsionTheta = f.simulation.repulsionTheta, this.simulationLinkSpring = f.simulation.linkSpring, this.simulationLinkDistance = f.simulation.linkDistance, this.simulationLinkDistRandomVariationRange = f.simulation.linkDistRandomVariationRange, this.simulationRepulsionFromMouse = f.simulation.repulsionFromMouse, this.enableRightClickRepulsion = f.enableRightClickRepulsion, this.simulationFriction = f.simulation.friction, this.simulationCluster = f.simulation.cluster, this.onSimulationStart = void 0, this.onSimulationTick = void 0, this.onSimulationEnd = void 0, this.onSimulationPause = void 0, this.onSimulationUnpause = void 0, this.onClick = void 0, this.onPointClick = void 0, this.onLinkClick = void 0, this.onBackgroundClick = void 0, this.onContextMenu = void 0, this.onPointContextMenu = void 0, this.onLinkContextMenu = void 0, this.onBackgroundContextMenu = void 0, this.onMouseMove = void 0, this.onPointMouseOver = void 0, this.onPointMouseOut = void 0, this.onLinkMouseOver = void 0, this.onLinkMouseOut = void 0, this.onZoomStart = void 0, this.onZoom = void 0, this.onZoomEnd = void 0, this.onDragStart = void 0, this.onDrag = void 0, this.onDragEnd = void 0, this.showFPSMonitor = f.showFPSMonitor, this.pixelRatio = f.pixelRatio, this.scalePointsOnZoom = f.scalePointsOnZoom, this.initialZoomLevel = void 0, this.enableZoom = f.enableZoom, this.enableSimulationDuringZoom = f.enableSimulationDuringZoom, this.enableDrag = f.enableDrag, this.fitViewOnInit = f.fitViewOnInit, this.fitViewDelay = f.fitViewDelay, this.fitViewPadding = f.fitViewPadding, this.fitViewDuration = f.fitViewDuration, this.fitViewByPointsInRect = void 0, this.fitViewByPointIndices = void 0, this.randomSeed = void 0, this.pointSamplingDistance = f.pointSamplingDistance, this.linkSamplingDistance = f.linkSamplingDistance, this.attribution = f.attribution, this.rescalePositions = f.rescalePositions;
|
|
325
327
|
}
|
|
326
328
|
init(t) {
|
|
327
329
|
Object.keys(t).forEach((i) => {
|
|
@@ -376,7 +378,7 @@ void main() {
|
|
|
376
378
|
gl_Position = vec4(0.0, 0.0, 0.0, 1.0);
|
|
377
379
|
gl_PointSize = 1.0;
|
|
378
380
|
}
|
|
379
|
-
`,
|
|
381
|
+
`, we = `#version 300 es
|
|
380
382
|
precision highp float;
|
|
381
383
|
|
|
382
384
|
uniform sampler2D positionsTexture;
|
|
@@ -422,11 +424,11 @@ function X(e) {
|
|
|
422
424
|
}
|
|
423
425
|
return t;
|
|
424
426
|
}
|
|
425
|
-
function
|
|
426
|
-
const i =
|
|
427
|
+
function g(e, t) {
|
|
428
|
+
const i = re.getInfo(e);
|
|
427
429
|
return t * (i.bytesPerPixel ?? 0);
|
|
428
430
|
}
|
|
429
|
-
const
|
|
431
|
+
const D = `#version 300 es
|
|
430
432
|
#ifdef GL_ES
|
|
431
433
|
precision highp float;
|
|
432
434
|
#endif
|
|
@@ -440,7 +442,7 @@ void main() {
|
|
|
440
442
|
gl_Position = vec4(vertexCoord, 0, 1);
|
|
441
443
|
}
|
|
442
444
|
`;
|
|
443
|
-
class
|
|
445
|
+
class Ve extends w {
|
|
444
446
|
create() {
|
|
445
447
|
var s;
|
|
446
448
|
const { device: t, store: i } = this, { pointsTextureSize: o } = i;
|
|
@@ -452,7 +454,7 @@ class we extends w {
|
|
|
452
454
|
usage: C.SAMPLE | C.RENDER | C.COPY_DST
|
|
453
455
|
})), this.centermassTexture.copyImageData({
|
|
454
456
|
data: new Float32Array(4).fill(0),
|
|
455
|
-
bytesPerRow:
|
|
457
|
+
bytesPerRow: g("rgba32float", 1),
|
|
456
458
|
mipLevel: 0,
|
|
457
459
|
x: 0,
|
|
458
460
|
y: 0
|
|
@@ -490,7 +492,7 @@ class we extends w {
|
|
|
490
492
|
alpha: "f32"
|
|
491
493
|
}
|
|
492
494
|
}
|
|
493
|
-
})), this.calculateCentermassCommand || (this.calculateCentermassCommand = new
|
|
495
|
+
})), this.calculateCentermassCommand || (this.calculateCentermassCommand = new v(t, {
|
|
494
496
|
fs: be,
|
|
495
497
|
vs: ze,
|
|
496
498
|
topology: "point-list",
|
|
@@ -520,9 +522,9 @@ class we extends w {
|
|
|
520
522
|
depthWriteEnabled: !1,
|
|
521
523
|
depthCompare: "always"
|
|
522
524
|
}
|
|
523
|
-
})), this.calculateCentermassCommand.setVertexCount(this.data.pointsNumber ?? 0), this.runCommand || (this.runCommand = new
|
|
524
|
-
fs:
|
|
525
|
-
vs:
|
|
525
|
+
})), this.calculateCentermassCommand.setVertexCount(this.data.pointsNumber ?? 0), this.runCommand || (this.runCommand = new v(t, {
|
|
526
|
+
fs: we,
|
|
527
|
+
vs: D,
|
|
526
528
|
topology: "triangle-strip",
|
|
527
529
|
vertexCount: 4,
|
|
528
530
|
attributes: {
|
|
@@ -583,7 +585,7 @@ class we extends w {
|
|
|
583
585
|
(t = this.calculateCentermassCommand) == null || t.destroy(), this.calculateCentermassCommand = void 0, (i = this.runCommand) == null || i.destroy(), this.runCommand = void 0, this.centermassFbo && !this.centermassFbo.destroyed && this.centermassFbo.destroy(), this.centermassFbo = void 0, this.centermassTexture && !this.centermassTexture.destroyed && this.centermassTexture.destroy(), this.centermassTexture = void 0, (o = this.calculateUniformStore) == null || o.destroy(), this.calculateUniformStore = void 0, (s = this.forceUniformStore) == null || s.destroy(), this.forceUniformStore = void 0, this.pointIndices && !this.pointIndices.destroyed && this.pointIndices.destroy(), this.pointIndices = void 0, this.forceVertexCoordBuffer && !this.forceVertexCoordBuffer.destroyed && this.forceVertexCoordBuffer.destroy(), this.forceVertexCoordBuffer = void 0, this.previousPointsTextureSize = void 0;
|
|
584
586
|
}
|
|
585
587
|
}
|
|
586
|
-
const
|
|
588
|
+
const He = `#version 300 es
|
|
587
589
|
precision highp float;
|
|
588
590
|
|
|
589
591
|
uniform sampler2D positionsTexture;
|
|
@@ -623,7 +625,7 @@ void main() {
|
|
|
623
625
|
|
|
624
626
|
fragColor = velocity;
|
|
625
627
|
}`;
|
|
626
|
-
class
|
|
628
|
+
class Xe extends w {
|
|
627
629
|
initPrograms() {
|
|
628
630
|
const { device: t, points: i, store: o } = this;
|
|
629
631
|
!i || !o.pointsTextureSize || (this.vertexCoordBuffer || (this.vertexCoordBuffer = t.createBuffer({
|
|
@@ -636,9 +638,9 @@ class He extends w {
|
|
|
636
638
|
alpha: "f32"
|
|
637
639
|
}
|
|
638
640
|
}
|
|
639
|
-
})), this.runCommand || (this.runCommand = new
|
|
640
|
-
fs:
|
|
641
|
-
vs:
|
|
641
|
+
})), this.runCommand || (this.runCommand = new v(t, {
|
|
642
|
+
fs: He,
|
|
643
|
+
vs: D,
|
|
642
644
|
topology: "triangle-strip",
|
|
643
645
|
vertexCount: 4,
|
|
644
646
|
attributes: {
|
|
@@ -689,7 +691,7 @@ class He extends w {
|
|
|
689
691
|
(t = this.runCommand) == null || t.destroy(), this.runCommand = void 0, (i = this.uniformStore) == null || i.destroy(), this.uniformStore = void 0, this.vertexCoordBuffer && !this.vertexCoordBuffer.destroyed && this.vertexCoordBuffer.destroy(), this.vertexCoordBuffer = void 0;
|
|
690
692
|
}
|
|
691
693
|
}
|
|
692
|
-
function
|
|
694
|
+
function We(e) {
|
|
693
695
|
return `#version 300 es
|
|
694
696
|
precision highp float;
|
|
695
697
|
|
|
@@ -778,13 +780,13 @@ void main() {
|
|
|
778
780
|
}
|
|
779
781
|
`;
|
|
780
782
|
}
|
|
781
|
-
function
|
|
783
|
+
function T(e, t) {
|
|
782
784
|
return !e || e.length !== 2 ? t : [e[0], e[1]];
|
|
783
785
|
}
|
|
784
|
-
function
|
|
786
|
+
function m(e, t) {
|
|
785
787
|
return !e || e.length !== 4 ? t : [e[0], e[1], e[2], e[3]];
|
|
786
788
|
}
|
|
787
|
-
var
|
|
789
|
+
var Z = /* @__PURE__ */ ((e) => (e.OUTGOING = "outgoing", e.INCOMING = "incoming", e))(Z || {});
|
|
788
790
|
class J extends w {
|
|
789
791
|
constructor() {
|
|
790
792
|
super(...arguments), this.linkFirstIndicesAndAmount = new Float32Array(), this.indices = new Float32Array(), this.maxPointDegree = 0;
|
|
@@ -794,19 +796,19 @@ class J extends w {
|
|
|
794
796
|
const { device: i, store: { pointsTextureSize: o, linksTextureSize: s }, data: n } = this;
|
|
795
797
|
if (!o || !s) return;
|
|
796
798
|
this.linkFirstIndicesAndAmount = new Float32Array(o * o * 4), this.indices = new Float32Array(s * s * 4);
|
|
797
|
-
const r = new Float32Array(s * s * 4), a = new Float32Array(s * s * 4),
|
|
799
|
+
const r = new Float32Array(s * s * 4), a = new Float32Array(s * s * 4), d = t === "incoming" ? n.sourceIndexToTargetIndices : n.targetIndexToSourceIndices;
|
|
798
800
|
this.maxPointDegree = 0;
|
|
799
|
-
let
|
|
800
|
-
|
|
801
|
-
u && (this.linkFirstIndicesAndAmount[_ * 4 + 0] =
|
|
802
|
-
var O, B,
|
|
803
|
-
this.indices[
|
|
804
|
-
const
|
|
805
|
-
let
|
|
806
|
-
|
|
801
|
+
let l = 0;
|
|
802
|
+
d == null || d.forEach((u, _) => {
|
|
803
|
+
u && (this.linkFirstIndicesAndAmount[_ * 4 + 0] = l % s, this.linkFirstIndicesAndAmount[_ * 4 + 1] = Math.floor(l / s), this.linkFirstIndicesAndAmount[_ * 4 + 2] = u.length ?? 0, u.forEach(([R, I]) => {
|
|
804
|
+
var O, B, k;
|
|
805
|
+
this.indices[l * 4 + 0] = R % o, this.indices[l * 4 + 1] = Math.floor(R / o);
|
|
806
|
+
const P = ((O = n.degree) == null ? void 0 : O[R]) ?? 0, A = ((B = n.degree) == null ? void 0 : B[_]) ?? 0, F = P + A, U = F !== 0 ? P / F : 0.5, E = Math.min(P, A);
|
|
807
|
+
let N = ((k = n.linkStrength) == null ? void 0 : k[I]) ?? 1 / Math.max(E, 1);
|
|
808
|
+
N = Math.sqrt(N), r[l * 4 + 0] = U, r[l * 4 + 1] = N, a[l * 4] = this.store.getRandomFloat(0, 1), l += 1;
|
|
807
809
|
}), this.maxPointDegree = Math.max(this.maxPointDegree, u.length ?? 0));
|
|
808
810
|
});
|
|
809
|
-
const c = !this.linkFirstIndicesAndAmountTexture || this.linkFirstIndicesAndAmountTexture.width !== o || this.linkFirstIndicesAndAmountTexture.height !== o,
|
|
811
|
+
const c = !this.linkFirstIndicesAndAmountTexture || this.linkFirstIndicesAndAmountTexture.width !== o || this.linkFirstIndicesAndAmountTexture.height !== o, h = !this.indicesTexture || this.indicesTexture.width !== s || this.indicesTexture.height !== s;
|
|
810
812
|
c && (this.linkFirstIndicesAndAmountTexture && !this.linkFirstIndicesAndAmountTexture.destroyed && this.linkFirstIndicesAndAmountTexture.destroy(), this.linkFirstIndicesAndAmountTexture = i.createTexture({
|
|
811
813
|
width: o,
|
|
812
814
|
height: o,
|
|
@@ -814,11 +816,11 @@ class J extends w {
|
|
|
814
816
|
usage: C.SAMPLE | C.COPY_DST
|
|
815
817
|
})), this.linkFirstIndicesAndAmountTexture.copyImageData({
|
|
816
818
|
data: this.linkFirstIndicesAndAmount,
|
|
817
|
-
bytesPerRow:
|
|
819
|
+
bytesPerRow: g("rgba32float", o),
|
|
818
820
|
mipLevel: 0,
|
|
819
821
|
x: 0,
|
|
820
822
|
y: 0
|
|
821
|
-
}),
|
|
823
|
+
}), h && (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({
|
|
822
824
|
width: s,
|
|
823
825
|
height: s,
|
|
824
826
|
format: "rgba32float",
|
|
@@ -835,19 +837,19 @@ class J extends w {
|
|
|
835
837
|
usage: C.SAMPLE | C.COPY_DST
|
|
836
838
|
})), this.indicesTexture.copyImageData({
|
|
837
839
|
data: this.indices,
|
|
838
|
-
bytesPerRow:
|
|
840
|
+
bytesPerRow: g("rgba32float", s),
|
|
839
841
|
mipLevel: 0,
|
|
840
842
|
x: 0,
|
|
841
843
|
y: 0
|
|
842
844
|
}), this.biasAndStrengthTexture.copyImageData({
|
|
843
845
|
data: r,
|
|
844
|
-
bytesPerRow:
|
|
846
|
+
bytesPerRow: g("rgba32float", s),
|
|
845
847
|
mipLevel: 0,
|
|
846
848
|
x: 0,
|
|
847
849
|
y: 0
|
|
848
850
|
}), this.randomDistanceTexture.copyImageData({
|
|
849
851
|
data: a,
|
|
850
|
-
bytesPerRow:
|
|
852
|
+
bytesPerRow: g("rgba32float", s),
|
|
851
853
|
mipLevel: 0,
|
|
852
854
|
x: 0,
|
|
853
855
|
y: 0
|
|
@@ -868,9 +870,9 @@ class J extends w {
|
|
|
868
870
|
alpha: "f32"
|
|
869
871
|
}
|
|
870
872
|
}
|
|
871
|
-
})), this.runCommand || (this.runCommand = new
|
|
872
|
-
fs:
|
|
873
|
-
vs:
|
|
873
|
+
})), this.runCommand || (this.runCommand = new v(t, {
|
|
874
|
+
fs: We(this.maxPointDegree),
|
|
875
|
+
vs: D,
|
|
874
876
|
topology: "triangle-strip",
|
|
875
877
|
vertexCount: 4,
|
|
876
878
|
attributes: {
|
|
@@ -902,7 +904,7 @@ class J extends w {
|
|
|
902
904
|
forceLinkUniforms: {
|
|
903
905
|
linkSpring: this.config.simulationLinkSpring ?? 0,
|
|
904
906
|
linkDistance: this.config.simulationLinkDistance ?? 0,
|
|
905
|
-
linkDistRandomVariationRange:
|
|
907
|
+
linkDistRandomVariationRange: T(this.config.simulationLinkDistRandomVariationRange, [0, 0]),
|
|
906
908
|
pointsTextureSize: i.pointsTextureSize,
|
|
907
909
|
linksTextureSize: i.linksTextureSize,
|
|
908
910
|
alpha: i.alpha
|
|
@@ -929,7 +931,7 @@ class J extends w {
|
|
|
929
931
|
(t = this.runCommand) == null || t.destroy(), this.runCommand = void 0, this.linkFirstIndicesAndAmountTexture && !this.linkFirstIndicesAndAmountTexture.destroyed && this.linkFirstIndicesAndAmountTexture.destroy(), this.linkFirstIndicesAndAmountTexture = void 0, this.indicesTexture && !this.indicesTexture.destroyed && this.indicesTexture.destroy(), this.indicesTexture = void 0, this.biasAndStrengthTexture && !this.biasAndStrengthTexture.destroyed && this.biasAndStrengthTexture.destroy(), this.biasAndStrengthTexture = void 0, this.randomDistanceTexture && !this.randomDistanceTexture.destroyed && this.randomDistanceTexture.destroy(), this.randomDistanceTexture = void 0, (i = this.uniformStore) == null || i.destroy(), this.uniformStore = void 0, this.vertexCoordBuffer && !this.vertexCoordBuffer.destroyed && this.vertexCoordBuffer.destroy(), this.vertexCoordBuffer = void 0;
|
|
930
932
|
}
|
|
931
933
|
}
|
|
932
|
-
const
|
|
934
|
+
const Ye = `#version 300 es
|
|
933
935
|
precision highp float;
|
|
934
936
|
|
|
935
937
|
in vec4 vColor;
|
|
@@ -937,7 +939,7 @@ out vec4 fragColor;
|
|
|
937
939
|
|
|
938
940
|
void main() {
|
|
939
941
|
fragColor = vColor;
|
|
940
|
-
}`,
|
|
942
|
+
}`, Le = `#version 300 es
|
|
941
943
|
precision highp float;
|
|
942
944
|
|
|
943
945
|
uniform sampler2D positionsTexture;
|
|
@@ -1171,7 +1173,7 @@ void main() {
|
|
|
1171
1173
|
|
|
1172
1174
|
fragColor = velocity;
|
|
1173
1175
|
}`;
|
|
1174
|
-
class
|
|
1176
|
+
class je extends w {
|
|
1175
1177
|
constructor() {
|
|
1176
1178
|
super(...arguments), this.levels = 0, this.levelTargets = /* @__PURE__ */ new Map();
|
|
1177
1179
|
}
|
|
@@ -1181,40 +1183,40 @@ class Le extends w {
|
|
|
1181
1183
|
if (!i.pointsTextureSize) return;
|
|
1182
1184
|
this.levels = Math.log2(i.adjustedSpaceSize);
|
|
1183
1185
|
for (let a = 0; a < this.levels; a += 1) {
|
|
1184
|
-
const
|
|
1185
|
-
if (
|
|
1186
|
-
|
|
1187
|
-
data: new Float32Array(
|
|
1188
|
-
bytesPerRow:
|
|
1186
|
+
const d = Math.pow(2, a + 1), l = this.levelTargets.get(a);
|
|
1187
|
+
if (l && l.texture.width === d && l.texture.height === d) {
|
|
1188
|
+
l.texture.copyImageData({
|
|
1189
|
+
data: new Float32Array(d * d * 4).fill(0),
|
|
1190
|
+
bytesPerRow: g("rgba32float", d),
|
|
1189
1191
|
mipLevel: 0,
|
|
1190
1192
|
x: 0,
|
|
1191
1193
|
y: 0
|
|
1192
1194
|
});
|
|
1193
1195
|
continue;
|
|
1194
1196
|
}
|
|
1195
|
-
|
|
1197
|
+
l && (l.fbo.destroyed || l.fbo.destroy(), l.texture.destroyed || l.texture.destroy());
|
|
1196
1198
|
const c = t.createTexture({
|
|
1197
|
-
width:
|
|
1198
|
-
height:
|
|
1199
|
+
width: d,
|
|
1200
|
+
height: d,
|
|
1199
1201
|
format: "rgba32float",
|
|
1200
1202
|
usage: C.SAMPLE | C.RENDER | C.COPY_DST
|
|
1201
1203
|
});
|
|
1202
1204
|
c.copyImageData({
|
|
1203
|
-
data: new Float32Array(
|
|
1204
|
-
bytesPerRow:
|
|
1205
|
+
data: new Float32Array(d * d * 4).fill(0),
|
|
1206
|
+
bytesPerRow: g("rgba32float", d),
|
|
1205
1207
|
mipLevel: 0,
|
|
1206
1208
|
x: 0,
|
|
1207
1209
|
y: 0
|
|
1208
1210
|
});
|
|
1209
|
-
const
|
|
1210
|
-
width:
|
|
1211
|
-
height:
|
|
1211
|
+
const h = t.createFramebuffer({
|
|
1212
|
+
width: d,
|
|
1213
|
+
height: d,
|
|
1212
1214
|
colorAttachments: [c]
|
|
1213
1215
|
});
|
|
1214
|
-
this.levelTargets.set(a, { texture: c, fbo:
|
|
1216
|
+
this.levelTargets.set(a, { texture: c, fbo: h });
|
|
1215
1217
|
}
|
|
1216
|
-
for (const [a,
|
|
1217
|
-
a >= this.levels && (
|
|
1218
|
+
for (const [a, d] of Array.from(this.levelTargets.entries()))
|
|
1219
|
+
a >= this.levels && (d.fbo.destroyed || d.fbo.destroy(), d.texture.destroyed || d.texture.destroy(), this.levelTargets.delete(a));
|
|
1218
1220
|
const o = i.pointsTextureSize * i.pointsTextureSize, s = new Float32Array(o * 4);
|
|
1219
1221
|
for (let a = 0; a < o; ++a)
|
|
1220
1222
|
s[a * 4] = i.getRandomFloat(-1, 1) * 1e-5, s[a * 4 + 1] = i.getRandomFloat(-1, 1) * 1e-5;
|
|
@@ -1225,7 +1227,7 @@ class Le extends w {
|
|
|
1225
1227
|
usage: C.SAMPLE | C.COPY_DST
|
|
1226
1228
|
})), this.randomValuesTexture.copyImageData({
|
|
1227
1229
|
data: s,
|
|
1228
|
-
bytesPerRow:
|
|
1230
|
+
bytesPerRow: g("rgba32float", i.pointsTextureSize),
|
|
1229
1231
|
mipLevel: 0,
|
|
1230
1232
|
x: 0,
|
|
1231
1233
|
y: 0
|
|
@@ -1256,9 +1258,9 @@ class Le extends w {
|
|
|
1256
1258
|
cellSize: 0
|
|
1257
1259
|
}
|
|
1258
1260
|
}
|
|
1259
|
-
})), this.calculateLevelsCommand || (this.calculateLevelsCommand = new
|
|
1260
|
-
fs:
|
|
1261
|
-
vs:
|
|
1261
|
+
})), this.calculateLevelsCommand || (this.calculateLevelsCommand = new v(t, {
|
|
1262
|
+
fs: Ye,
|
|
1263
|
+
vs: Le,
|
|
1262
1264
|
topology: "point-list",
|
|
1263
1265
|
vertexCount: o.pointsNumber,
|
|
1264
1266
|
attributes: {
|
|
@@ -1310,9 +1312,9 @@ class Le extends w {
|
|
|
1310
1312
|
}
|
|
1311
1313
|
})), this.forceVertexCoordBuffer || (this.forceVertexCoordBuffer = t.createBuffer({
|
|
1312
1314
|
data: new Float32Array([-1, -1, 1, -1, -1, 1, 1, 1])
|
|
1313
|
-
})), this.forceCommand || (this.forceCommand = new
|
|
1315
|
+
})), this.forceCommand || (this.forceCommand = new v(t, {
|
|
1314
1316
|
fs: Ke,
|
|
1315
|
-
vs:
|
|
1317
|
+
vs: D,
|
|
1316
1318
|
topology: "triangle-strip",
|
|
1317
1319
|
vertexCount: 4,
|
|
1318
1320
|
attributes: {
|
|
@@ -1354,9 +1356,9 @@ class Le extends w {
|
|
|
1354
1356
|
repulsion: this.config.simulationRepulsion ?? 0
|
|
1355
1357
|
}
|
|
1356
1358
|
}
|
|
1357
|
-
})), this.forceFromItsOwnCentermassCommand || (this.forceFromItsOwnCentermassCommand = new
|
|
1359
|
+
})), this.forceFromItsOwnCentermassCommand || (this.forceFromItsOwnCentermassCommand = new v(t, {
|
|
1358
1360
|
fs: Ze,
|
|
1359
|
-
vs:
|
|
1361
|
+
vs: D,
|
|
1360
1362
|
topology: "triangle-strip",
|
|
1361
1363
|
vertexCount: 4,
|
|
1362
1364
|
attributes: {
|
|
@@ -1410,21 +1412,21 @@ class Le extends w {
|
|
|
1410
1412
|
for (let n = 0; n < this.levels; n += 1) {
|
|
1411
1413
|
const r = this.levelTargets.get(n);
|
|
1412
1414
|
if (!r || r.fbo.destroyed || r.texture.destroyed) continue;
|
|
1413
|
-
const a = Math.pow(2, n + 1),
|
|
1415
|
+
const a = Math.pow(2, n + 1), d = (i.adjustedSpaceSize ?? 0) / a;
|
|
1414
1416
|
this.calculateLevelsUniformStore.setUniforms({
|
|
1415
1417
|
calculateLevelsUniforms: {
|
|
1416
1418
|
pointsTextureSize: i.pointsTextureSize ?? 0,
|
|
1417
1419
|
levelTextureSize: a,
|
|
1418
|
-
cellSize:
|
|
1420
|
+
cellSize: d
|
|
1419
1421
|
}
|
|
1420
1422
|
}), this.calculateLevelsCommand.setVertexCount(o.pointsNumber), this.calculateLevelsCommand.setBindings({
|
|
1421
1423
|
positionsTexture: s.previousPositionTexture
|
|
1422
1424
|
});
|
|
1423
|
-
const
|
|
1425
|
+
const l = t.beginRenderPass({
|
|
1424
1426
|
framebuffer: r.fbo,
|
|
1425
1427
|
clearColor: [0, 0, 0, 0]
|
|
1426
1428
|
});
|
|
1427
|
-
this.calculateLevelsCommand.draw(
|
|
1429
|
+
this.calculateLevelsCommand.draw(l), l.end();
|
|
1428
1430
|
}
|
|
1429
1431
|
}
|
|
1430
1432
|
drawForces() {
|
|
@@ -1466,7 +1468,7 @@ class Le extends w {
|
|
|
1466
1468
|
s.end();
|
|
1467
1469
|
}
|
|
1468
1470
|
}
|
|
1469
|
-
const
|
|
1471
|
+
const qe = `#version 300 es
|
|
1470
1472
|
precision highp float;
|
|
1471
1473
|
|
|
1472
1474
|
uniform sampler2D positionsTexture;
|
|
@@ -1501,7 +1503,7 @@ void main() {
|
|
|
1501
1503
|
|
|
1502
1504
|
fragColor = velocity;
|
|
1503
1505
|
}`;
|
|
1504
|
-
class
|
|
1506
|
+
class Qe extends w {
|
|
1505
1507
|
initPrograms() {
|
|
1506
1508
|
const { device: t, points: i } = this;
|
|
1507
1509
|
i && (this.vertexCoordBuffer || (this.vertexCoordBuffer = t.createBuffer({
|
|
@@ -1513,9 +1515,9 @@ class qe extends w {
|
|
|
1513
1515
|
mousePos: "vec2<f32>"
|
|
1514
1516
|
}
|
|
1515
1517
|
}
|
|
1516
|
-
})), this.runCommand || (this.runCommand = new
|
|
1517
|
-
fs:
|
|
1518
|
-
vs:
|
|
1518
|
+
})), this.runCommand || (this.runCommand = new v(t, {
|
|
1519
|
+
fs: qe,
|
|
1520
|
+
vs: D,
|
|
1519
1521
|
topology: "triangle-strip",
|
|
1520
1522
|
vertexCount: 4,
|
|
1521
1523
|
attributes: {
|
|
@@ -1545,7 +1547,7 @@ class qe extends w {
|
|
|
1545
1547
|
this.uniformStore.setUniforms({
|
|
1546
1548
|
forceMouseUniforms: {
|
|
1547
1549
|
repulsion: this.config.simulationRepulsionFromMouse ?? 0,
|
|
1548
|
-
mousePos:
|
|
1550
|
+
mousePos: T(o.mousePosition, [0, 0])
|
|
1549
1551
|
}
|
|
1550
1552
|
}), this.runCommand.setBindings({
|
|
1551
1553
|
positionsTexture: i.previousPositionTexture
|
|
@@ -1565,7 +1567,7 @@ class qe extends w {
|
|
|
1565
1567
|
(t = this.runCommand) == null || t.destroy(), this.runCommand = void 0, (i = this.uniformStore) == null || i.destroy(), this.uniformStore = void 0, this.vertexCoordBuffer && !this.vertexCoordBuffer.destroyed && this.vertexCoordBuffer.destroy(), this.vertexCoordBuffer = void 0;
|
|
1566
1568
|
}
|
|
1567
1569
|
}
|
|
1568
|
-
const
|
|
1570
|
+
const $e = `#version 300 es
|
|
1569
1571
|
#ifdef GL_ES
|
|
1570
1572
|
precision highp float;
|
|
1571
1573
|
#endif
|
|
@@ -1576,7 +1578,7 @@ out vec4 fragColor;
|
|
|
1576
1578
|
|
|
1577
1579
|
void main() {
|
|
1578
1580
|
fragColor = rgba;
|
|
1579
|
-
}`,
|
|
1581
|
+
}`, Je = `#version 300 es
|
|
1580
1582
|
#ifdef GL_ES
|
|
1581
1583
|
precision highp float;
|
|
1582
1584
|
#endif
|
|
@@ -1614,7 +1616,7 @@ void main() {
|
|
|
1614
1616
|
gl_Position = vec4(xy, 0.0, 1.0);
|
|
1615
1617
|
gl_PointSize = 1.0;
|
|
1616
1618
|
}
|
|
1617
|
-
`,
|
|
1619
|
+
`, Ge = `#version 300 es
|
|
1618
1620
|
#ifdef GL_ES
|
|
1619
1621
|
precision highp float;
|
|
1620
1622
|
#endif
|
|
@@ -1669,19 +1671,19 @@ void main() {
|
|
|
1669
1671
|
|
|
1670
1672
|
fragColor = velocity;
|
|
1671
1673
|
}`;
|
|
1672
|
-
class
|
|
1674
|
+
class et extends w {
|
|
1673
1675
|
create() {
|
|
1674
|
-
var
|
|
1676
|
+
var h, p;
|
|
1675
1677
|
const { device: t, store: i, data: o } = this, { pointsTextureSize: s } = i;
|
|
1676
1678
|
if (o.pointsNumber === void 0 || !o.pointClusters && !o.clusterPositions) return;
|
|
1677
1679
|
this.clusterCount = (o.pointClusters ?? []).reduce((u, _) => _ === void 0 || _ < 0 ? u : Math.max(u, _), 0) + 1, this.clustersTextureSize = Math.ceil(Math.sqrt(this.clusterCount));
|
|
1678
|
-
const n = this.previousPointsTextureSize !== s || this.previousClustersTextureSize !== this.clustersTextureSize || this.previousClusterCount !== this.clusterCount, r = s * s * 4, a = this.clustersTextureSize * this.clustersTextureSize * 4,
|
|
1680
|
+
const n = this.previousPointsTextureSize !== s || this.previousClustersTextureSize !== this.clustersTextureSize || this.previousClusterCount !== this.clusterCount, r = s * s * 4, a = this.clustersTextureSize * this.clustersTextureSize * 4, d = new Float32Array(r), l = new Float32Array(a).fill(-1), c = new Float32Array(r).fill(1);
|
|
1679
1681
|
if (o.clusterPositions)
|
|
1680
1682
|
for (let u = 0; u < this.clusterCount; ++u)
|
|
1681
|
-
|
|
1683
|
+
l[u * 4 + 0] = o.clusterPositions[u * 2 + 0] ?? -1, l[u * 4 + 1] = o.clusterPositions[u * 2 + 1] ?? -1;
|
|
1682
1684
|
for (let u = 0; u < o.pointsNumber; ++u) {
|
|
1683
|
-
const _ = (
|
|
1684
|
-
_ === void 0 ? (
|
|
1685
|
+
const _ = (h = o.pointClusters) == null ? void 0 : h[u];
|
|
1686
|
+
_ === void 0 ? (d[u * 4 + 0] = -1, d[u * 4 + 1] = -1) : (d[u * 4 + 0] = _ % this.clustersTextureSize, d[u * 4 + 1] = Math.floor(_ / this.clustersTextureSize)), o.clusterStrength && (c[u * 4 + 0] = o.clusterStrength[u] ?? 1);
|
|
1685
1687
|
}
|
|
1686
1688
|
if (!this.clusterTexture || n ? (this.clusterTexture && !this.clusterTexture.destroyed && this.clusterTexture.destroy(), this.clusterTexture = t.createTexture({
|
|
1687
1689
|
width: s,
|
|
@@ -1689,14 +1691,14 @@ class Ge extends w {
|
|
|
1689
1691
|
format: "rgba32float",
|
|
1690
1692
|
usage: C.SAMPLE | C.RENDER | C.COPY_DST
|
|
1691
1693
|
}), this.clusterTexture.copyImageData({
|
|
1692
|
-
data:
|
|
1693
|
-
bytesPerRow:
|
|
1694
|
+
data: d,
|
|
1695
|
+
bytesPerRow: g("rgba32float", s),
|
|
1694
1696
|
mipLevel: 0,
|
|
1695
1697
|
x: 0,
|
|
1696
1698
|
y: 0
|
|
1697
1699
|
})) : this.clusterTexture.copyImageData({
|
|
1698
|
-
data:
|
|
1699
|
-
bytesPerRow:
|
|
1700
|
+
data: d,
|
|
1701
|
+
bytesPerRow: g("rgba32float", s),
|
|
1700
1702
|
mipLevel: 0,
|
|
1701
1703
|
x: 0,
|
|
1702
1704
|
y: 0
|
|
@@ -1706,14 +1708,14 @@ class Ge extends w {
|
|
|
1706
1708
|
format: "rgba32float",
|
|
1707
1709
|
usage: C.SAMPLE | C.RENDER | C.COPY_DST
|
|
1708
1710
|
}), this.clusterPositionsTexture.copyImageData({
|
|
1709
|
-
data:
|
|
1710
|
-
bytesPerRow:
|
|
1711
|
+
data: l,
|
|
1712
|
+
bytesPerRow: g("rgba32float", this.clustersTextureSize),
|
|
1711
1713
|
mipLevel: 0,
|
|
1712
1714
|
x: 0,
|
|
1713
1715
|
y: 0
|
|
1714
1716
|
})) : this.clusterPositionsTexture.copyImageData({
|
|
1715
|
-
data:
|
|
1716
|
-
bytesPerRow:
|
|
1717
|
+
data: l,
|
|
1718
|
+
bytesPerRow: g("rgba32float", this.clustersTextureSize),
|
|
1717
1719
|
mipLevel: 0,
|
|
1718
1720
|
x: 0,
|
|
1719
1721
|
y: 0
|
|
@@ -1724,13 +1726,13 @@ class Ge extends w {
|
|
|
1724
1726
|
usage: C.SAMPLE | C.RENDER | C.COPY_DST
|
|
1725
1727
|
}), this.clusterForceCoefficientTexture.copyImageData({
|
|
1726
1728
|
data: c,
|
|
1727
|
-
bytesPerRow:
|
|
1729
|
+
bytesPerRow: g("rgba32float", s),
|
|
1728
1730
|
mipLevel: 0,
|
|
1729
1731
|
x: 0,
|
|
1730
1732
|
y: 0
|
|
1731
1733
|
})) : this.clusterForceCoefficientTexture.copyImageData({
|
|
1732
1734
|
data: c,
|
|
1733
|
-
bytesPerRow:
|
|
1735
|
+
bytesPerRow: g("rgba32float", s),
|
|
1734
1736
|
mipLevel: 0,
|
|
1735
1737
|
x: 0,
|
|
1736
1738
|
y: 0
|
|
@@ -1741,7 +1743,7 @@ class Ge extends w {
|
|
|
1741
1743
|
usage: C.SAMPLE | C.RENDER | C.COPY_DST
|
|
1742
1744
|
}), this.centermassTexture.copyImageData({
|
|
1743
1745
|
data: new Float32Array(a).fill(0),
|
|
1744
|
-
bytesPerRow:
|
|
1746
|
+
bytesPerRow: g("rgba32float", this.clustersTextureSize),
|
|
1745
1747
|
mipLevel: 0,
|
|
1746
1748
|
x: 0,
|
|
1747
1749
|
y: 0
|
|
@@ -1751,7 +1753,7 @@ class Ge extends w {
|
|
|
1751
1753
|
colorAttachments: [this.centermassTexture]
|
|
1752
1754
|
})) : this.centermassTexture.copyImageData({
|
|
1753
1755
|
data: new Float32Array(a).fill(0),
|
|
1754
|
-
bytesPerRow:
|
|
1756
|
+
bytesPerRow: g("rgba32float", this.clustersTextureSize),
|
|
1755
1757
|
mipLevel: 0,
|
|
1756
1758
|
x: 0,
|
|
1757
1759
|
y: 0
|
|
@@ -1780,9 +1782,9 @@ class Ge extends w {
|
|
|
1780
1782
|
clustersTextureSize: this.clustersTextureSize ?? 0
|
|
1781
1783
|
}
|
|
1782
1784
|
}
|
|
1783
|
-
})), this.calculateCentermassCommand || (this.calculateCentermassCommand = new
|
|
1784
|
-
fs:
|
|
1785
|
-
vs:
|
|
1785
|
+
})), this.calculateCentermassCommand || (this.calculateCentermassCommand = new v(t, {
|
|
1786
|
+
fs: $e,
|
|
1787
|
+
vs: Je,
|
|
1786
1788
|
topology: "point-list",
|
|
1787
1789
|
vertexCount: o.pointsNumber ?? 0,
|
|
1788
1790
|
attributes: {
|
|
@@ -1828,9 +1830,9 @@ class Ge extends w {
|
|
|
1828
1830
|
}
|
|
1829
1831
|
})), this.applyForcesVertexCoordBuffer || (this.applyForcesVertexCoordBuffer = t.createBuffer({
|
|
1830
1832
|
data: new Float32Array([-1, -1, 1, -1, -1, 1, 1, 1])
|
|
1831
|
-
})), this.applyForcesCommand || (this.applyForcesCommand = new
|
|
1832
|
-
fs:
|
|
1833
|
-
vs:
|
|
1833
|
+
})), this.applyForcesCommand || (this.applyForcesCommand = new v(t, {
|
|
1834
|
+
fs: Ge,
|
|
1835
|
+
vs: D,
|
|
1834
1836
|
topology: "triangle-strip",
|
|
1835
1837
|
vertexCount: 4,
|
|
1836
1838
|
attributes: {
|
|
@@ -1901,7 +1903,7 @@ class Ge extends w {
|
|
|
1901
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;
|
|
1902
1904
|
}
|
|
1903
1905
|
}
|
|
1904
|
-
const
|
|
1906
|
+
const tt = `
|
|
1905
1907
|
#gl-bench {
|
|
1906
1908
|
position:absolute;
|
|
1907
1909
|
right:0;
|
|
@@ -1958,7 +1960,7 @@ class G {
|
|
|
1958
1960
|
constructor(t) {
|
|
1959
1961
|
this.destroy();
|
|
1960
1962
|
const i = t.getContext("webgl") || t.getContext("experimental-webgl");
|
|
1961
|
-
this.bench = new
|
|
1963
|
+
this.bench = new ue(i, { css: tt });
|
|
1962
1964
|
}
|
|
1963
1965
|
begin() {
|
|
1964
1966
|
var t;
|
|
@@ -1969,11 +1971,11 @@ class G {
|
|
|
1969
1971
|
(i = this.bench) == null || i.end("frame"), (o = this.bench) == null || o.nextFrame(t);
|
|
1970
1972
|
}
|
|
1971
1973
|
destroy() {
|
|
1972
|
-
this.bench = void 0,
|
|
1974
|
+
this.bench = void 0, b("#gl-bench").remove();
|
|
1973
1975
|
}
|
|
1974
1976
|
}
|
|
1975
|
-
var
|
|
1976
|
-
class
|
|
1977
|
+
var it = /* @__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))(it || {});
|
|
1978
|
+
class ot {
|
|
1977
1979
|
constructor(t) {
|
|
1978
1980
|
this._config = t;
|
|
1979
1981
|
}
|
|
@@ -1994,7 +1996,7 @@ class it {
|
|
|
1994
1996
|
this.pointColors = void 0;
|
|
1995
1997
|
return;
|
|
1996
1998
|
}
|
|
1997
|
-
const t =
|
|
1999
|
+
const t = z(this._config.pointDefaultColor);
|
|
1998
2000
|
if (this.inputPointColors === void 0 || this.inputPointColors.length / 4 !== this.pointsNumber) {
|
|
1999
2001
|
this.pointColors = new Float32Array(this.pointsNumber * 4);
|
|
2000
2002
|
for (let i = 0; i < this.pointColors.length / 4; i++)
|
|
@@ -2002,7 +2004,7 @@ class it {
|
|
|
2002
2004
|
} else {
|
|
2003
2005
|
this.pointColors = this.inputPointColors;
|
|
2004
2006
|
for (let i = 0; i < this.pointColors.length / 4; i++)
|
|
2005
|
-
|
|
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]);
|
|
2006
2008
|
}
|
|
2007
2009
|
}
|
|
2008
2010
|
/**
|
|
@@ -2013,13 +2015,13 @@ class it {
|
|
|
2013
2015
|
this.pointSizes = void 0;
|
|
2014
2016
|
return;
|
|
2015
2017
|
}
|
|
2016
|
-
const t = this._config.pointDefaultSize
|
|
2018
|
+
const t = this._config.pointDefaultSize;
|
|
2017
2019
|
if (this.inputPointSizes === void 0 || this.inputPointSizes.length !== this.pointsNumber)
|
|
2018
2020
|
this.pointSizes = new Float32Array(this.pointsNumber).fill(t);
|
|
2019
2021
|
else {
|
|
2020
2022
|
this.pointSizes = this.inputPointSizes;
|
|
2021
2023
|
for (let i = 0; i < this.pointSizes.length; i++)
|
|
2022
|
-
|
|
2024
|
+
M(this.pointSizes[i]) || (this.pointSizes[i] = t);
|
|
2023
2025
|
}
|
|
2024
2026
|
}
|
|
2025
2027
|
/**
|
|
@@ -2040,7 +2042,7 @@ class it {
|
|
|
2040
2042
|
const i = this.pointShapes;
|
|
2041
2043
|
for (let o = 0; o < i.length; o++) {
|
|
2042
2044
|
const s = i[o];
|
|
2043
|
-
(s == null || !
|
|
2045
|
+
(s == null || !M(s) || s < 0 || s > 8) && (i[o] = t);
|
|
2044
2046
|
}
|
|
2045
2047
|
}
|
|
2046
2048
|
}
|
|
@@ -2072,13 +2074,13 @@ class it {
|
|
|
2072
2074
|
this.pointImageSizes = void 0;
|
|
2073
2075
|
return;
|
|
2074
2076
|
}
|
|
2075
|
-
const t = this._config.pointDefaultSize
|
|
2077
|
+
const t = this._config.pointDefaultSize;
|
|
2076
2078
|
if (this.inputPointImageSizes === void 0 || this.inputPointImageSizes.length !== this.pointsNumber)
|
|
2077
2079
|
this.pointImageSizes = this.pointSizes ? new Float32Array(this.pointSizes) : new Float32Array(this.pointsNumber).fill(t);
|
|
2078
2080
|
else {
|
|
2079
2081
|
this.pointImageSizes = new Float32Array(this.inputPointImageSizes);
|
|
2080
2082
|
for (let o = 0; o < this.pointImageSizes.length; o++)
|
|
2081
|
-
|
|
2083
|
+
M(this.pointImageSizes[o]) || (this.pointImageSizes[o] = ((i = this.pointSizes) == null ? void 0 : i[o]) ?? t);
|
|
2082
2084
|
}
|
|
2083
2085
|
}
|
|
2084
2086
|
updateLinks() {
|
|
@@ -2092,7 +2094,7 @@ class it {
|
|
|
2092
2094
|
this.linkColors = void 0;
|
|
2093
2095
|
return;
|
|
2094
2096
|
}
|
|
2095
|
-
const t =
|
|
2097
|
+
const t = z(this._config.linkDefaultColor);
|
|
2096
2098
|
if (this.inputLinkColors === void 0 || this.inputLinkColors.length / 4 !== this.linksNumber) {
|
|
2097
2099
|
this.linkColors = new Float32Array(this.linksNumber * 4);
|
|
2098
2100
|
for (let i = 0; i < this.linkColors.length / 4; i++)
|
|
@@ -2100,7 +2102,7 @@ class it {
|
|
|
2100
2102
|
} else {
|
|
2101
2103
|
this.linkColors = this.inputLinkColors;
|
|
2102
2104
|
for (let i = 0; i < this.linkColors.length / 4; i++)
|
|
2103
|
-
|
|
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]);
|
|
2104
2106
|
}
|
|
2105
2107
|
}
|
|
2106
2108
|
/**
|
|
@@ -2111,13 +2113,13 @@ class it {
|
|
|
2111
2113
|
this.linkWidths = void 0;
|
|
2112
2114
|
return;
|
|
2113
2115
|
}
|
|
2114
|
-
const t = this._config.linkDefaultWidth
|
|
2116
|
+
const t = this._config.linkDefaultWidth;
|
|
2115
2117
|
if (this.inputLinkWidths === void 0 || this.inputLinkWidths.length !== this.linksNumber)
|
|
2116
2118
|
this.linkWidths = new Float32Array(this.linksNumber).fill(t);
|
|
2117
2119
|
else {
|
|
2118
2120
|
this.linkWidths = this.inputLinkWidths;
|
|
2119
2121
|
for (let i = 0; i < this.linkWidths.length; i++)
|
|
2120
|
-
|
|
2122
|
+
M(this.linkWidths[i]) || (this.linkWidths[i] = t);
|
|
2121
2123
|
}
|
|
2122
2124
|
}
|
|
2123
2125
|
/**
|
|
@@ -2128,7 +2130,7 @@ class it {
|
|
|
2128
2130
|
this.linkArrows = void 0;
|
|
2129
2131
|
return;
|
|
2130
2132
|
}
|
|
2131
|
-
const t = this._config.linkDefaultArrows
|
|
2133
|
+
const t = this._config.linkDefaultArrows;
|
|
2132
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);
|
|
2133
2135
|
}
|
|
2134
2136
|
updateLinkStrength() {
|
|
@@ -2171,7 +2173,19 @@ class it {
|
|
|
2171
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);
|
|
2172
2174
|
}
|
|
2173
2175
|
}
|
|
2174
|
-
const
|
|
2176
|
+
const st = (
|
|
2177
|
+
/* glsl */
|
|
2178
|
+
`
|
|
2179
|
+
vec2 conicParametricCurve(vec2 A, vec2 B, vec2 ControlPoint, float t, float w) {
|
|
2180
|
+
vec2 divident = (1.0 - t) * (1.0 - t) * A + 2.0 * (1.0 - t) * t * w * ControlPoint + t * t * B;
|
|
2181
|
+
float divisor = (1.0 - t) * (1.0 - t) + 2.0 * (1.0 - t) * t * w + t * t;
|
|
2182
|
+
return divident / divisor;
|
|
2183
|
+
}
|
|
2184
|
+
`
|
|
2185
|
+
), ee = {
|
|
2186
|
+
name: "conicParametricCurve",
|
|
2187
|
+
vs: st
|
|
2188
|
+
}, nt = `#version 300 es
|
|
2175
2189
|
#ifdef GL_ES
|
|
2176
2190
|
precision highp float;
|
|
2177
2191
|
#endif
|
|
@@ -2229,7 +2243,7 @@ void main() {
|
|
|
2229
2243
|
}
|
|
2230
2244
|
} else fragColor = vec4(color, opacity);
|
|
2231
2245
|
|
|
2232
|
-
}`,
|
|
2246
|
+
}`, rt = `#version 300 es
|
|
2233
2247
|
#ifdef GL_ES
|
|
2234
2248
|
precision highp float;
|
|
2235
2249
|
#endif
|
|
@@ -2320,12 +2334,6 @@ float map(float value, float min1, float max1, float min2, float max2) {
|
|
|
2320
2334
|
return min2 + (value - min1) * (max2 - min2) / (max1 - min1);
|
|
2321
2335
|
}
|
|
2322
2336
|
|
|
2323
|
-
vec2 conicParametricCurve(vec2 A, vec2 B, vec2 ControlPoint, float t, float w) {
|
|
2324
|
-
vec2 divident = (1.0 - t) * (1.0 - t) * A + 2.0 * (1.0 - t) * t * w * ControlPoint + t * t * B;
|
|
2325
|
-
float divisor = (1.0 - t) * (1.0 - t) + 2.0 * (1.0 - t) * t * w + t * t;
|
|
2326
|
-
return divident / divisor;
|
|
2327
|
-
}
|
|
2328
|
-
|
|
2329
2337
|
float calculateLinkWidth(float width) {
|
|
2330
2338
|
float linkWidth;
|
|
2331
2339
|
if (scaleLinksOnZoom > 0.0) {
|
|
@@ -2476,7 +2484,100 @@ void main() {
|
|
|
2476
2484
|
#endif
|
|
2477
2485
|
|
|
2478
2486
|
gl_Position = vec4(final.rg, 0, 1);
|
|
2479
|
-
}`,
|
|
2487
|
+
}`, at = `#version 300 es
|
|
2488
|
+
#ifdef GL_ES
|
|
2489
|
+
precision highp float;
|
|
2490
|
+
#endif
|
|
2491
|
+
|
|
2492
|
+
in vec4 rgba;
|
|
2493
|
+
|
|
2494
|
+
out vec4 fragColor;
|
|
2495
|
+
|
|
2496
|
+
void main() {
|
|
2497
|
+
fragColor = rgba;
|
|
2498
|
+
}
|
|
2499
|
+
`, dt = `#version 300 es
|
|
2500
|
+
#ifdef GL_ES
|
|
2501
|
+
precision highp float;
|
|
2502
|
+
#endif
|
|
2503
|
+
|
|
2504
|
+
in vec2 pointA;
|
|
2505
|
+
in vec2 pointB;
|
|
2506
|
+
in float linkIndices;
|
|
2507
|
+
|
|
2508
|
+
uniform sampler2D positionsTexture;
|
|
2509
|
+
|
|
2510
|
+
#ifdef USE_UNIFORM_BUFFERS
|
|
2511
|
+
layout(std140) uniform fillSampledLinksUniforms {
|
|
2512
|
+
float pointsTextureSize;
|
|
2513
|
+
mat4 transformationMatrix;
|
|
2514
|
+
float spaceSize;
|
|
2515
|
+
vec2 screenSize;
|
|
2516
|
+
float curvedWeight;
|
|
2517
|
+
float curvedLinkControlPointDistance;
|
|
2518
|
+
float curvedLinkSegments;
|
|
2519
|
+
} fillSampledLinks;
|
|
2520
|
+
|
|
2521
|
+
#define pointsTextureSize fillSampledLinks.pointsTextureSize
|
|
2522
|
+
#define transformationMatrix fillSampledLinks.transformationMatrix
|
|
2523
|
+
#define spaceSize fillSampledLinks.spaceSize
|
|
2524
|
+
#define screenSize fillSampledLinks.screenSize
|
|
2525
|
+
#define curvedWeight fillSampledLinks.curvedWeight
|
|
2526
|
+
#define curvedLinkControlPointDistance fillSampledLinks.curvedLinkControlPointDistance
|
|
2527
|
+
#define curvedLinkSegments fillSampledLinks.curvedLinkSegments
|
|
2528
|
+
#else
|
|
2529
|
+
uniform float pointsTextureSize;
|
|
2530
|
+
uniform float spaceSize;
|
|
2531
|
+
uniform vec2 screenSize;
|
|
2532
|
+
uniform float curvedWeight;
|
|
2533
|
+
uniform float curvedLinkControlPointDistance;
|
|
2534
|
+
uniform float curvedLinkSegments;
|
|
2535
|
+
uniform mat3 transformationMatrix;
|
|
2536
|
+
#endif
|
|
2537
|
+
|
|
2538
|
+
out vec4 rgba;
|
|
2539
|
+
|
|
2540
|
+
void main() {
|
|
2541
|
+
vec4 posA = texture(positionsTexture, (pointA + 0.5) / pointsTextureSize);
|
|
2542
|
+
vec4 posB = texture(positionsTexture, (pointB + 0.5) / pointsTextureSize);
|
|
2543
|
+
vec2 a = posA.rg;
|
|
2544
|
+
vec2 b = posB.rg;
|
|
2545
|
+
|
|
2546
|
+
vec2 tangent = b - a;
|
|
2547
|
+
float angle = -atan(tangent.y, tangent.x);
|
|
2548
|
+
|
|
2549
|
+
vec2 mid;
|
|
2550
|
+
if (curvedLinkSegments <= 1.0) {
|
|
2551
|
+
mid = (a + b) * 0.5;
|
|
2552
|
+
} else if (curvedLinkControlPointDistance != 0.0 && curvedWeight != 0.0) {
|
|
2553
|
+
vec2 xBasis = b - a;
|
|
2554
|
+
vec2 yBasis = normalize(vec2(-xBasis.y, xBasis.x));
|
|
2555
|
+
float linkDist = length(xBasis);
|
|
2556
|
+
float h = curvedLinkControlPointDistance;
|
|
2557
|
+
vec2 controlPoint = (a + b) / 2.0 + yBasis * linkDist * h;
|
|
2558
|
+
mid = conicParametricCurve(a, b, controlPoint, 0.5, curvedWeight);
|
|
2559
|
+
} else {
|
|
2560
|
+
mid = (a + b) * 0.5;
|
|
2561
|
+
}
|
|
2562
|
+
|
|
2563
|
+
vec2 p = 2.0 * mid / spaceSize - 1.0;
|
|
2564
|
+
p *= spaceSize / screenSize;
|
|
2565
|
+
#ifdef USE_UNIFORM_BUFFERS
|
|
2566
|
+
mat3 transformMat3 = mat3(transformationMatrix);
|
|
2567
|
+
vec3 final = transformMat3 * vec3(p, 1);
|
|
2568
|
+
#else
|
|
2569
|
+
vec3 final = transformationMatrix * vec3(p, 1);
|
|
2570
|
+
#endif
|
|
2571
|
+
|
|
2572
|
+
vec2 pointScreenPosition = (final.xy + 1.0) * screenSize / 2.0;
|
|
2573
|
+
rgba = vec4(linkIndices, mid.x, mid.y, angle);
|
|
2574
|
+
float i = (pointScreenPosition.x + 0.5) / screenSize.x;
|
|
2575
|
+
float j = (pointScreenPosition.y + 0.5) / screenSize.y;
|
|
2576
|
+
gl_Position = vec4(2.0 * vec2(i, j) - 1.0, 0.0, 1.0);
|
|
2577
|
+
|
|
2578
|
+
gl_PointSize = 1.0;
|
|
2579
|
+
}
|
|
2580
|
+
`, lt = `#version 300 es
|
|
2480
2581
|
#ifdef GL_ES
|
|
2481
2582
|
precision highp float;
|
|
2482
2583
|
#endif
|
|
@@ -2516,7 +2617,7 @@ void main() {
|
|
|
2516
2617
|
// No link at this position, output -1 to indicate no hover
|
|
2517
2618
|
fragColor = vec4(-1.0, 0.0, 0.0, 0.0);
|
|
2518
2619
|
}
|
|
2519
|
-
} `,
|
|
2620
|
+
} `, ct = `#version 300 es
|
|
2520
2621
|
#ifdef GL_ES
|
|
2521
2622
|
precision highp float;
|
|
2522
2623
|
#endif
|
|
@@ -2525,18 +2626,18 @@ in vec2 vertexCoord;
|
|
|
2525
2626
|
|
|
2526
2627
|
void main() {
|
|
2527
2628
|
gl_Position = vec4(vertexCoord, 0.0, 1.0);
|
|
2528
|
-
} `,
|
|
2529
|
-
const t =
|
|
2629
|
+
} `, ft = (e) => {
|
|
2630
|
+
const t = fe().exponent(2).range([0, 1]).domain([-1, 1]), i = Se(0, e).map((s) => -0.5 + s / e);
|
|
2530
2631
|
i.push(0.5);
|
|
2531
2632
|
const o = new Array(i.length * 2);
|
|
2532
2633
|
return i.forEach((s, n) => {
|
|
2533
2634
|
o[n * 2] = [t(s * 2), 0.5], o[n * 2 + 1] = [t(s * 2), -0.5];
|
|
2534
2635
|
}), o;
|
|
2535
2636
|
};
|
|
2536
|
-
class
|
|
2637
|
+
class ht extends w {
|
|
2537
2638
|
initPrograms() {
|
|
2538
|
-
var
|
|
2539
|
-
const { device: t, config: i, store: o } = this;
|
|
2639
|
+
var r;
|
|
2640
|
+
const { device: t, config: i, store: o, data: s } = this;
|
|
2540
2641
|
this.updateLinkIndexFbo(), this.hoveredLineIndexTexture || (this.hoveredLineIndexTexture = t.createTexture({
|
|
2541
2642
|
width: 1,
|
|
2542
2643
|
height: 1,
|
|
@@ -2548,24 +2649,24 @@ class dt extends w {
|
|
|
2548
2649
|
height: 1,
|
|
2549
2650
|
colorAttachments: [this.hoveredLineIndexTexture]
|
|
2550
2651
|
})), this.curveLineGeometry || this.updateCurveLineGeometry();
|
|
2551
|
-
const
|
|
2652
|
+
const n = this.data.linksNumber ?? 0;
|
|
2552
2653
|
this.pointABuffer || (this.pointABuffer = t.createBuffer({
|
|
2553
|
-
data: new Float32Array(
|
|
2654
|
+
data: new Float32Array(n * 2),
|
|
2554
2655
|
usage: S.VERTEX | S.COPY_DST
|
|
2555
2656
|
})), this.pointBBuffer || (this.pointBBuffer = t.createBuffer({
|
|
2556
|
-
data: new Float32Array(
|
|
2657
|
+
data: new Float32Array(n * 2),
|
|
2557
2658
|
usage: S.VERTEX | S.COPY_DST
|
|
2558
2659
|
})), this.colorBuffer || (this.colorBuffer = t.createBuffer({
|
|
2559
|
-
data: new Float32Array(
|
|
2660
|
+
data: new Float32Array(n * 4),
|
|
2560
2661
|
usage: S.VERTEX | S.COPY_DST
|
|
2561
2662
|
})), this.widthBuffer || (this.widthBuffer = t.createBuffer({
|
|
2562
|
-
data: new Float32Array(
|
|
2663
|
+
data: new Float32Array(n),
|
|
2563
2664
|
usage: S.VERTEX | S.COPY_DST
|
|
2564
2665
|
})), this.arrowBuffer || (this.arrowBuffer = t.createBuffer({
|
|
2565
|
-
data: new Float32Array(
|
|
2666
|
+
data: new Float32Array(n),
|
|
2566
2667
|
usage: S.VERTEX | S.COPY_DST
|
|
2567
2668
|
})), this.linkIndexBuffer || (this.linkIndexBuffer = t.createBuffer({
|
|
2568
|
-
data: new Float32Array(
|
|
2669
|
+
data: new Float32Array(n),
|
|
2569
2670
|
usage: S.VERTEX | S.COPY_DST
|
|
2570
2671
|
})), this.drawLineUniformStore || (this.drawLineUniformStore = new x({
|
|
2571
2672
|
drawLineUniforms: {
|
|
@@ -2596,19 +2697,19 @@ class dt extends w {
|
|
|
2596
2697
|
widthScale: i.linkWidthScale ?? 1,
|
|
2597
2698
|
linkArrowsSizeScale: i.linkArrowsSizeScale ?? 1,
|
|
2598
2699
|
spaceSize: o.adjustedSpaceSize ?? 0,
|
|
2599
|
-
screenSize:
|
|
2600
|
-
linkVisibilityDistanceRange:
|
|
2700
|
+
screenSize: T(o.screenSize, [0, 0]),
|
|
2701
|
+
linkVisibilityDistanceRange: T(i.linkVisibilityDistanceRange, [0, 0]),
|
|
2601
2702
|
linkVisibilityMinTransparency: i.linkVisibilityMinTransparency ?? 0,
|
|
2602
2703
|
linkOpacity: i.linkOpacity ?? 1,
|
|
2603
2704
|
greyoutOpacity: i.linkGreyoutOpacity ?? 1,
|
|
2604
2705
|
curvedWeight: i.curvedLinkWeight ?? 0,
|
|
2605
2706
|
curvedLinkControlPointDistance: i.curvedLinkControlPointDistance ?? 0,
|
|
2606
|
-
curvedLinkSegments: i.curvedLinks ? i.curvedLinkSegments ??
|
|
2707
|
+
curvedLinkSegments: i.curvedLinks ? i.curvedLinkSegments ?? f.curvedLinkSegments : 1,
|
|
2607
2708
|
scaleLinksOnZoom: i.scaleLinksOnZoom ?? !0 ? 1 : 0,
|
|
2608
2709
|
maxPointSize: o.maxPointSize ?? 100,
|
|
2609
2710
|
renderMode: 0,
|
|
2610
2711
|
hoveredLinkIndex: o.hoveredLinkIndex ?? -1,
|
|
2611
|
-
hoveredLinkColor:
|
|
2712
|
+
hoveredLinkColor: m(o.hoveredLinkColor, [-1, -1, -1, -1]),
|
|
2612
2713
|
hoveredLinkWidthIncrease: i.hoveredLinkWidthIncrease ?? 0
|
|
2613
2714
|
}
|
|
2614
2715
|
},
|
|
@@ -2620,11 +2721,12 @@ class dt extends w {
|
|
|
2620
2721
|
renderMode: 0
|
|
2621
2722
|
}
|
|
2622
2723
|
}
|
|
2623
|
-
})), this.drawCurveCommand || (this.drawCurveCommand = new
|
|
2624
|
-
vs:
|
|
2625
|
-
fs:
|
|
2724
|
+
})), this.drawCurveCommand || (this.drawCurveCommand = new v(t, {
|
|
2725
|
+
vs: rt,
|
|
2726
|
+
fs: nt,
|
|
2727
|
+
modules: [ee],
|
|
2626
2728
|
topology: "triangle-strip",
|
|
2627
|
-
vertexCount: ((
|
|
2729
|
+
vertexCount: ((r = this.curveLineGeometry) == null ? void 0 : r.length) ?? 0,
|
|
2628
2730
|
attributes: {
|
|
2629
2731
|
...this.curveLineBuffer && { position: this.curveLineBuffer },
|
|
2630
2732
|
...this.pointABuffer && { pointA: this.pointABuffer },
|
|
@@ -2684,13 +2786,13 @@ class dt extends w {
|
|
|
2684
2786
|
screenSize: "vec2<f32>"
|
|
2685
2787
|
},
|
|
2686
2788
|
defaultUniforms: {
|
|
2687
|
-
mousePosition:
|
|
2688
|
-
screenSize:
|
|
2789
|
+
mousePosition: T(o.screenMousePosition, [0, 0]),
|
|
2790
|
+
screenSize: T(o.screenSize, [0, 0])
|
|
2689
2791
|
}
|
|
2690
2792
|
}
|
|
2691
|
-
})), this.hoveredLineIndexCommand || (this.hoveredLineIndexCommand = new
|
|
2692
|
-
vs:
|
|
2693
|
-
fs:
|
|
2793
|
+
})), this.hoveredLineIndexCommand || (this.hoveredLineIndexCommand = new v(t, {
|
|
2794
|
+
vs: ct,
|
|
2795
|
+
fs: lt,
|
|
2694
2796
|
topology: "triangle-strip",
|
|
2695
2797
|
vertexCount: 4,
|
|
2696
2798
|
attributes: {
|
|
@@ -2708,7 +2810,55 @@ class dt extends w {
|
|
|
2708
2810
|
hoveredLineIndexUniforms: this.hoveredLineIndexUniformStore.getManagedUniformBuffer(t, "hoveredLineIndexUniforms")
|
|
2709
2811
|
// All texture bindings will be set dynamically in findHoveredLine() method
|
|
2710
2812
|
}
|
|
2711
|
-
}))
|
|
2813
|
+
})), this.fillSampledLinksUniformStore || (this.fillSampledLinksUniformStore = new x({
|
|
2814
|
+
fillSampledLinksUniforms: {
|
|
2815
|
+
uniformTypes: {
|
|
2816
|
+
pointsTextureSize: "f32",
|
|
2817
|
+
transformationMatrix: "mat4x4<f32>",
|
|
2818
|
+
spaceSize: "f32",
|
|
2819
|
+
screenSize: "vec2<f32>",
|
|
2820
|
+
curvedWeight: "f32",
|
|
2821
|
+
curvedLinkControlPointDistance: "f32",
|
|
2822
|
+
curvedLinkSegments: "f32"
|
|
2823
|
+
},
|
|
2824
|
+
defaultUniforms: {
|
|
2825
|
+
pointsTextureSize: o.pointsTextureSize ?? 0,
|
|
2826
|
+
transformationMatrix: o.transformationMatrix4x4,
|
|
2827
|
+
spaceSize: o.adjustedSpaceSize ?? 0,
|
|
2828
|
+
screenSize: T(o.screenSize, [0, 0]),
|
|
2829
|
+
curvedWeight: i.curvedLinkWeight ?? 0,
|
|
2830
|
+
curvedLinkControlPointDistance: i.curvedLinkControlPointDistance ?? 0,
|
|
2831
|
+
curvedLinkSegments: i.curvedLinks ? i.curvedLinkSegments ?? f.curvedLinkSegments : 1
|
|
2832
|
+
}
|
|
2833
|
+
}
|
|
2834
|
+
})), this.fillSampledLinksFboCommand || (this.fillSampledLinksFboCommand = new v(t, {
|
|
2835
|
+
fs: at,
|
|
2836
|
+
vs: dt,
|
|
2837
|
+
modules: [ee],
|
|
2838
|
+
topology: "point-list",
|
|
2839
|
+
vertexCount: s.linksNumber ?? 0,
|
|
2840
|
+
attributes: {
|
|
2841
|
+
...this.pointABuffer && { pointA: this.pointABuffer },
|
|
2842
|
+
...this.pointBBuffer && { pointB: this.pointBBuffer },
|
|
2843
|
+
...this.linkIndexBuffer && { linkIndices: this.linkIndexBuffer }
|
|
2844
|
+
},
|
|
2845
|
+
bufferLayout: [
|
|
2846
|
+
{ name: "pointA", format: "float32x2" },
|
|
2847
|
+
{ name: "pointB", format: "float32x2" },
|
|
2848
|
+
{ name: "linkIndices", format: "float32" }
|
|
2849
|
+
],
|
|
2850
|
+
defines: {
|
|
2851
|
+
USE_UNIFORM_BUFFERS: !0
|
|
2852
|
+
},
|
|
2853
|
+
bindings: {
|
|
2854
|
+
fillSampledLinksUniforms: this.fillSampledLinksUniformStore.getManagedUniformBuffer(t, "fillSampledLinksUniforms")
|
|
2855
|
+
},
|
|
2856
|
+
parameters: {
|
|
2857
|
+
depthWriteEnabled: !1,
|
|
2858
|
+
depthCompare: "always",
|
|
2859
|
+
blend: !1
|
|
2860
|
+
}
|
|
2861
|
+
})), this.updateSampledLinksGrid();
|
|
2712
2862
|
}
|
|
2713
2863
|
draw(t) {
|
|
2714
2864
|
const { config: i, points: o, store: s } = this;
|
|
@@ -2719,20 +2869,20 @@ class dt extends w {
|
|
|
2719
2869
|
widthScale: i.linkWidthScale ?? 1,
|
|
2720
2870
|
linkArrowsSizeScale: i.linkArrowsSizeScale ?? 1,
|
|
2721
2871
|
spaceSize: s.adjustedSpaceSize ?? 0,
|
|
2722
|
-
screenSize:
|
|
2723
|
-
linkVisibilityDistanceRange:
|
|
2872
|
+
screenSize: T(s.screenSize, [0, 0]),
|
|
2873
|
+
linkVisibilityDistanceRange: T(i.linkVisibilityDistanceRange, [0, 0]),
|
|
2724
2874
|
linkVisibilityMinTransparency: i.linkVisibilityMinTransparency ?? 0,
|
|
2725
2875
|
linkOpacity: i.linkOpacity ?? 1,
|
|
2726
2876
|
greyoutOpacity: i.linkGreyoutOpacity ?? 1,
|
|
2727
2877
|
curvedWeight: i.curvedLinkWeight ?? 0,
|
|
2728
2878
|
curvedLinkControlPointDistance: i.curvedLinkControlPointDistance ?? 0,
|
|
2729
|
-
curvedLinkSegments: i.curvedLinks ? i.curvedLinkSegments ??
|
|
2879
|
+
curvedLinkSegments: i.curvedLinks ? i.curvedLinkSegments ?? f.curvedLinkSegments : 1,
|
|
2730
2880
|
scaleLinksOnZoom: i.scaleLinksOnZoom ?? !0 ? 1 : 0,
|
|
2731
2881
|
maxPointSize: s.maxPointSize ?? 100,
|
|
2732
2882
|
renderMode: 0,
|
|
2733
2883
|
// Normal rendering
|
|
2734
2884
|
hoveredLinkIndex: s.hoveredLinkIndex ?? -1,
|
|
2735
|
-
hoveredLinkColor:
|
|
2885
|
+
hoveredLinkColor: m(s.hoveredLinkColor, [-1, -1, -1, -1]),
|
|
2736
2886
|
hoveredLinkWidthIncrease: i.hoveredLinkWidthIncrease ?? 0
|
|
2737
2887
|
},
|
|
2738
2888
|
drawLineFragmentUniforms: {
|
|
@@ -2745,12 +2895,12 @@ class dt extends w {
|
|
|
2745
2895
|
}), this.drawCurveCommand.setInstanceCount(this.data.linksNumber ?? 0), this.drawCurveCommand.draw(t))));
|
|
2746
2896
|
}
|
|
2747
2897
|
updateLinkIndexFbo() {
|
|
2748
|
-
var a,
|
|
2898
|
+
var a, d;
|
|
2749
2899
|
const { device: t, store: i } = this;
|
|
2750
2900
|
if (!this.store.isLinkHoveringEnabled) return;
|
|
2751
2901
|
const o = i.screenSize ?? [0, 0], s = o[0], n = o[1];
|
|
2752
2902
|
if (!s || !n) return;
|
|
2753
|
-
const r = ((a = this.previousScreenSize) == null ? void 0 : a[0]) !== s || ((
|
|
2903
|
+
const r = ((a = this.previousScreenSize) == null ? void 0 : a[0]) !== s || ((d = this.previousScreenSize) == null ? void 0 : d[1]) !== n;
|
|
2754
2904
|
(!this.linkIndexTexture || r) && (this.linkIndexFbo && !this.linkIndexFbo.destroyed && this.linkIndexFbo.destroy(), this.linkIndexTexture && !this.linkIndexTexture.destroyed && this.linkIndexTexture.destroy(), this.linkIndexTexture = t.createTexture({
|
|
2755
2905
|
width: s,
|
|
2756
2906
|
height: n,
|
|
@@ -2758,7 +2908,7 @@ class dt extends w {
|
|
|
2758
2908
|
usage: C.SAMPLE | C.RENDER | C.COPY_DST
|
|
2759
2909
|
}), this.linkIndexTexture.copyImageData({
|
|
2760
2910
|
data: new Float32Array(s * n * 4).fill(0),
|
|
2761
|
-
bytesPerRow:
|
|
2911
|
+
bytesPerRow: g("rgba32float", s),
|
|
2762
2912
|
mipLevel: 0,
|
|
2763
2913
|
x: 0,
|
|
2764
2914
|
y: 0
|
|
@@ -2768,16 +2918,27 @@ class dt extends w {
|
|
|
2768
2918
|
colorAttachments: [this.linkIndexTexture]
|
|
2769
2919
|
}), this.previousScreenSize = [s, n]);
|
|
2770
2920
|
}
|
|
2921
|
+
updateSampledLinksGrid() {
|
|
2922
|
+
const { store: { screenSize: t }, config: { linkSamplingDistance: i }, device: o } = this;
|
|
2923
|
+
let s = i ?? Math.min(...t) / 2;
|
|
2924
|
+
s === 0 && (s = f.linkSamplingDistance);
|
|
2925
|
+
const n = Math.ceil(t[0] / s), r = Math.ceil(t[1] / s);
|
|
2926
|
+
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
|
+
width: n,
|
|
2928
|
+
height: r,
|
|
2929
|
+
colorAttachments: ["rgba32float"]
|
|
2930
|
+
}));
|
|
2931
|
+
}
|
|
2771
2932
|
updatePointsBuffer() {
|
|
2772
|
-
var
|
|
2933
|
+
var d;
|
|
2773
2934
|
const { device: t, data: i, store: o } = this;
|
|
2774
2935
|
if (i.linksNumber === void 0 || i.links === void 0 || !o.pointsTextureSize) return;
|
|
2775
2936
|
const s = new Float32Array(i.linksNumber * 2), n = new Float32Array(i.linksNumber * 2);
|
|
2776
|
-
for (let
|
|
2777
|
-
const c = i.links[
|
|
2778
|
-
s[
|
|
2937
|
+
for (let l = 0; l < i.linksNumber; l++) {
|
|
2938
|
+
const c = i.links[l * 2], h = i.links[l * 2 + 1], p = c % o.pointsTextureSize, u = Math.floor(c / o.pointsTextureSize), _ = h % o.pointsTextureSize, R = Math.floor(h / o.pointsTextureSize);
|
|
2939
|
+
s[l * 2] = p, s[l * 2 + 1] = u, n[l * 2] = _, n[l * 2 + 1] = R;
|
|
2779
2940
|
}
|
|
2780
|
-
const r = (((
|
|
2941
|
+
const r = (((d = this.pointABuffer) == null ? void 0 : d.byteLength) ?? 0) / (Float32Array.BYTES_PER_ELEMENT * 2);
|
|
2781
2942
|
!this.pointABuffer || r !== i.linksNumber ? (this.pointABuffer && !this.pointABuffer.destroyed && this.pointABuffer.destroy(), this.pointABuffer = t.createBuffer({
|
|
2782
2943
|
data: s,
|
|
2783
2944
|
usage: S.VERTEX | S.COPY_DST
|
|
@@ -2786,8 +2947,8 @@ class dt extends w {
|
|
|
2786
2947
|
usage: S.VERTEX | S.COPY_DST
|
|
2787
2948
|
})) : this.pointBBuffer.write(n);
|
|
2788
2949
|
const a = new Float32Array(i.linksNumber);
|
|
2789
|
-
for (let
|
|
2790
|
-
a[
|
|
2950
|
+
for (let l = 0; l < i.linksNumber; l++)
|
|
2951
|
+
a[l] = l;
|
|
2791
2952
|
!this.linkIndexBuffer || r !== i.linksNumber ? (this.linkIndexBuffer && !this.linkIndexBuffer.destroyed && this.linkIndexBuffer.destroy(), this.linkIndexBuffer = t.createBuffer({
|
|
2792
2953
|
data: a,
|
|
2793
2954
|
usage: S.VERTEX | S.COPY_DST
|
|
@@ -2795,7 +2956,11 @@ class dt extends w {
|
|
|
2795
2956
|
pointA: this.pointABuffer,
|
|
2796
2957
|
pointB: this.pointBBuffer,
|
|
2797
2958
|
linkIndices: this.linkIndexBuffer
|
|
2798
|
-
})
|
|
2959
|
+
}), this.fillSampledLinksFboCommand && this.fillSampledLinksFboCommand.setAttributes({
|
|
2960
|
+
pointA: this.pointABuffer,
|
|
2961
|
+
pointB: this.pointBBuffer,
|
|
2962
|
+
linkIndices: this.linkIndexBuffer
|
|
2963
|
+
}), this.updateSampledLinksGrid();
|
|
2799
2964
|
}
|
|
2800
2965
|
updateColor() {
|
|
2801
2966
|
const { device: t, data: i } = this, o = i.linksNumber ?? 0, s = i.linkColors ?? new Float32Array(o * 4).fill(0);
|
|
@@ -2835,7 +3000,7 @@ class dt extends w {
|
|
|
2835
3000
|
}
|
|
2836
3001
|
updateCurveLineGeometry() {
|
|
2837
3002
|
const { device: t, config: { curvedLinks: i, curvedLinkSegments: o } } = this;
|
|
2838
|
-
this.curveLineGeometry =
|
|
3003
|
+
this.curveLineGeometry = ft(i ? o ?? f.curvedLinkSegments : 1);
|
|
2839
3004
|
const s = new Float32Array(this.curveLineGeometry.length * 2);
|
|
2840
3005
|
for (let n = 0; n < this.curveLineGeometry.length; n++)
|
|
2841
3006
|
s[n * 2] = this.curveLineGeometry[n][0], s[n * 2 + 1] = this.curveLineGeometry[n][1];
|
|
@@ -2846,6 +3011,70 @@ class dt extends w {
|
|
|
2846
3011
|
position: this.curveLineBuffer
|
|
2847
3012
|
}), this.drawCurveCommand.setVertexCount(this.curveLineGeometry.length));
|
|
2848
3013
|
}
|
|
3014
|
+
getSampledLinkPositionsMap() {
|
|
3015
|
+
const t = /* @__PURE__ */ new Map();
|
|
3016
|
+
if (!this.sampledLinksFbo || this.sampledLinksFbo.destroyed) return t;
|
|
3017
|
+
const i = this.points;
|
|
3018
|
+
if (!(i != null && i.currentPositionTexture) || i.currentPositionTexture.destroyed) return t;
|
|
3019
|
+
if (this.fillSampledLinksFboCommand && this.fillSampledLinksUniformStore && this.sampledLinksFbo) {
|
|
3020
|
+
this.fillSampledLinksFboCommand.setVertexCount(this.data.linksNumber ?? 0), this.fillSampledLinksUniformStore.setUniforms({
|
|
3021
|
+
fillSampledLinksUniforms: {
|
|
3022
|
+
pointsTextureSize: this.store.pointsTextureSize ?? 0,
|
|
3023
|
+
transformationMatrix: this.store.transformationMatrix4x4,
|
|
3024
|
+
spaceSize: this.store.adjustedSpaceSize ?? 0,
|
|
3025
|
+
screenSize: T(this.store.screenSize, [0, 0]),
|
|
3026
|
+
curvedWeight: this.config.curvedLinkWeight ?? 0,
|
|
3027
|
+
curvedLinkControlPointDistance: this.config.curvedLinkControlPointDistance ?? 0,
|
|
3028
|
+
curvedLinkSegments: this.config.curvedLinks ? this.config.curvedLinkSegments ?? f.curvedLinkSegments : 1
|
|
3029
|
+
}
|
|
3030
|
+
}), this.fillSampledLinksFboCommand.setBindings({
|
|
3031
|
+
positionsTexture: i.currentPositionTexture
|
|
3032
|
+
});
|
|
3033
|
+
const s = this.device.beginRenderPass({
|
|
3034
|
+
framebuffer: this.sampledLinksFbo,
|
|
3035
|
+
clearColor: [-1, -1, -1, -1]
|
|
3036
|
+
});
|
|
3037
|
+
this.fillSampledLinksFboCommand.draw(s), s.end();
|
|
3038
|
+
}
|
|
3039
|
+
const o = y(this.device, this.sampledLinksFbo);
|
|
3040
|
+
for (let s = 0; s < o.length / 4; s++) {
|
|
3041
|
+
const n = o[s * 4], r = o[s * 4 + 1], a = o[s * 4 + 2], d = o[s * 4 + 3];
|
|
3042
|
+
n !== void 0 && n >= 0 && r !== void 0 && a !== void 0 && d !== void 0 && t.set(Math.round(n), [r, a, d]);
|
|
3043
|
+
}
|
|
3044
|
+
return t;
|
|
3045
|
+
}
|
|
3046
|
+
getSampledLinks() {
|
|
3047
|
+
const t = [], i = [], o = [];
|
|
3048
|
+
if (!this.sampledLinksFbo || this.sampledLinksFbo.destroyed) return { indices: t, positions: i, angles: o };
|
|
3049
|
+
const s = this.points;
|
|
3050
|
+
if (!(s != null && s.currentPositionTexture) || s.currentPositionTexture.destroyed) return { indices: t, positions: i, angles: o };
|
|
3051
|
+
if (this.fillSampledLinksFboCommand && this.fillSampledLinksUniformStore && this.sampledLinksFbo) {
|
|
3052
|
+
this.fillSampledLinksFboCommand.setVertexCount(this.data.linksNumber ?? 0), this.fillSampledLinksUniformStore.setUniforms({
|
|
3053
|
+
fillSampledLinksUniforms: {
|
|
3054
|
+
pointsTextureSize: this.store.pointsTextureSize ?? 0,
|
|
3055
|
+
transformationMatrix: this.store.transformationMatrix4x4,
|
|
3056
|
+
spaceSize: this.store.adjustedSpaceSize ?? 0,
|
|
3057
|
+
screenSize: T(this.store.screenSize, [0, 0]),
|
|
3058
|
+
curvedWeight: this.config.curvedLinkWeight ?? 0,
|
|
3059
|
+
curvedLinkControlPointDistance: this.config.curvedLinkControlPointDistance ?? 0,
|
|
3060
|
+
curvedLinkSegments: this.config.curvedLinks ? this.config.curvedLinkSegments ?? f.curvedLinkSegments : 1
|
|
3061
|
+
}
|
|
3062
|
+
}), this.fillSampledLinksFboCommand.setBindings({
|
|
3063
|
+
positionsTexture: s.currentPositionTexture
|
|
3064
|
+
});
|
|
3065
|
+
const r = this.device.beginRenderPass({
|
|
3066
|
+
framebuffer: this.sampledLinksFbo,
|
|
3067
|
+
clearColor: [-1, -1, -1, -1]
|
|
3068
|
+
});
|
|
3069
|
+
this.fillSampledLinksFboCommand.draw(r), r.end();
|
|
3070
|
+
}
|
|
3071
|
+
const n = y(this.device, this.sampledLinksFbo);
|
|
3072
|
+
for (let r = 0; r < n.length / 4; r++) {
|
|
3073
|
+
const a = n[r * 4], d = n[r * 4 + 1], l = n[r * 4 + 2], c = n[r * 4 + 3];
|
|
3074
|
+
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));
|
|
3075
|
+
}
|
|
3076
|
+
return { indices: t, positions: i, angles: o };
|
|
3077
|
+
}
|
|
2849
3078
|
findHoveredLine() {
|
|
2850
3079
|
const { config: t, points: i, store: o } = this;
|
|
2851
3080
|
if (!i || !i.currentPositionTexture || i.currentPositionTexture.destroyed || !i.greyoutStatusTexture || i.greyoutStatusTexture.destroyed || !this.data.linksNumber || !this.store.isLinkHoveringEnabled || !this.linkIndexFbo || !this.drawCurveCommand || !this.drawLineUniformStore || !this.linkIndexTexture || this.linkIndexTexture.destroyed) return;
|
|
@@ -2856,20 +3085,20 @@ class dt extends w {
|
|
|
2856
3085
|
widthScale: t.linkWidthScale ?? 1,
|
|
2857
3086
|
linkArrowsSizeScale: t.linkArrowsSizeScale ?? 1,
|
|
2858
3087
|
spaceSize: o.adjustedSpaceSize ?? 0,
|
|
2859
|
-
screenSize:
|
|
2860
|
-
linkVisibilityDistanceRange:
|
|
3088
|
+
screenSize: T(o.screenSize, [0, 0]),
|
|
3089
|
+
linkVisibilityDistanceRange: T(t.linkVisibilityDistanceRange, [0, 0]),
|
|
2861
3090
|
linkVisibilityMinTransparency: t.linkVisibilityMinTransparency ?? 0,
|
|
2862
3091
|
linkOpacity: t.linkOpacity ?? 1,
|
|
2863
3092
|
greyoutOpacity: t.linkGreyoutOpacity ?? 1,
|
|
2864
3093
|
curvedWeight: t.curvedLinkWeight ?? 0,
|
|
2865
3094
|
curvedLinkControlPointDistance: t.curvedLinkControlPointDistance ?? 0,
|
|
2866
|
-
curvedLinkSegments: t.curvedLinks ? t.curvedLinkSegments ??
|
|
3095
|
+
curvedLinkSegments: t.curvedLinks ? t.curvedLinkSegments ?? f.curvedLinkSegments : 1,
|
|
2867
3096
|
scaleLinksOnZoom: t.scaleLinksOnZoom ?? !0 ? 1 : 0,
|
|
2868
3097
|
maxPointSize: o.maxPointSize ?? 100,
|
|
2869
3098
|
renderMode: 1,
|
|
2870
3099
|
// Index rendering for picking
|
|
2871
3100
|
hoveredLinkIndex: o.hoveredLinkIndex ?? -1,
|
|
2872
|
-
hoveredLinkColor:
|
|
3101
|
+
hoveredLinkColor: m(o.hoveredLinkColor, [-1, -1, -1, -1]),
|
|
2873
3102
|
hoveredLinkWidthIncrease: t.hoveredLinkWidthIncrease ?? 0
|
|
2874
3103
|
},
|
|
2875
3104
|
drawLineFragmentUniforms: {
|
|
@@ -2888,8 +3117,8 @@ class dt extends w {
|
|
|
2888
3117
|
if (this.drawCurveCommand.draw(s), s.end(), this.hoveredLineIndexCommand && this.hoveredLineIndexFbo && this.hoveredLineIndexUniformStore) {
|
|
2889
3118
|
this.hoveredLineIndexUniformStore.setUniforms({
|
|
2890
3119
|
hoveredLineIndexUniforms: {
|
|
2891
|
-
mousePosition:
|
|
2892
|
-
screenSize:
|
|
3120
|
+
mousePosition: T(o.screenMousePosition, [0, 0]),
|
|
3121
|
+
screenSize: T(o.screenSize, [0, 0])
|
|
2893
3122
|
}
|
|
2894
3123
|
}), this.hoveredLineIndexCommand.setBindings({
|
|
2895
3124
|
linkIndexTexture: this.linkIndexTexture
|
|
@@ -2905,11 +3134,11 @@ class dt extends w {
|
|
|
2905
3134
|
* Models -> Framebuffers -> Textures -> UniformStores -> Buffers
|
|
2906
3135
|
*/
|
|
2907
3136
|
destroy() {
|
|
2908
|
-
var t, i, o, s;
|
|
2909
|
-
(t = this.drawCurveCommand) == null || t.destroy(), this.drawCurveCommand = void 0, (i = this.hoveredLineIndexCommand) == null || i.destroy(), this.hoveredLineIndexCommand = void 0, this.linkIndexFbo && !this.linkIndexFbo.destroyed && this.linkIndexFbo.destroy(), this.linkIndexFbo = void 0, this.hoveredLineIndexFbo && !this.hoveredLineIndexFbo.destroyed && this.hoveredLineIndexFbo.destroy(), this.hoveredLineIndexFbo = void 0, this.linkIndexTexture && !this.linkIndexTexture.destroyed && this.linkIndexTexture.destroy(), this.linkIndexTexture = void 0, this.hoveredLineIndexTexture && !this.hoveredLineIndexTexture.destroyed && this.hoveredLineIndexTexture.destroy(), this.hoveredLineIndexTexture = void 0, (
|
|
3137
|
+
var t, i, o, s, n, r;
|
|
3138
|
+
(t = this.drawCurveCommand) == null || t.destroy(), this.drawCurveCommand = void 0, (i = this.hoveredLineIndexCommand) == null || i.destroy(), this.hoveredLineIndexCommand = void 0, (o = this.fillSampledLinksFboCommand) == null || o.destroy(), this.fillSampledLinksFboCommand = void 0, this.linkIndexFbo && !this.linkIndexFbo.destroyed && this.linkIndexFbo.destroy(), this.linkIndexFbo = void 0, this.sampledLinksFbo && !this.sampledLinksFbo.destroyed && this.sampledLinksFbo.destroy(), this.sampledLinksFbo = void 0, this.hoveredLineIndexFbo && !this.hoveredLineIndexFbo.destroyed && this.hoveredLineIndexFbo.destroy(), this.hoveredLineIndexFbo = void 0, this.linkIndexTexture && !this.linkIndexTexture.destroyed && this.linkIndexTexture.destroy(), this.linkIndexTexture = void 0, this.hoveredLineIndexTexture && !this.hoveredLineIndexTexture.destroyed && this.hoveredLineIndexTexture.destroy(), this.hoveredLineIndexTexture = void 0, (s = this.drawLineUniformStore) == null || s.destroy(), this.drawLineUniformStore = void 0, (n = this.hoveredLineIndexUniformStore) == null || n.destroy(), this.hoveredLineIndexUniformStore = void 0, (r = this.fillSampledLinksUniformStore) == null || r.destroy(), this.fillSampledLinksUniformStore = void 0, this.pointABuffer && !this.pointABuffer.destroyed && this.pointABuffer.destroy(), this.pointABuffer = void 0, this.pointBBuffer && !this.pointBBuffer.destroyed && this.pointBBuffer.destroy(), this.pointBBuffer = void 0, this.colorBuffer && !this.colorBuffer.destroyed && this.colorBuffer.destroy(), this.colorBuffer = void 0, this.widthBuffer && !this.widthBuffer.destroyed && this.widthBuffer.destroy(), this.widthBuffer = void 0, this.arrowBuffer && !this.arrowBuffer.destroyed && this.arrowBuffer.destroy(), this.arrowBuffer = void 0, this.curveLineBuffer && !this.curveLineBuffer.destroyed && this.curveLineBuffer.destroy(), this.curveLineBuffer = void 0, this.linkIndexBuffer && !this.linkIndexBuffer.destroyed && this.linkIndexBuffer.destroy(), this.linkIndexBuffer = void 0, this.quadBuffer && !this.quadBuffer.destroyed && this.quadBuffer.destroy(), this.quadBuffer = void 0;
|
|
2910
3139
|
}
|
|
2911
3140
|
}
|
|
2912
|
-
const
|
|
3141
|
+
const ut = `#version 300 es
|
|
2913
3142
|
#ifdef GL_ES
|
|
2914
3143
|
precision highp float;
|
|
2915
3144
|
#endif
|
|
@@ -3168,7 +3397,7 @@ void main() {
|
|
|
3168
3397
|
finalPointAlpha
|
|
3169
3398
|
);
|
|
3170
3399
|
}
|
|
3171
|
-
`,
|
|
3400
|
+
`, St = `#version 300 es
|
|
3172
3401
|
#ifdef GL_ES
|
|
3173
3402
|
precision highp float;
|
|
3174
3403
|
#endif
|
|
@@ -3370,7 +3599,7 @@ void main() {
|
|
|
3370
3599
|
imageAtlasUV = atlasCoords;
|
|
3371
3600
|
}
|
|
3372
3601
|
#endif
|
|
3373
|
-
} `,
|
|
3602
|
+
} `, pt = `#version 300 es
|
|
3374
3603
|
#ifdef GL_ES
|
|
3375
3604
|
precision highp float;
|
|
3376
3605
|
#endif
|
|
@@ -3458,7 +3687,7 @@ void main() {
|
|
|
3458
3687
|
}
|
|
3459
3688
|
}
|
|
3460
3689
|
|
|
3461
|
-
`,
|
|
3690
|
+
`, _t = `#version 300 es
|
|
3462
3691
|
#ifdef GL_ES
|
|
3463
3692
|
precision highp float;
|
|
3464
3693
|
#endif
|
|
@@ -3546,7 +3775,7 @@ void main() {
|
|
|
3546
3775
|
if (pointInPolygon(screenPos, polygonPathTexture, polygonPathLength)) {
|
|
3547
3776
|
fragColor.r = 1.0;
|
|
3548
3777
|
}
|
|
3549
|
-
} `,
|
|
3778
|
+
} `, Tt = `#version 300 es
|
|
3550
3779
|
#ifdef GL_ES
|
|
3551
3780
|
precision highp float;
|
|
3552
3781
|
#endif
|
|
@@ -3589,7 +3818,7 @@ void main () {
|
|
|
3589
3818
|
float opacity = smoothstep(r, r * smoothing, 1.0);
|
|
3590
3819
|
float stroke = smoothstep(width, width * smoothing, r);
|
|
3591
3820
|
fragColor = vec4(rgbColor, opacity * stroke * pointOpacity);
|
|
3592
|
-
}`,
|
|
3821
|
+
}`, gt = `#version 300 es
|
|
3593
3822
|
#ifdef GL_ES
|
|
3594
3823
|
precision highp float;
|
|
3595
3824
|
#endif
|
|
@@ -3733,7 +3962,7 @@ void main () {
|
|
|
3733
3962
|
#endif
|
|
3734
3963
|
|
|
3735
3964
|
gl_Position = vec4(final.rg, 0, 1);
|
|
3736
|
-
}`,
|
|
3965
|
+
}`, Ct = `#version 300 es
|
|
3737
3966
|
#ifdef GL_ES
|
|
3738
3967
|
precision highp float;
|
|
3739
3968
|
#endif
|
|
@@ -3747,7 +3976,7 @@ void main() {
|
|
|
3747
3976
|
discard;
|
|
3748
3977
|
}
|
|
3749
3978
|
fragColor = rgba;
|
|
3750
|
-
}`,
|
|
3979
|
+
}`, Pt = `#version 300 es
|
|
3751
3980
|
#ifdef GL_ES
|
|
3752
3981
|
precision highp float;
|
|
3753
3982
|
#endif
|
|
@@ -3859,7 +4088,7 @@ void main() {
|
|
|
3859
4088
|
}
|
|
3860
4089
|
|
|
3861
4090
|
gl_PointSize = 1.0;
|
|
3862
|
-
}`,
|
|
4091
|
+
}`, Rt = `#version 300 es
|
|
3863
4092
|
#ifdef GL_ES
|
|
3864
4093
|
precision highp float;
|
|
3865
4094
|
#endif
|
|
@@ -3870,7 +4099,7 @@ out vec4 fragColor;
|
|
|
3870
4099
|
|
|
3871
4100
|
void main() {
|
|
3872
4101
|
fragColor = rgba;
|
|
3873
|
-
}`,
|
|
4102
|
+
}`, xt = `#version 300 es
|
|
3874
4103
|
#ifdef GL_ES
|
|
3875
4104
|
precision highp float;
|
|
3876
4105
|
#endif
|
|
@@ -3920,7 +4149,7 @@ void main() {
|
|
|
3920
4149
|
gl_Position = vec4(2.0 * vec2(i, j) - 1.0, 0.0, 1.0);
|
|
3921
4150
|
|
|
3922
4151
|
gl_PointSize = 1.0;
|
|
3923
|
-
}`,
|
|
4152
|
+
}`, vt = `#version 300 es
|
|
3924
4153
|
#ifdef GL_ES
|
|
3925
4154
|
precision highp float;
|
|
3926
4155
|
#endif
|
|
@@ -3970,7 +4199,7 @@ void main() {
|
|
|
3970
4199
|
pointPosition.g = clamp(pointPosition.g, 0.0, spaceSize);
|
|
3971
4200
|
|
|
3972
4201
|
fragColor = pointPosition;
|
|
3973
|
-
}`,
|
|
4202
|
+
}`, At = `#version 300 es
|
|
3974
4203
|
#ifdef GL_ES
|
|
3975
4204
|
precision highp float;
|
|
3976
4205
|
#endif
|
|
@@ -4000,7 +4229,7 @@ void main() {
|
|
|
4000
4229
|
fragColor = vec4(pointPosition.rg, 1.0, 1.0);
|
|
4001
4230
|
}
|
|
4002
4231
|
|
|
4003
|
-
`,
|
|
4232
|
+
`, mt = `#version 300 es
|
|
4004
4233
|
#ifdef GL_ES
|
|
4005
4234
|
precision highp float;
|
|
4006
4235
|
#endif
|
|
@@ -4034,12 +4263,12 @@ void main() {
|
|
|
4034
4263
|
|
|
4035
4264
|
fragColor = pointPosition;
|
|
4036
4265
|
}`;
|
|
4037
|
-
function
|
|
4266
|
+
function It(e, t = 16384) {
|
|
4038
4267
|
if (!(e != null && e.length))
|
|
4039
4268
|
return null;
|
|
4040
4269
|
let i = 0;
|
|
4041
|
-
for (const
|
|
4042
|
-
const c = Math.max(
|
|
4270
|
+
for (const l of e) {
|
|
4271
|
+
const c = Math.max(l.width, l.height);
|
|
4043
4272
|
c > i && (i = c);
|
|
4044
4273
|
}
|
|
4045
4274
|
if (i === 0)
|
|
@@ -4049,52 +4278,52 @@ function xt(e, t = 16384) {
|
|
|
4049
4278
|
n > t && (r = t / n, i = Math.max(1, Math.floor(i * r)), n = Math.max(1, Math.floor(n * r)), console.warn(
|
|
4050
4279
|
`🖼️ Atlas scaling required: Original size ${(o * s).toLocaleString()}px exceeds WebGL limit ${t.toLocaleString()}px. Scaling down to ${n.toLocaleString()}px (${Math.round(r * 100)}% of original quality)`
|
|
4051
4280
|
));
|
|
4052
|
-
const a = new Uint8Array(n * n * 4).fill(0),
|
|
4053
|
-
for (const [
|
|
4054
|
-
const
|
|
4055
|
-
if (
|
|
4281
|
+
const a = new Uint8Array(n * n * 4).fill(0), d = new Float32Array(s * s * 4).fill(-1);
|
|
4282
|
+
for (const [l, c] of e.entries()) {
|
|
4283
|
+
const h = c.width, p = c.height;
|
|
4284
|
+
if (h === 0 || p === 0)
|
|
4056
4285
|
continue;
|
|
4057
|
-
const u = Math.min(1, i / Math.max(
|
|
4058
|
-
l
|
|
4059
|
-
for (let U = 0; U <
|
|
4286
|
+
const u = Math.min(1, i / Math.max(h, p)), _ = Math.floor(h * u), R = Math.floor(p * u), I = Math.floor(l / s), A = l % s * i, F = I * i;
|
|
4287
|
+
d[l * 4] = A / n, d[l * 4 + 1] = F / n, d[l * 4 + 2] = (A + _) / n, d[l * 4 + 3] = (F + R) / n;
|
|
4288
|
+
for (let U = 0; U < R; U++)
|
|
4060
4289
|
for (let E = 0; E < _; E++) {
|
|
4061
|
-
const
|
|
4062
|
-
a[
|
|
4290
|
+
const N = Math.floor(E * (h / _)), B = (Math.floor(U * (p / R)) * h + N) * 4, k = ((F + U) * n + (A + E)) * 4;
|
|
4291
|
+
a[k] = c.data[B] ?? 0, a[k + 1] = c.data[B + 1] ?? 0, a[k + 2] = c.data[B + 2] ?? 0, a[k + 3] = c.data[B + 3] ?? 255;
|
|
4063
4292
|
}
|
|
4064
4293
|
}
|
|
4065
4294
|
return {
|
|
4066
4295
|
atlasData: a,
|
|
4067
4296
|
atlasSize: n,
|
|
4068
|
-
atlasCoords:
|
|
4297
|
+
atlasCoords: d,
|
|
4069
4298
|
atlasCoordsSize: s
|
|
4070
4299
|
};
|
|
4071
4300
|
}
|
|
4072
|
-
class
|
|
4301
|
+
class yt extends w {
|
|
4073
4302
|
constructor() {
|
|
4074
4303
|
super(...arguments), this.imageCount = 0, this.isPositionsUpToDate = !1, this.polygonPathLength = 0;
|
|
4075
4304
|
}
|
|
4076
4305
|
updatePositions() {
|
|
4077
4306
|
const { device: t, store: i, data: o, config: { rescalePositions: s, enableSimulation: n } } = this, { pointsTextureSize: r } = i;
|
|
4078
4307
|
if (!r || !o.pointPositions || o.pointsNumber === void 0) return;
|
|
4079
|
-
const a = r * r * 4,
|
|
4080
|
-
c !==
|
|
4308
|
+
const a = r * r * 4, d = new Float32Array(a), l = r * r * 4 * 4, c = d.byteLength;
|
|
4309
|
+
c !== l && console.error("Texture data size mismatch:", {
|
|
4081
4310
|
pointsTextureSize: r,
|
|
4082
|
-
expectedBytes:
|
|
4311
|
+
expectedBytes: l,
|
|
4083
4312
|
actualBytes: c,
|
|
4084
4313
|
textureDataSize: a,
|
|
4085
|
-
dataLength:
|
|
4314
|
+
dataLength: d.length
|
|
4086
4315
|
});
|
|
4087
|
-
let
|
|
4088
|
-
s === void 0 && !n && (
|
|
4316
|
+
let h = s;
|
|
4317
|
+
s === void 0 && !n && (h = !0), this.shouldSkipRescale && (h = !1), h ? this.rescaleInitialNodePositions() : this.shouldSkipRescale || (this.scaleX = void 0, this.scaleY = void 0), this.shouldSkipRescale = void 0;
|
|
4089
4318
|
for (let _ = 0; _ < o.pointsNumber; ++_)
|
|
4090
|
-
|
|
4319
|
+
d[_ * 4 + 0] = o.pointPositions[_ * 2 + 0], d[_ * 4 + 1] = o.pointPositions[_ * 2 + 1], d[_ * 4 + 2] = _;
|
|
4091
4320
|
if (!this.currentPositionTexture || this.currentPositionTexture.width !== r || this.currentPositionTexture.height !== r ? (this.currentPositionTexture && !this.currentPositionTexture.destroyed && this.currentPositionTexture.destroy(), this.currentPositionFbo && !this.currentPositionFbo.destroyed && this.currentPositionFbo.destroy(), this.currentPositionTexture = t.createTexture({
|
|
4092
4321
|
width: r,
|
|
4093
4322
|
height: r,
|
|
4094
4323
|
format: "rgba32float"
|
|
4095
4324
|
}), this.currentPositionTexture.copyImageData({
|
|
4096
|
-
data:
|
|
4097
|
-
bytesPerRow:
|
|
4325
|
+
data: d,
|
|
4326
|
+
bytesPerRow: g("rgba32float", r),
|
|
4098
4327
|
mipLevel: 0,
|
|
4099
4328
|
x: 0,
|
|
4100
4329
|
y: 0
|
|
@@ -4103,8 +4332,8 @@ class At extends w {
|
|
|
4103
4332
|
height: r,
|
|
4104
4333
|
colorAttachments: [this.currentPositionTexture]
|
|
4105
4334
|
})) : this.currentPositionTexture.copyImageData({
|
|
4106
|
-
data:
|
|
4107
|
-
bytesPerRow:
|
|
4335
|
+
data: d,
|
|
4336
|
+
bytesPerRow: g("rgba32float", r),
|
|
4108
4337
|
mipLevel: 0,
|
|
4109
4338
|
x: 0,
|
|
4110
4339
|
y: 0
|
|
@@ -4113,8 +4342,8 @@ class At extends w {
|
|
|
4113
4342
|
height: r,
|
|
4114
4343
|
format: "rgba32float"
|
|
4115
4344
|
}), this.previousPositionTexture.copyImageData({
|
|
4116
|
-
data:
|
|
4117
|
-
bytesPerRow:
|
|
4345
|
+
data: d,
|
|
4346
|
+
bytesPerRow: g("rgba32float", r),
|
|
4118
4347
|
mipLevel: 0,
|
|
4119
4348
|
x: 0,
|
|
4120
4349
|
y: 0
|
|
@@ -4123,8 +4352,8 @@ class At extends w {
|
|
|
4123
4352
|
height: r,
|
|
4124
4353
|
colorAttachments: [this.previousPositionTexture]
|
|
4125
4354
|
})) : this.previousPositionTexture.copyImageData({
|
|
4126
|
-
data:
|
|
4127
|
-
bytesPerRow:
|
|
4355
|
+
data: d,
|
|
4356
|
+
bytesPerRow: g("rgba32float", r),
|
|
4128
4357
|
mipLevel: 0,
|
|
4129
4358
|
x: 0,
|
|
4130
4359
|
y: 0
|
|
@@ -4136,7 +4365,7 @@ class At extends w {
|
|
|
4136
4365
|
format: "rgba32float"
|
|
4137
4366
|
}), this.velocityTexture.copyImageData({
|
|
4138
4367
|
data: _,
|
|
4139
|
-
bytesPerRow:
|
|
4368
|
+
bytesPerRow: g("rgba32float", r),
|
|
4140
4369
|
mipLevel: 0,
|
|
4141
4370
|
x: 0,
|
|
4142
4371
|
y: 0
|
|
@@ -4146,7 +4375,7 @@ class At extends w {
|
|
|
4146
4375
|
colorAttachments: [this.velocityTexture]
|
|
4147
4376
|
})) : this.velocityTexture.copyImageData({
|
|
4148
4377
|
data: _,
|
|
4149
|
-
bytesPerRow:
|
|
4378
|
+
bytesPerRow: g("rgba32float", r),
|
|
4150
4379
|
mipLevel: 0,
|
|
4151
4380
|
x: 0,
|
|
4152
4381
|
y: 0
|
|
@@ -4157,8 +4386,8 @@ class At extends w {
|
|
|
4157
4386
|
height: r,
|
|
4158
4387
|
format: "rgba32float"
|
|
4159
4388
|
}), this.selectedTexture.copyImageData({
|
|
4160
|
-
data:
|
|
4161
|
-
bytesPerRow:
|
|
4389
|
+
data: d,
|
|
4390
|
+
bytesPerRow: g("rgba32float", r),
|
|
4162
4391
|
mipLevel: 0,
|
|
4163
4392
|
x: 0,
|
|
4164
4393
|
y: 0
|
|
@@ -4167,8 +4396,8 @@ class At extends w {
|
|
|
4167
4396
|
height: r,
|
|
4168
4397
|
colorAttachments: [this.selectedTexture]
|
|
4169
4398
|
})) : this.selectedTexture.copyImageData({
|
|
4170
|
-
data:
|
|
4171
|
-
bytesPerRow:
|
|
4399
|
+
data: d,
|
|
4400
|
+
bytesPerRow: g("rgba32float", r),
|
|
4172
4401
|
mipLevel: 0,
|
|
4173
4402
|
x: 0,
|
|
4174
4403
|
y: 0
|
|
@@ -4210,9 +4439,9 @@ class At extends w {
|
|
|
4210
4439
|
spaceSize: o.adjustedSpaceSize ?? 0
|
|
4211
4440
|
}
|
|
4212
4441
|
}
|
|
4213
|
-
})), this.updatePositionCommand || (this.updatePositionCommand = new
|
|
4214
|
-
fs:
|
|
4215
|
-
vs:
|
|
4442
|
+
})), this.updatePositionCommand || (this.updatePositionCommand = new v(t, {
|
|
4443
|
+
fs: vt,
|
|
4444
|
+
vs: D,
|
|
4216
4445
|
topology: "triangle-strip",
|
|
4217
4446
|
vertexCount: 4,
|
|
4218
4447
|
attributes: {
|
|
@@ -4240,13 +4469,13 @@ class At extends w {
|
|
|
4240
4469
|
index: "f32"
|
|
4241
4470
|
},
|
|
4242
4471
|
defaultUniforms: {
|
|
4243
|
-
mousePos:
|
|
4472
|
+
mousePos: T(o.mousePosition, [0, 0]),
|
|
4244
4473
|
index: ((n = o.hoveredPoint) == null ? void 0 : n.index) ?? -1
|
|
4245
4474
|
}
|
|
4246
4475
|
}
|
|
4247
|
-
})), this.dragPointCommand || (this.dragPointCommand = new
|
|
4248
|
-
fs:
|
|
4249
|
-
vs:
|
|
4476
|
+
})), this.dragPointCommand || (this.dragPointCommand = new v(t, {
|
|
4477
|
+
fs: mt,
|
|
4478
|
+
vs: D,
|
|
4250
4479
|
topology: "triangle-strip",
|
|
4251
4480
|
vertexCount: 4,
|
|
4252
4481
|
attributes: {
|
|
@@ -4287,21 +4516,21 @@ class At extends w {
|
|
|
4287
4516
|
},
|
|
4288
4517
|
defaultUniforms: {
|
|
4289
4518
|
// Order MUST match uniformTypes and shader declaration
|
|
4290
|
-
ratio: i.pixelRatio ??
|
|
4519
|
+
ratio: i.pixelRatio ?? f.pixelRatio,
|
|
4291
4520
|
transformationMatrix: (() => {
|
|
4292
|
-
const
|
|
4521
|
+
const d = o.transform ?? [1, 0, 0, 0, 1, 0, 0, 0, 1];
|
|
4293
4522
|
return [
|
|
4294
|
-
|
|
4295
|
-
|
|
4296
|
-
|
|
4523
|
+
d[0],
|
|
4524
|
+
d[1],
|
|
4525
|
+
d[2],
|
|
4297
4526
|
0,
|
|
4298
|
-
|
|
4299
|
-
|
|
4300
|
-
|
|
4527
|
+
d[3],
|
|
4528
|
+
d[4],
|
|
4529
|
+
d[5],
|
|
4301
4530
|
0,
|
|
4302
|
-
|
|
4303
|
-
|
|
4304
|
-
|
|
4531
|
+
d[6],
|
|
4532
|
+
d[7],
|
|
4533
|
+
d[8],
|
|
4305
4534
|
0,
|
|
4306
4535
|
0,
|
|
4307
4536
|
0,
|
|
@@ -4312,9 +4541,9 @@ class At extends w {
|
|
|
4312
4541
|
pointsTextureSize: o.pointsTextureSize ?? 0,
|
|
4313
4542
|
sizeScale: i.pointSizeScale ?? 1,
|
|
4314
4543
|
spaceSize: o.adjustedSpaceSize ?? 0,
|
|
4315
|
-
screenSize:
|
|
4316
|
-
greyoutColor:
|
|
4317
|
-
backgroundColor:
|
|
4544
|
+
screenSize: T(o.screenSize, [0, 0]),
|
|
4545
|
+
greyoutColor: m(o.greyoutPointColor, [0, 0, 0, 1]),
|
|
4546
|
+
backgroundColor: m(o.backgroundColor, [0, 0, 0, 1]),
|
|
4318
4547
|
scalePointsOnZoom: i.scalePointsOnZoom ?? !0 ? 1 : 0,
|
|
4319
4548
|
// Convert boolean to float
|
|
4320
4549
|
maxPointSize: o.maxPointSize ?? 100,
|
|
@@ -4342,12 +4571,12 @@ class At extends w {
|
|
|
4342
4571
|
pointOpacity: i.pointOpacity ?? 1,
|
|
4343
4572
|
isDarkenGreyout: o.isDarkenGreyout ?? !1 ? 1 : 0,
|
|
4344
4573
|
// Convert boolean to float
|
|
4345
|
-
backgroundColor:
|
|
4574
|
+
backgroundColor: m(o.backgroundColor, [0, 0, 0, 1])
|
|
4346
4575
|
}
|
|
4347
4576
|
}
|
|
4348
|
-
})), this.drawCommand || (this.drawCommand = new
|
|
4349
|
-
fs:
|
|
4350
|
-
vs:
|
|
4577
|
+
})), this.drawCommand || (this.drawCommand = new v(t, {
|
|
4578
|
+
fs: ut,
|
|
4579
|
+
vs: St,
|
|
4351
4580
|
topology: "point-list",
|
|
4352
4581
|
vertexCount: s.pointsNumber ?? 0,
|
|
4353
4582
|
attributes: {
|
|
@@ -4406,18 +4635,18 @@ class At extends w {
|
|
|
4406
4635
|
defaultUniforms: {
|
|
4407
4636
|
sizeScale: i.pointSizeScale ?? 1,
|
|
4408
4637
|
spaceSize: o.adjustedSpaceSize ?? 0,
|
|
4409
|
-
screenSize:
|
|
4410
|
-
ratio: i.pixelRatio ??
|
|
4638
|
+
screenSize: T(o.screenSize, [0, 0]),
|
|
4639
|
+
ratio: i.pixelRatio ?? f.pixelRatio,
|
|
4411
4640
|
transformationMatrix: o.transformationMatrix4x4,
|
|
4412
|
-
selection0:
|
|
4413
|
-
selection1:
|
|
4641
|
+
selection0: T((r = o.selectedArea) == null ? void 0 : r[0], [0, 0]),
|
|
4642
|
+
selection1: T((a = o.selectedArea) == null ? void 0 : a[1], [0, 0]),
|
|
4414
4643
|
scalePointsOnZoom: i.scalePointsOnZoom ?? !0 ? 1 : 0,
|
|
4415
4644
|
maxPointSize: o.maxPointSize ?? 100
|
|
4416
4645
|
}
|
|
4417
4646
|
}
|
|
4418
|
-
})), this.findPointsOnAreaSelectionCommand || (this.findPointsOnAreaSelectionCommand = new
|
|
4419
|
-
fs:
|
|
4420
|
-
vs:
|
|
4647
|
+
})), this.findPointsOnAreaSelectionCommand || (this.findPointsOnAreaSelectionCommand = new v(t, {
|
|
4648
|
+
fs: pt,
|
|
4649
|
+
vs: D,
|
|
4421
4650
|
topology: "triangle-strip",
|
|
4422
4651
|
vertexCount: 4,
|
|
4423
4652
|
attributes: {
|
|
@@ -4448,14 +4677,14 @@ class At extends w {
|
|
|
4448
4677
|
},
|
|
4449
4678
|
defaultUniforms: {
|
|
4450
4679
|
spaceSize: o.adjustedSpaceSize ?? 0,
|
|
4451
|
-
screenSize:
|
|
4680
|
+
screenSize: T(o.screenSize, [0, 0]),
|
|
4452
4681
|
transformationMatrix: o.transformationMatrix4x4,
|
|
4453
4682
|
polygonPathLength: this.polygonPathLength
|
|
4454
4683
|
}
|
|
4455
4684
|
}
|
|
4456
|
-
})), this.findPointsOnPolygonSelectionCommand || (this.findPointsOnPolygonSelectionCommand = new
|
|
4457
|
-
fs:
|
|
4458
|
-
vs:
|
|
4685
|
+
})), this.findPointsOnPolygonSelectionCommand || (this.findPointsOnPolygonSelectionCommand = new v(t, {
|
|
4686
|
+
fs: _t,
|
|
4687
|
+
vs: D,
|
|
4459
4688
|
topology: "triangle-strip",
|
|
4460
4689
|
vertexCount: 4,
|
|
4461
4690
|
attributes: {
|
|
@@ -4493,19 +4722,19 @@ class At extends w {
|
|
|
4493
4722
|
pointsTextureSize: o.pointsTextureSize ?? 0,
|
|
4494
4723
|
sizeScale: i.pointSizeScale ?? 1,
|
|
4495
4724
|
spaceSize: o.adjustedSpaceSize ?? 0,
|
|
4496
|
-
screenSize:
|
|
4497
|
-
ratio: i.pixelRatio ??
|
|
4725
|
+
screenSize: T(o.screenSize, [0, 0]),
|
|
4726
|
+
ratio: i.pixelRatio ?? f.pixelRatio,
|
|
4498
4727
|
transformationMatrix: o.transformationMatrix4x4,
|
|
4499
|
-
mousePosition:
|
|
4728
|
+
mousePosition: T(o.screenMousePosition, [0, 0]),
|
|
4500
4729
|
scalePointsOnZoom: i.scalePointsOnZoom ?? !0 ? 1 : 0,
|
|
4501
4730
|
maxPointSize: o.maxPointSize ?? 100,
|
|
4502
4731
|
skipSelected: 0,
|
|
4503
4732
|
skipUnselected: 0
|
|
4504
4733
|
}
|
|
4505
4734
|
}
|
|
4506
|
-
})), this.findHoveredPointCommand || (this.findHoveredPointCommand = new
|
|
4507
|
-
fs:
|
|
4508
|
-
vs:
|
|
4735
|
+
})), this.findHoveredPointCommand || (this.findHoveredPointCommand = new v(t, {
|
|
4736
|
+
fs: Ct,
|
|
4737
|
+
vs: Pt,
|
|
4509
4738
|
topology: "point-list",
|
|
4510
4739
|
vertexCount: s.pointsNumber ?? 0,
|
|
4511
4740
|
attributes: {
|
|
@@ -4544,12 +4773,12 @@ class At extends w {
|
|
|
4544
4773
|
pointsTextureSize: o.pointsTextureSize ?? 0,
|
|
4545
4774
|
transformationMatrix: o.transformationMatrix4x4,
|
|
4546
4775
|
spaceSize: o.adjustedSpaceSize ?? 0,
|
|
4547
|
-
screenSize:
|
|
4776
|
+
screenSize: T(o.screenSize, [0, 0])
|
|
4548
4777
|
}
|
|
4549
4778
|
}
|
|
4550
|
-
})), this.fillSampledPointsFboCommand || (this.fillSampledPointsFboCommand = new
|
|
4551
|
-
fs:
|
|
4552
|
-
vs:
|
|
4779
|
+
})), this.fillSampledPointsFboCommand || (this.fillSampledPointsFboCommand = new v(t, {
|
|
4780
|
+
fs: Rt,
|
|
4781
|
+
vs: xt,
|
|
4553
4782
|
topology: "point-list",
|
|
4554
4783
|
vertexCount: s.pointsNumber ?? 0,
|
|
4555
4784
|
attributes: {
|
|
@@ -4602,7 +4831,7 @@ class At extends w {
|
|
|
4602
4831
|
pointsTextureSize: o.pointsTextureSize ?? 0,
|
|
4603
4832
|
sizeScale: i.pointSizeScale ?? 1,
|
|
4604
4833
|
spaceSize: o.adjustedSpaceSize ?? 0,
|
|
4605
|
-
screenSize:
|
|
4834
|
+
screenSize: T(o.screenSize, [0, 0]),
|
|
4606
4835
|
scalePointsOnZoom: i.scalePointsOnZoom ?? !0 ? 1 : 0,
|
|
4607
4836
|
pointIndex: -1,
|
|
4608
4837
|
maxPointSize: o.maxPointSize ?? 100,
|
|
@@ -4610,14 +4839,14 @@ class At extends w {
|
|
|
4610
4839
|
universalPointOpacity: i.pointOpacity ?? 1,
|
|
4611
4840
|
greyoutOpacity: i.pointGreyoutOpacity ?? -1,
|
|
4612
4841
|
isDarkenGreyout: o.isDarkenGreyout ?? !1 ? 1 : 0,
|
|
4613
|
-
backgroundColor:
|
|
4614
|
-
greyoutColor:
|
|
4842
|
+
backgroundColor: m(o.backgroundColor, [0, 0, 0, 1]),
|
|
4843
|
+
greyoutColor: m(o.greyoutPointColor, [0, 0, 0, 1]),
|
|
4615
4844
|
width: 0.85
|
|
4616
4845
|
}
|
|
4617
4846
|
}
|
|
4618
|
-
})), this.drawHighlightedCommand || (this.drawHighlightedCommand = new
|
|
4619
|
-
fs:
|
|
4620
|
-
vs:
|
|
4847
|
+
})), this.drawHighlightedCommand || (this.drawHighlightedCommand = new v(t, {
|
|
4848
|
+
fs: Tt,
|
|
4849
|
+
vs: gt,
|
|
4621
4850
|
topology: "triangle-strip",
|
|
4622
4851
|
vertexCount: 4,
|
|
4623
4852
|
attributes: {
|
|
@@ -4658,9 +4887,9 @@ class At extends w {
|
|
|
4658
4887
|
pointsTextureSize: o.pointsTextureSize ?? 0
|
|
4659
4888
|
}
|
|
4660
4889
|
}
|
|
4661
|
-
})), this.trackPointsCommand || (this.trackPointsCommand = new
|
|
4662
|
-
fs:
|
|
4663
|
-
vs:
|
|
4890
|
+
})), this.trackPointsCommand || (this.trackPointsCommand = new v(t, {
|
|
4891
|
+
fs: At,
|
|
4892
|
+
vs: D,
|
|
4664
4893
|
topology: "triangle-strip",
|
|
4665
4894
|
vertexCount: 4,
|
|
4666
4895
|
attributes: {
|
|
@@ -4704,13 +4933,13 @@ class At extends w {
|
|
|
4704
4933
|
format: "rgba32float"
|
|
4705
4934
|
}), this.greyoutStatusTexture.copyImageData({
|
|
4706
4935
|
data: s,
|
|
4707
|
-
bytesPerRow:
|
|
4936
|
+
bytesPerRow: g("rgba32float", o),
|
|
4708
4937
|
mipLevel: 0,
|
|
4709
4938
|
x: 0,
|
|
4710
4939
|
y: 0
|
|
4711
4940
|
})) : this.greyoutStatusTexture.copyImageData({
|
|
4712
4941
|
data: s,
|
|
4713
|
-
bytesPerRow:
|
|
4942
|
+
bytesPerRow: g("rgba32float", o),
|
|
4714
4943
|
mipLevel: 0,
|
|
4715
4944
|
x: 0,
|
|
4716
4945
|
y: 0
|
|
@@ -4729,13 +4958,13 @@ class At extends w {
|
|
|
4729
4958
|
format: "rgba32float"
|
|
4730
4959
|
}), this.pinnedStatusTexture.copyImageData({
|
|
4731
4960
|
data: s,
|
|
4732
|
-
bytesPerRow:
|
|
4961
|
+
bytesPerRow: g("rgba32float", i),
|
|
4733
4962
|
mipLevel: 0,
|
|
4734
4963
|
x: 0,
|
|
4735
4964
|
y: 0
|
|
4736
4965
|
})) : this.pinnedStatusTexture.copyImageData({
|
|
4737
4966
|
data: s,
|
|
4738
|
-
bytesPerRow:
|
|
4967
|
+
bytesPerRow: g("rgba32float", i),
|
|
4739
4968
|
mipLevel: 0,
|
|
4740
4969
|
x: 0,
|
|
4741
4970
|
y: 0
|
|
@@ -4760,13 +4989,13 @@ class At extends w {
|
|
|
4760
4989
|
format: "rgba32float"
|
|
4761
4990
|
}), this.sizeTexture.copyImageData({
|
|
4762
4991
|
data: r,
|
|
4763
|
-
bytesPerRow:
|
|
4992
|
+
bytesPerRow: g("rgba32float", i),
|
|
4764
4993
|
mipLevel: 0,
|
|
4765
4994
|
x: 0,
|
|
4766
4995
|
y: 0
|
|
4767
4996
|
})) : this.sizeTexture.copyImageData({
|
|
4768
4997
|
data: r,
|
|
4769
|
-
bytesPerRow:
|
|
4998
|
+
bytesPerRow: g("rgba32float", i),
|
|
4770
4999
|
mipLevel: 0,
|
|
4771
5000
|
x: 0,
|
|
4772
5001
|
y: 0
|
|
@@ -4806,9 +5035,9 @@ class At extends w {
|
|
|
4806
5035
|
});
|
|
4807
5036
|
}
|
|
4808
5037
|
createAtlas() {
|
|
4809
|
-
var
|
|
5038
|
+
var l;
|
|
4810
5039
|
const { device: t, data: i, store: o } = this;
|
|
4811
|
-
if (!((
|
|
5040
|
+
if (!((l = i.inputImageData) != null && l.length)) {
|
|
4812
5041
|
this.imageCount = 0, this.imageAtlasCoordsTextureSize = 0, this.imageAtlasCoordsTexture || (this.imageAtlasCoordsTexture = t.createTexture({
|
|
4813
5042
|
data: new Float32Array(4).fill(0),
|
|
4814
5043
|
width: 1,
|
|
@@ -4822,32 +5051,32 @@ class At extends w {
|
|
|
4822
5051
|
}));
|
|
4823
5052
|
return;
|
|
4824
5053
|
}
|
|
4825
|
-
const s =
|
|
5054
|
+
const s = It(i.inputImageData, o.webglMaxTextureSize);
|
|
4826
5055
|
if (!s) {
|
|
4827
5056
|
console.warn("Failed to create atlas from image data");
|
|
4828
5057
|
return;
|
|
4829
5058
|
}
|
|
4830
5059
|
this.imageCount = i.inputImageData.length;
|
|
4831
|
-
const { atlasData: n, atlasSize: r, atlasCoords: a, atlasCoordsSize:
|
|
4832
|
-
this.imageAtlasCoordsTextureSize =
|
|
5060
|
+
const { atlasData: n, atlasSize: r, atlasCoords: a, atlasCoordsSize: d } = s;
|
|
5061
|
+
this.imageAtlasCoordsTextureSize = d, this.imageAtlasTexture && !this.imageAtlasTexture.destroyed && this.imageAtlasTexture.destroy(), this.imageAtlasTexture = t.createTexture({
|
|
4833
5062
|
width: r,
|
|
4834
5063
|
height: r,
|
|
4835
5064
|
format: "rgba8unorm"
|
|
4836
5065
|
}), this.imageAtlasTexture.copyImageData({
|
|
4837
5066
|
data: n,
|
|
4838
|
-
bytesPerRow:
|
|
5067
|
+
bytesPerRow: g("rgba8unorm", r),
|
|
4839
5068
|
rowsPerImage: r,
|
|
4840
5069
|
mipLevel: 0,
|
|
4841
5070
|
x: 0,
|
|
4842
5071
|
y: 0
|
|
4843
5072
|
}), this.imageAtlasCoordsTexture && !this.imageAtlasCoordsTexture.destroyed && this.imageAtlasCoordsTexture.destroy(), this.imageAtlasCoordsTexture = t.createTexture({
|
|
4844
|
-
width:
|
|
4845
|
-
height:
|
|
5073
|
+
width: d,
|
|
5074
|
+
height: d,
|
|
4846
5075
|
format: "rgba32float"
|
|
4847
5076
|
}), this.imageAtlasCoordsTexture.copyImageData({
|
|
4848
5077
|
data: a,
|
|
4849
|
-
bytesPerRow:
|
|
4850
|
-
rowsPerImage:
|
|
5078
|
+
bytesPerRow: g("rgba32float", d),
|
|
5079
|
+
rowsPerImage: d,
|
|
4851
5080
|
mipLevel: 0,
|
|
4852
5081
|
x: 0,
|
|
4853
5082
|
y: 0
|
|
@@ -4856,9 +5085,9 @@ class At extends w {
|
|
|
4856
5085
|
updateSampledPointsGrid() {
|
|
4857
5086
|
const { store: { screenSize: t }, config: { pointSamplingDistance: i }, device: o } = this;
|
|
4858
5087
|
let s = i ?? Math.min(...t) / 2;
|
|
4859
|
-
s === 0 && (s =
|
|
5088
|
+
s === 0 && (s = f.pointSamplingDistance);
|
|
4860
5089
|
const n = Math.ceil(t[0] / s), r = Math.ceil(t[1] / s);
|
|
4861
|
-
(!this.sampledPointsFbo || this.sampledPointsFbo.width !== n || this.sampledPointsFbo.height !== r) && (this.sampledPointsFbo && !this.sampledPointsFbo.destroyed && this.sampledPointsFbo.destroy(), this.sampledPointsFbo = o.createFramebuffer({
|
|
5090
|
+
n === 0 || r === 0 || (!this.sampledPointsFbo || this.sampledPointsFbo.width !== n || this.sampledPointsFbo.height !== r) && (this.sampledPointsFbo && !this.sampledPointsFbo.destroyed && this.sampledPointsFbo.destroy(), this.sampledPointsFbo = o.createFramebuffer({
|
|
4862
5091
|
width: n,
|
|
4863
5092
|
height: r,
|
|
4864
5093
|
colorAttachments: ["rgba32float"]
|
|
@@ -4881,20 +5110,20 @@ class At extends w {
|
|
|
4881
5110
|
this.trackPointsCommand.draw(t), t.end();
|
|
4882
5111
|
}
|
|
4883
5112
|
draw(t) {
|
|
4884
|
-
var a,
|
|
5113
|
+
var a, d;
|
|
4885
5114
|
const { data: i, config: o, store: s } = this;
|
|
4886
5115
|
if (this.colorBuffer || this.updateColor(), this.sizeBuffer || this.updateSize(), this.shapeBuffer || this.updateShape(), this.imageIndicesBuffer || this.updateImageIndices(), this.imageSizesBuffer || this.updateImageSizes(), !this.drawCommand || !this.drawUniformStore || !this.currentPositionTexture || this.currentPositionTexture.destroyed || !this.greyoutStatusTexture || this.greyoutStatusTexture.destroyed || (!this.imageAtlasTexture || !this.imageAtlasCoordsTexture) && (this.createAtlas(), !this.imageAtlasTexture || !this.imageAtlasCoordsTexture) || this.imageAtlasTexture.destroyed || this.imageAtlasCoordsTexture.destroyed || !i.pointsNumber || i.pointsNumber === 0 || !s.screenSize || s.screenSize[0] === 0 || s.screenSize[1] === 0)
|
|
4887
5116
|
return;
|
|
4888
5117
|
this.drawCommand.setVertexCount(i.pointsNumber);
|
|
4889
5118
|
const n = {
|
|
4890
|
-
ratio: o.pixelRatio ??
|
|
5119
|
+
ratio: o.pixelRatio ?? f.pixelRatio,
|
|
4891
5120
|
transformationMatrix: s.transformationMatrix4x4,
|
|
4892
5121
|
pointsTextureSize: s.pointsTextureSize ?? 0,
|
|
4893
5122
|
sizeScale: o.pointSizeScale ?? 1,
|
|
4894
5123
|
spaceSize: s.adjustedSpaceSize ?? 0,
|
|
4895
|
-
screenSize:
|
|
4896
|
-
greyoutColor:
|
|
4897
|
-
backgroundColor:
|
|
5124
|
+
screenSize: T(s.screenSize, [0, 0]),
|
|
5125
|
+
greyoutColor: m(s.greyoutPointColor, [-1, -1, -1, -1]),
|
|
5126
|
+
backgroundColor: m(s.backgroundColor, [0, 0, 0, 1]),
|
|
4898
5127
|
scalePointsOnZoom: o.scalePointsOnZoom ?? !0 ? 1 : 0,
|
|
4899
5128
|
// Convert boolean to float
|
|
4900
5129
|
maxPointSize: s.maxPointSize ?? 100,
|
|
@@ -4909,7 +5138,7 @@ class At extends w {
|
|
|
4909
5138
|
pointOpacity: o.pointOpacity ?? 1,
|
|
4910
5139
|
isDarkenGreyout: s.isDarkenGreyout ?? !1 ? 1 : 0,
|
|
4911
5140
|
// Convert boolean to float
|
|
4912
|
-
backgroundColor:
|
|
5141
|
+
backgroundColor: m(s.backgroundColor, [0, 0, 0, 1])
|
|
4913
5142
|
};
|
|
4914
5143
|
if (s.selectedIndices && s.selectedIndices.length > 0 ? (this.drawUniformStore.setUniforms({
|
|
4915
5144
|
drawVertexUniforms: {
|
|
@@ -4955,24 +5184,24 @@ class At extends w {
|
|
|
4955
5184
|
imageAtlasCoords: this.imageAtlasCoordsTexture
|
|
4956
5185
|
}), this.drawCommand.draw(t)), o.renderHoveredPointRing && s.hoveredPoint && this.drawHighlightedCommand && this.drawHighlightedUniformStore) {
|
|
4957
5186
|
if (!this.currentPositionTexture || this.currentPositionTexture.destroyed || !this.greyoutStatusTexture || this.greyoutStatusTexture.destroyed) return;
|
|
4958
|
-
const
|
|
5187
|
+
const l = ((a = i.pointSizes) == null ? void 0 : a[s.hoveredPoint.index]) ?? 1;
|
|
4959
5188
|
this.drawHighlightedUniformStore.setUniforms({
|
|
4960
5189
|
drawHighlightedUniforms: {
|
|
4961
|
-
size:
|
|
5190
|
+
size: l,
|
|
4962
5191
|
transformationMatrix: s.transformationMatrix4x4,
|
|
4963
5192
|
pointsTextureSize: s.pointsTextureSize ?? 0,
|
|
4964
5193
|
sizeScale: o.pointSizeScale ?? 1,
|
|
4965
5194
|
spaceSize: s.adjustedSpaceSize ?? 0,
|
|
4966
|
-
screenSize:
|
|
5195
|
+
screenSize: T(s.screenSize, [0, 0]),
|
|
4967
5196
|
scalePointsOnZoom: o.scalePointsOnZoom ?? !0 ? 1 : 0,
|
|
4968
5197
|
pointIndex: s.hoveredPoint.index,
|
|
4969
5198
|
maxPointSize: s.maxPointSize ?? 100,
|
|
4970
|
-
color:
|
|
5199
|
+
color: m(s.hoveredPointRingColor, [0, 0, 0, 1]),
|
|
4971
5200
|
universalPointOpacity: o.pointOpacity ?? 1,
|
|
4972
5201
|
greyoutOpacity: o.pointGreyoutOpacity ?? -1,
|
|
4973
5202
|
isDarkenGreyout: s.isDarkenGreyout ?? !1 ? 1 : 0,
|
|
4974
|
-
backgroundColor:
|
|
4975
|
-
greyoutColor:
|
|
5203
|
+
backgroundColor: m(s.backgroundColor, [0, 0, 0, 1]),
|
|
5204
|
+
greyoutColor: m(s.greyoutPointColor, [0, 0, 0, 1]),
|
|
4976
5205
|
width: 0.85
|
|
4977
5206
|
}
|
|
4978
5207
|
}), this.drawHighlightedCommand.setBindings({
|
|
@@ -4982,24 +5211,24 @@ class At extends w {
|
|
|
4982
5211
|
}
|
|
4983
5212
|
if (s.focusedPoint && this.drawHighlightedCommand && this.drawHighlightedUniformStore) {
|
|
4984
5213
|
if (!this.currentPositionTexture || this.currentPositionTexture.destroyed || !this.greyoutStatusTexture || this.greyoutStatusTexture.destroyed) return;
|
|
4985
|
-
const
|
|
5214
|
+
const l = ((d = i.pointSizes) == null ? void 0 : d[s.focusedPoint.index]) ?? 1;
|
|
4986
5215
|
this.drawHighlightedUniformStore.setUniforms({
|
|
4987
5216
|
drawHighlightedUniforms: {
|
|
4988
|
-
size:
|
|
5217
|
+
size: l,
|
|
4989
5218
|
transformationMatrix: s.transformationMatrix4x4,
|
|
4990
5219
|
pointsTextureSize: s.pointsTextureSize ?? 0,
|
|
4991
5220
|
sizeScale: o.pointSizeScale ?? 1,
|
|
4992
5221
|
spaceSize: s.adjustedSpaceSize ?? 0,
|
|
4993
|
-
screenSize:
|
|
5222
|
+
screenSize: T(s.screenSize, [0, 0]),
|
|
4994
5223
|
scalePointsOnZoom: o.scalePointsOnZoom ?? !0 ? 1 : 0,
|
|
4995
5224
|
pointIndex: s.focusedPoint.index,
|
|
4996
5225
|
maxPointSize: s.maxPointSize ?? 100,
|
|
4997
|
-
color:
|
|
5226
|
+
color: m(s.focusedPointRingColor, [0, 0, 0, 1]),
|
|
4998
5227
|
universalPointOpacity: o.pointOpacity ?? 1,
|
|
4999
5228
|
greyoutOpacity: o.pointGreyoutOpacity ?? -1,
|
|
5000
5229
|
isDarkenGreyout: s.isDarkenGreyout ?? !1 ? 1 : 0,
|
|
5001
|
-
backgroundColor:
|
|
5002
|
-
greyoutColor:
|
|
5230
|
+
backgroundColor: m(s.backgroundColor, [0, 0, 0, 1]),
|
|
5231
|
+
greyoutColor: m(s.greyoutPointColor, [0, 0, 0, 1]),
|
|
5003
5232
|
width: 0.85
|
|
5004
5233
|
}
|
|
5005
5234
|
}), this.drawHighlightedCommand.setBindings({
|
|
@@ -5030,7 +5259,7 @@ class At extends w {
|
|
|
5030
5259
|
if (!this.dragPointCommand || !this.dragPointUniformStore || !this.currentPositionFbo || this.currentPositionFbo.destroyed || !this.previousPositionTexture || this.previousPositionTexture.destroyed) return;
|
|
5031
5260
|
this.dragPointUniformStore.setUniforms({
|
|
5032
5261
|
dragPointUniforms: {
|
|
5033
|
-
mousePos:
|
|
5262
|
+
mousePos: T(this.store.mousePosition, [0, 0]),
|
|
5034
5263
|
index: ((i = this.store.hoveredPoint) == null ? void 0 : i.index) ?? -1
|
|
5035
5264
|
}
|
|
5036
5265
|
}), this.dragPointCommand.setBindings({
|
|
@@ -5047,12 +5276,12 @@ class At extends w {
|
|
|
5047
5276
|
this.findPointsOnAreaSelectionUniformStore.setUniforms({
|
|
5048
5277
|
findPointsOnAreaSelectionUniforms: {
|
|
5049
5278
|
spaceSize: this.store.adjustedSpaceSize ?? 0,
|
|
5050
|
-
screenSize:
|
|
5279
|
+
screenSize: T(this.store.screenSize, [0, 0]),
|
|
5051
5280
|
sizeScale: this.config.pointSizeScale ?? 1,
|
|
5052
5281
|
transformationMatrix: this.store.transformationMatrix4x4,
|
|
5053
|
-
ratio: this.config.pixelRatio ??
|
|
5054
|
-
selection0:
|
|
5055
|
-
selection1:
|
|
5282
|
+
ratio: this.config.pixelRatio ?? f.pixelRatio,
|
|
5283
|
+
selection0: T((i = this.store.selectedArea) == null ? void 0 : i[0], [0, 0]),
|
|
5284
|
+
selection1: T((o = this.store.selectedArea) == null ? void 0 : o[1], [0, 0]),
|
|
5056
5285
|
scalePointsOnZoom: this.config.scalePointsOnZoom ?? !0 ? 1 : 0,
|
|
5057
5286
|
// Convert boolean to number
|
|
5058
5287
|
maxPointSize: this.store.maxPointSize ?? 100
|
|
@@ -5071,7 +5300,7 @@ class At extends w {
|
|
|
5071
5300
|
this.findPointsOnPolygonSelectionUniformStore.setUniforms({
|
|
5072
5301
|
findPointsOnPolygonSelectionUniforms: {
|
|
5073
5302
|
spaceSize: this.store.adjustedSpaceSize ?? 0,
|
|
5074
|
-
screenSize:
|
|
5303
|
+
screenSize: T(this.store.screenSize, [0, 0]),
|
|
5075
5304
|
transformationMatrix: this.store.transformationMatrix4x4,
|
|
5076
5305
|
polygonPathLength: this.polygonPathLength
|
|
5077
5306
|
}
|
|
@@ -5092,8 +5321,8 @@ class At extends w {
|
|
|
5092
5321
|
}
|
|
5093
5322
|
const o = Math.ceil(Math.sqrt(t.length)), s = new Float32Array(o * o * 4);
|
|
5094
5323
|
for (const [n, r] of t.entries()) {
|
|
5095
|
-
const [a,
|
|
5096
|
-
s[n * 4] = a, s[n * 4 + 1] =
|
|
5324
|
+
const [a, d] = r;
|
|
5325
|
+
s[n * 4] = a, s[n * 4 + 1] = d, s[n * 4 + 2] = 0, s[n * 4 + 3] = 0;
|
|
5097
5326
|
}
|
|
5098
5327
|
!this.polygonPathTexture || this.polygonPathTexture.width !== o || this.polygonPathTexture.height !== o ? (this.polygonPathTexture && !this.polygonPathTexture.destroyed && this.polygonPathTexture.destroy(), this.polygonPathTexture = i.createTexture({
|
|
5099
5328
|
width: o,
|
|
@@ -5101,13 +5330,13 @@ class At extends w {
|
|
|
5101
5330
|
format: "rgba32float"
|
|
5102
5331
|
}), this.polygonPathTexture.copyImageData({
|
|
5103
5332
|
data: s,
|
|
5104
|
-
bytesPerRow:
|
|
5333
|
+
bytesPerRow: g("rgba32float", o),
|
|
5105
5334
|
mipLevel: 0,
|
|
5106
5335
|
x: 0,
|
|
5107
5336
|
y: 0
|
|
5108
5337
|
})) : this.polygonPathTexture.copyImageData({
|
|
5109
5338
|
data: s,
|
|
5110
|
-
bytesPerRow:
|
|
5339
|
+
bytesPerRow: g("rgba32float", o),
|
|
5111
5340
|
mipLevel: 0,
|
|
5112
5341
|
x: 0,
|
|
5113
5342
|
y: 0
|
|
@@ -5120,14 +5349,14 @@ class At extends w {
|
|
|
5120
5349
|
...this.sizeBuffer && { size: this.sizeBuffer }
|
|
5121
5350
|
});
|
|
5122
5351
|
const t = {
|
|
5123
|
-
ratio: this.config.pixelRatio ??
|
|
5352
|
+
ratio: this.config.pixelRatio ?? f.pixelRatio,
|
|
5124
5353
|
sizeScale: this.config.pointSizeScale ?? 1,
|
|
5125
5354
|
pointsTextureSize: this.store.pointsTextureSize ?? 0,
|
|
5126
5355
|
transformationMatrix: this.store.transformationMatrix4x4,
|
|
5127
5356
|
spaceSize: this.store.adjustedSpaceSize ?? 0,
|
|
5128
|
-
screenSize:
|
|
5357
|
+
screenSize: T(this.store.screenSize, [0, 0]),
|
|
5129
5358
|
scalePointsOnZoom: this.config.scalePointsOnZoom ?? !0 ? 1 : 0,
|
|
5130
|
-
mousePosition:
|
|
5359
|
+
mousePosition: T(this.store.screenMousePosition, [0, 0]),
|
|
5131
5360
|
maxPointSize: this.store.maxPointSize ?? 100
|
|
5132
5361
|
}, i = {
|
|
5133
5362
|
positionsTexture: this.currentPositionTexture,
|
|
@@ -5168,13 +5397,13 @@ class At extends w {
|
|
|
5168
5397
|
format: "rgba32float"
|
|
5169
5398
|
}), this.trackedIndicesTexture.copyImageData({
|
|
5170
5399
|
data: n,
|
|
5171
|
-
bytesPerRow:
|
|
5400
|
+
bytesPerRow: g("rgba32float", s),
|
|
5172
5401
|
mipLevel: 0,
|
|
5173
5402
|
x: 0,
|
|
5174
5403
|
y: 0
|
|
5175
5404
|
})) : this.trackedIndicesTexture.copyImageData({
|
|
5176
5405
|
data: n,
|
|
5177
|
-
bytesPerRow:
|
|
5406
|
+
bytesPerRow: g("rgba32float", s),
|
|
5178
5407
|
mipLevel: 0,
|
|
5179
5408
|
x: 0,
|
|
5180
5409
|
y: 0
|
|
@@ -5198,10 +5427,10 @@ class At extends w {
|
|
|
5198
5427
|
if ((!t || !i) && this.isPositionsUpToDate && this.trackedPositions)
|
|
5199
5428
|
return this.trackedPositions;
|
|
5200
5429
|
if (!this.trackedPositionsFbo || this.trackedPositionsFbo.destroyed) return /* @__PURE__ */ new Map();
|
|
5201
|
-
const o =
|
|
5430
|
+
const o = y(this.device, this.trackedPositionsFbo), s = /* @__PURE__ */ new Map();
|
|
5202
5431
|
for (let n = 0; n < o.length / 4; n += 1) {
|
|
5203
|
-
const r = o[n * 4], a = o[n * 4 + 1],
|
|
5204
|
-
r !== void 0 && a !== void 0 &&
|
|
5432
|
+
const r = o[n * 4], a = o[n * 4 + 1], d = this.trackedIndices[n];
|
|
5433
|
+
r !== void 0 && a !== void 0 && d !== void 0 && s.set(d, [r, a]);
|
|
5205
5434
|
}
|
|
5206
5435
|
return (!t || !i) && (this.trackedPositions = s, this.isPositionsUpToDate = !0), s;
|
|
5207
5436
|
}
|
|
@@ -5215,7 +5444,7 @@ class At extends w {
|
|
|
5215
5444
|
pointsTextureSize: this.store.pointsTextureSize ?? 0,
|
|
5216
5445
|
transformationMatrix: this.store.transformationMatrix4x4,
|
|
5217
5446
|
spaceSize: this.store.adjustedSpaceSize ?? 0,
|
|
5218
|
-
screenSize:
|
|
5447
|
+
screenSize: T(this.store.screenSize, [0, 0])
|
|
5219
5448
|
}
|
|
5220
5449
|
}), this.fillSampledPointsFboCommand.setBindings({
|
|
5221
5450
|
positionsTexture: this.currentPositionTexture
|
|
@@ -5226,7 +5455,7 @@ class At extends w {
|
|
|
5226
5455
|
});
|
|
5227
5456
|
this.fillSampledPointsFboCommand.draw(o), o.end();
|
|
5228
5457
|
}
|
|
5229
|
-
const i =
|
|
5458
|
+
const i = y(this.device, this.sampledPointsFbo);
|
|
5230
5459
|
for (let o = 0; o < i.length / 4; o++) {
|
|
5231
5460
|
const s = i[o * 4], n = !!i[o * 4 + 1], r = i[o * 4 + 2], a = i[o * 4 + 3];
|
|
5232
5461
|
n && s !== void 0 && r !== void 0 && a !== void 0 && t.set(s, [r, a]);
|
|
@@ -5243,7 +5472,7 @@ class At extends w {
|
|
|
5243
5472
|
pointsTextureSize: this.store.pointsTextureSize ?? 0,
|
|
5244
5473
|
transformationMatrix: this.store.transformationMatrix4x4,
|
|
5245
5474
|
spaceSize: this.store.adjustedSpaceSize ?? 0,
|
|
5246
|
-
screenSize:
|
|
5475
|
+
screenSize: T(this.store.screenSize, [0, 0])
|
|
5247
5476
|
}
|
|
5248
5477
|
}), this.fillSampledPointsFboCommand.setBindings({
|
|
5249
5478
|
positionsTexture: this.currentPositionTexture
|
|
@@ -5254,10 +5483,10 @@ class At extends w {
|
|
|
5254
5483
|
});
|
|
5255
5484
|
this.fillSampledPointsFboCommand.draw(s), s.end();
|
|
5256
5485
|
}
|
|
5257
|
-
const o =
|
|
5486
|
+
const o = y(this.device, this.sampledPointsFbo);
|
|
5258
5487
|
for (let s = 0; s < o.length / 4; s++) {
|
|
5259
|
-
const n = o[s * 4], r = !!o[s * 4 + 1], a = o[s * 4 + 2],
|
|
5260
|
-
r && n !== void 0 && a !== void 0 &&
|
|
5488
|
+
const n = o[s * 4], r = !!o[s * 4 + 1], a = o[s * 4 + 2], d = o[s * 4 + 3];
|
|
5489
|
+
r && n !== void 0 && a !== void 0 && d !== void 0 && (t.push(n), i.push(a, d));
|
|
5261
5490
|
}
|
|
5262
5491
|
return { indices: t, positions: i };
|
|
5263
5492
|
}
|
|
@@ -5265,7 +5494,7 @@ class At extends w {
|
|
|
5265
5494
|
const t = [];
|
|
5266
5495
|
if (!this.trackedIndices || !this.trackedPositionsFbo || this.trackedPositionsFbo.destroyed) return t;
|
|
5267
5496
|
t.length = this.trackedIndices.length * 2;
|
|
5268
|
-
const i =
|
|
5497
|
+
const i = y(this.device, this.trackedPositionsFbo);
|
|
5269
5498
|
for (let o = 0; o < i.length / 4; o += 1) {
|
|
5270
5499
|
const s = i[o * 4], n = i[o * 4 + 1], r = this.trackedIndices[o];
|
|
5271
5500
|
s !== void 0 && n !== void 0 && r !== void 0 && (t[o * 2] = s, t[o * 2 + 1] = n);
|
|
@@ -5277,8 +5506,8 @@ class At extends w {
|
|
|
5277
5506
|
* Models -> Framebuffers -> Textures -> UniformStores -> Buffers
|
|
5278
5507
|
* */
|
|
5279
5508
|
destroy() {
|
|
5280
|
-
var t, i, o, s, n, r, a,
|
|
5281
|
-
(t = this.drawCommand) == null || t.destroy(), this.drawCommand = void 0, (i = this.drawHighlightedCommand) == null || i.destroy(), this.drawHighlightedCommand = void 0, (o = this.updatePositionCommand) == null || o.destroy(), this.updatePositionCommand = void 0, (s = this.dragPointCommand) == null || s.destroy(), this.dragPointCommand = void 0, (n = this.findPointsOnAreaSelectionCommand) == null || n.destroy(), this.findPointsOnAreaSelectionCommand = void 0, (r = this.findPointsOnPolygonSelectionCommand) == null || r.destroy(), this.findPointsOnPolygonSelectionCommand = void 0, (a = this.findHoveredPointCommand) == null || a.destroy(), this.findHoveredPointCommand = void 0, (
|
|
5509
|
+
var t, i, o, s, n, r, a, d, l, c, h, p, u, _, R, I, P, A;
|
|
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, (h = this.dragPointUniformStore) == null || h.destroy(), this.dragPointUniformStore = void 0, (p = this.drawUniformStore) == null || p.destroy(), this.drawUniformStore = void 0, (u = this.findPointsOnAreaSelectionUniformStore) == null || u.destroy(), this.findPointsOnAreaSelectionUniformStore = void 0, (_ = this.findPointsOnPolygonSelectionUniformStore) == null || _.destroy(), this.findPointsOnPolygonSelectionUniformStore = void 0, (R = this.findHoveredPointUniformStore) == null || R.destroy(), this.findHoveredPointUniformStore = void 0, (I = this.fillSampledPointsUniformStore) == null || I.destroy(), this.fillSampledPointsUniformStore = void 0, (P = this.drawHighlightedUniformStore) == null || P.destroy(), this.drawHighlightedUniformStore = void 0, (A = this.trackPointsUniformStore) == null || A.destroy(), this.trackPointsUniformStore = void 0, this.colorBuffer && !this.colorBuffer.destroyed && this.colorBuffer.destroy(), this.colorBuffer = void 0, this.sizeBuffer && !this.sizeBuffer.destroyed && this.sizeBuffer.destroy(), this.sizeBuffer = void 0, this.shapeBuffer && !this.shapeBuffer.destroyed && this.shapeBuffer.destroy(), this.shapeBuffer = void 0, this.imageIndicesBuffer && !this.imageIndicesBuffer.destroyed && this.imageIndicesBuffer.destroy(), this.imageIndicesBuffer = void 0, this.imageSizesBuffer && !this.imageSizesBuffer.destroyed && this.imageSizesBuffer.destroy(), this.imageSizesBuffer = void 0, this.drawPointIndices && !this.drawPointIndices.destroyed && this.drawPointIndices.destroy(), this.drawPointIndices = void 0, this.hoveredPointIndices && !this.hoveredPointIndices.destroyed && this.hoveredPointIndices.destroy(), this.hoveredPointIndices = void 0, this.sampledPointIndices && !this.sampledPointIndices.destroyed && this.sampledPointIndices.destroy(), this.sampledPointIndices = void 0, this.updatePositionVertexCoordBuffer && !this.updatePositionVertexCoordBuffer.destroyed && this.updatePositionVertexCoordBuffer.destroy(), this.updatePositionVertexCoordBuffer = void 0, this.dragPointVertexCoordBuffer && !this.dragPointVertexCoordBuffer.destroyed && this.dragPointVertexCoordBuffer.destroy(), this.dragPointVertexCoordBuffer = void 0, this.findPointsOnAreaSelectionVertexCoordBuffer && !this.findPointsOnAreaSelectionVertexCoordBuffer.destroyed && this.findPointsOnAreaSelectionVertexCoordBuffer.destroy(), this.findPointsOnAreaSelectionVertexCoordBuffer = void 0, this.findPointsOnPolygonSelectionVertexCoordBuffer && !this.findPointsOnPolygonSelectionVertexCoordBuffer.destroyed && this.findPointsOnPolygonSelectionVertexCoordBuffer.destroy(), this.findPointsOnPolygonSelectionVertexCoordBuffer = void 0, this.drawHighlightedVertexCoordBuffer && !this.drawHighlightedVertexCoordBuffer.destroyed && this.drawHighlightedVertexCoordBuffer.destroy(), this.drawHighlightedVertexCoordBuffer = void 0, this.trackPointsVertexCoordBuffer && !this.trackPointsVertexCoordBuffer.destroyed && this.trackPointsVertexCoordBuffer.destroy(), this.trackPointsVertexCoordBuffer = void 0;
|
|
5282
5511
|
}
|
|
5283
5512
|
swapFbo() {
|
|
5284
5513
|
if (!this.currentPositionTexture || this.currentPositionTexture.destroyed || !this.previousPositionTexture || this.previousPositionTexture.destroyed || !this.currentPositionFbo || this.currentPositionFbo.destroyed || !this.previousPositionFbo || this.previousPositionFbo.destroyed)
|
|
@@ -5291,24 +5520,24 @@ class At extends w {
|
|
|
5291
5520
|
if (!this.data.pointPositions || !t) return;
|
|
5292
5521
|
const i = this.data.pointPositions, o = i.length / 2;
|
|
5293
5522
|
let s = 1 / 0, n = -1 / 0, r = 1 / 0, a = -1 / 0;
|
|
5294
|
-
for (let
|
|
5295
|
-
const
|
|
5296
|
-
s = Math.min(s,
|
|
5523
|
+
for (let P = 0; P < i.length; P += 2) {
|
|
5524
|
+
const A = i[P], F = i[P + 1];
|
|
5525
|
+
s = Math.min(s, A), n = Math.max(n, A), r = Math.min(r, F), a = Math.max(a, F);
|
|
5297
5526
|
}
|
|
5298
|
-
const
|
|
5527
|
+
const d = n - s, l = a - r, c = Math.max(d, l);
|
|
5299
5528
|
if (c > t) {
|
|
5300
5529
|
this.scaleX = void 0, this.scaleY = void 0;
|
|
5301
5530
|
return;
|
|
5302
5531
|
}
|
|
5303
|
-
const
|
|
5304
|
-
this.scaleX = (
|
|
5305
|
-
for (let
|
|
5306
|
-
this.data.pointPositions[
|
|
5532
|
+
const h = t * t * 1e-3, p = o > h ? t * Math.max(1.2, Math.sqrt(o) / t) : t * 0.1, u = p / c, _ = (t - p) / 2, R = (c - d) / 2 * u + _, I = (c - l) / 2 * u + _;
|
|
5533
|
+
this.scaleX = (P) => (P - s) * u + R, this.scaleY = (P) => (P - r) * u + I;
|
|
5534
|
+
for (let P = 0; P < o; P++)
|
|
5535
|
+
this.data.pointPositions[P * 2] = this.scaleX(i[P * 2]), this.data.pointPositions[P * 2 + 1] = this.scaleY(i[P * 2 + 1]);
|
|
5307
5536
|
}
|
|
5308
5537
|
}
|
|
5309
|
-
class
|
|
5538
|
+
class Ft {
|
|
5310
5539
|
constructor(t, i) {
|
|
5311
|
-
this.eventTransform = W, this.behavior =
|
|
5540
|
+
this.eventTransform = W, this.behavior = pe().scaleExtent([1e-3, 1 / 0]).on("start", (o) => {
|
|
5312
5541
|
var n, r;
|
|
5313
5542
|
this.isRunning = !0;
|
|
5314
5543
|
const s = !!o.sourceEvent;
|
|
@@ -5316,11 +5545,11 @@ class vt {
|
|
|
5316
5545
|
}).on("zoom", (o) => {
|
|
5317
5546
|
var p, u;
|
|
5318
5547
|
this.eventTransform = o.transform;
|
|
5319
|
-
const { eventTransform: { x: s, y: n, k: r }, store: { transform: a, screenSize:
|
|
5320
|
-
if (!
|
|
5321
|
-
V.projection(a,
|
|
5322
|
-
const
|
|
5323
|
-
(u = (p = this.config) == null ? void 0 : p.onZoom) == null || u.call(p, o,
|
|
5548
|
+
const { eventTransform: { x: s, y: n, k: r }, store: { transform: a, screenSize: d } } = this, l = d[0], c = d[1];
|
|
5549
|
+
if (!l || !c) return;
|
|
5550
|
+
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 h = !!o.sourceEvent;
|
|
5552
|
+
(u = (p = this.config) == null ? void 0 : p.onZoom) == null || u.call(p, o, h);
|
|
5324
5553
|
}).on("end", (o) => {
|
|
5325
5554
|
var n, r;
|
|
5326
5555
|
this.isRunning = !1;
|
|
@@ -5339,26 +5568,26 @@ class vt {
|
|
|
5339
5568
|
getTransform(t, i, o = 0.1) {
|
|
5340
5569
|
if (t.length === 0) return this.eventTransform;
|
|
5341
5570
|
const { store: { screenSize: s } } = this, n = s[0], r = s[1];
|
|
5342
|
-
let a = 1 / 0,
|
|
5571
|
+
let a = 1 / 0, d = -1 / 0, l = 1 / 0, c = -1 / 0;
|
|
5343
5572
|
for (let E = 0; E < t.length; E += 2) {
|
|
5344
|
-
const
|
|
5345
|
-
|
|
5573
|
+
const N = t[E], O = t[E + 1];
|
|
5574
|
+
N < a && (a = N), N > d && (d = N), O < l && (l = O), O > c && (c = O);
|
|
5346
5575
|
}
|
|
5347
|
-
const
|
|
5348
|
-
|
|
5349
|
-
const u = n * (1 - o * 2) / (
|
|
5350
|
-
return W.translate(
|
|
5576
|
+
const h = [this.store.scaleX(a), this.store.scaleX(d)], p = [this.store.scaleY(l), this.store.scaleY(c)];
|
|
5577
|
+
h[0] === h[1] && (h[0] -= 0.5, h[1] += 0.5), p[0] === p[1] && (p[0] += 0.5, p[1] -= 0.5);
|
|
5578
|
+
const u = n * (1 - o * 2) / (h[1] - h[0]), _ = r * (1 - o * 2) / (p[0] - p[1]), R = Ue(i ?? Math.min(u, _), ...this.behavior.scaleExtent()), I = (h[1] + h[0]) / 2, P = (p[1] + p[0]) / 2, A = n / 2 - I * R, F = r / 2 - P * R;
|
|
5579
|
+
return W.translate(A, F).scale(R);
|
|
5351
5580
|
}
|
|
5352
5581
|
getDistanceToPoint(t) {
|
|
5353
5582
|
const { x: i, y: o, k: s } = this.eventTransform, n = this.getTransform(t, s), r = i - n.x, a = o - n.y;
|
|
5354
5583
|
return Math.sqrt(r * r + a * a);
|
|
5355
5584
|
}
|
|
5356
5585
|
getMiddlePointTransform(t) {
|
|
5357
|
-
const { store: { screenSize: i }, eventTransform: { x: o, y: s, k: n } } = this, r = i[0], a = i[1],
|
|
5358
|
-
return W.translate(
|
|
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]), h = this.store.scaleY(t[1]), p = (d + c) / 2, u = (l + h) / 2, _ = 1, R = r / 2 - p * _, I = a / 2 - u * _;
|
|
5587
|
+
return W.translate(R, I).scale(_);
|
|
5359
5588
|
}
|
|
5360
5589
|
convertScreenToSpacePosition(t) {
|
|
5361
|
-
const { eventTransform: { x: i, y: o, k: s }, store: { screenSize: n } } = this, r = n[0], a = n[1],
|
|
5590
|
+
const { eventTransform: { x: i, y: o, k: s }, store: { screenSize: n } } = this, r = n[0], a = n[1], d = (t[0] - i) / s, l = (t[1] - o) / s, c = [d, a - l];
|
|
5362
5591
|
return c[0] -= (r - this.store.adjustedSpaceSize) / 2, c[1] -= (a - this.store.adjustedSpaceSize) / 2, c;
|
|
5363
5592
|
}
|
|
5364
5593
|
convertSpaceToScreenPosition(t) {
|
|
@@ -5371,9 +5600,9 @@ class vt {
|
|
|
5371
5600
|
return i ? n *= s : n *= Math.min(5, Math.max(1, s * 0.01)), Math.min(n, o) / 2;
|
|
5372
5601
|
}
|
|
5373
5602
|
}
|
|
5374
|
-
class
|
|
5603
|
+
class Et {
|
|
5375
5604
|
constructor(t, i) {
|
|
5376
|
-
this.isActive = !1, this.behavior =
|
|
5605
|
+
this.isActive = !1, this.behavior = _e().subject((o) => this.store.hoveredPoint && !this.store.isSpaceKeyPressed ? { x: o.x, y: o.y } : void 0).on("start", (o) => {
|
|
5377
5606
|
var s, n;
|
|
5378
5607
|
this.store.hoveredPoint && (this.store.draggingPointIndex = this.store.hoveredPoint.index, this.isActive = !0, (n = (s = this.config) == null ? void 0 : s.onDragStart) == null || n.call(s, o));
|
|
5379
5608
|
}).on("drag", (o) => {
|
|
@@ -5385,49 +5614,50 @@ class It {
|
|
|
5385
5614
|
}), this.store = t, this.config = i;
|
|
5386
5615
|
}
|
|
5387
5616
|
}
|
|
5388
|
-
class
|
|
5617
|
+
class Lt {
|
|
5389
5618
|
constructor(t, i, o) {
|
|
5390
|
-
if (this.config = new
|
|
5619
|
+
if (this.config = new ke(), this.graph = new ot(this.config), this.isReady = !1, this.requestAnimationFrameId = 0, this.isRightClickMouse = !1, this.store = new Ee(), this.zoomInstance = new Ft(this.store, this.config), this.dragInstance = new Et(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 && this.config.init(i), o)
|
|
5391
5620
|
this.deviceInitPromise = o, this.shouldDestroyDevice = !1;
|
|
5392
5621
|
else {
|
|
5393
|
-
const
|
|
5394
|
-
this.deviceInitPromise = this.createDevice(
|
|
5622
|
+
const n = document.createElement("canvas");
|
|
5623
|
+
this.deviceInitPromise = this.createDevice(n), this.shouldDestroyDevice = !0;
|
|
5395
5624
|
}
|
|
5396
|
-
this.deviceInitPromise.then((
|
|
5625
|
+
const s = this.deviceInitPromise.then((n) => {
|
|
5397
5626
|
if (this._isDestroyed)
|
|
5398
|
-
return this.shouldDestroyDevice &&
|
|
5399
|
-
this.device =
|
|
5400
|
-
const
|
|
5401
|
-
o &&
|
|
5402
|
-
const
|
|
5403
|
-
|
|
5404
|
-
const
|
|
5405
|
-
return this.store.adjustSpaceSize(this.config.spaceSize, this.device.limits.maxTextureDimension2D), this.store.setWebGLMaxTextureSize(this.device.limits.maxTextureDimension2D), this.store.updateScreenSize(
|
|
5406
|
-
this._isMouseOnCanvas = !0, this._lastMouseX =
|
|
5407
|
-
}).on("mousemove.cosmos", (
|
|
5408
|
-
this._isMouseOnCanvas = !0, this._lastMouseX =
|
|
5409
|
-
}).on("mouseleave.cosmos", (
|
|
5410
|
-
this._isMouseOnCanvas = !1, this.currentEvent =
|
|
5411
|
-
}),
|
|
5412
|
-
|
|
5413
|
-
}).on("keyup.cosmos", (
|
|
5414
|
-
|
|
5415
|
-
}), this.zoomInstance.behavior.on("start.detect", (
|
|
5416
|
-
this.currentEvent =
|
|
5417
|
-
}).on("zoom.detect", (
|
|
5418
|
-
!!
|
|
5419
|
-
}).on("end.detect", (
|
|
5420
|
-
this.currentEvent =
|
|
5421
|
-
}), this.dragInstance.behavior.on("start.detect", (
|
|
5422
|
-
this.currentEvent =
|
|
5423
|
-
}).on("drag.detect", (
|
|
5424
|
-
this.dragInstance.isActive && this.updateMousePosition(
|
|
5425
|
-
}).on("end.detect", (
|
|
5426
|
-
this.currentEvent =
|
|
5427
|
-
}), this.canvasD3Selection.call(this.dragInstance.behavior).call(this.zoomInstance.behavior).on("click", this.onClick.bind(this)).on("mousemove", this.onMouseMove.bind(this)).on("contextmenu", this.onContextMenu.bind(this)), (!this.config.enableZoom || !this.config.enableDrag) && this.updateZoomDragBehaviors(), this.setZoomLevel(this.config.initialZoomLevel ?? 1), this.store.maxPointSize = $(
|
|
5428
|
-
}).catch((
|
|
5429
|
-
throw this.device = void 0, this.isReady = !1, console.error("Device initialization failed:",
|
|
5430
|
-
})
|
|
5627
|
+
return this.shouldDestroyDevice && n.destroy(), n;
|
|
5628
|
+
this.device = n, this.isReady = !0;
|
|
5629
|
+
const r = this.validateDevice(n);
|
|
5630
|
+
o && r.setProps({ useDevicePixels: this.config.pixelRatio }), this.store.div = t;
|
|
5631
|
+
const a = r.canvas;
|
|
5632
|
+
a.parentNode !== this.store.div && (a.parentNode && a.parentNode.removeChild(a), this.store.div.appendChild(a)), this.addAttribution(), a.style.width = "100%", a.style.height = "100%", this.canvas = a;
|
|
5633
|
+
const d = this.canvas.clientWidth, l = this.canvas.clientHeight;
|
|
5634
|
+
return this.store.adjustSpaceSize(this.config.spaceSize, this.device.limits.maxTextureDimension2D), this.store.setWebGLMaxTextureSize(this.device.limits.maxTextureDimension2D), this.store.updateScreenSize(d, l), this.canvasD3Selection = b(this.canvas), this.canvasD3Selection.on("mouseenter.cosmos", (c) => {
|
|
5635
|
+
this._isMouseOnCanvas = !0, this._lastMouseX = c.clientX, this._lastMouseY = c.clientY;
|
|
5636
|
+
}).on("mousemove.cosmos", (c) => {
|
|
5637
|
+
this._isMouseOnCanvas = !0, this._lastMouseX = c.clientX, this._lastMouseY = c.clientY;
|
|
5638
|
+
}).on("mouseleave.cosmos", (c) => {
|
|
5639
|
+
this._isMouseOnCanvas = !1, this.currentEvent = c, this.store.hoveredPoint !== void 0 && this.config.onPointMouseOut && this.config.onPointMouseOut(c), this.store.hoveredLinkIndex !== void 0 && this.config.onLinkMouseOut && this.config.onLinkMouseOut(c), this.isRightClickMouse = !1, this.store.hoveredPoint = void 0, this.store.hoveredLinkIndex = void 0, this.updateCanvasCursor();
|
|
5640
|
+
}), b(document).on("keydown.cosmos", (c) => {
|
|
5641
|
+
c.code === "Space" && (this.store.isSpaceKeyPressed = !0);
|
|
5642
|
+
}).on("keyup.cosmos", (c) => {
|
|
5643
|
+
c.code === "Space" && (this.store.isSpaceKeyPressed = !1);
|
|
5644
|
+
}), this.zoomInstance.behavior.on("start.detect", (c) => {
|
|
5645
|
+
this.currentEvent = c;
|
|
5646
|
+
}).on("zoom.detect", (c) => {
|
|
5647
|
+
!!c.sourceEvent && this.updateMousePosition(c.sourceEvent), this.currentEvent = c;
|
|
5648
|
+
}).on("end.detect", (c) => {
|
|
5649
|
+
this.currentEvent = c, this._shouldForceHoverDetection = !0;
|
|
5650
|
+
}), this.dragInstance.behavior.on("start.detect", (c) => {
|
|
5651
|
+
this.currentEvent = c, this.updateCanvasCursor();
|
|
5652
|
+
}).on("drag.detect", (c) => {
|
|
5653
|
+
this.dragInstance.isActive && this.updateMousePosition(c), this.currentEvent = c;
|
|
5654
|
+
}).on("end.detect", (c) => {
|
|
5655
|
+
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 = $(n, this.config.pixelRatio), this.store.isSimulationRunning = this.config.enableSimulation, this.points = new yt(n, this.config, this.store, this.graph), this.lines = new ht(n, this.config, this.store, this.graph, this.points), this.config.enableSimulation && (this.forceGravity = new Xe(n, this.config, this.store, this.graph, this.points), this.forceCenter = new Ve(n, this.config, this.store, this.graph, this.points), this.forceManyBody = new je(n, this.config, this.store, this.graph, this.points), this.forceLinkIncoming = new J(n, this.config, this.store, this.graph, this.points), this.forceLinkOutgoing = new J(n, this.config, this.store, this.graph, this.points), this.forceMouse = new Qe(n, this.config, this.store, this.graph, this.points)), this.clusters = new et(n, this.config, this.store, this.graph, this.points), this.store.backgroundColor = z(this.config.backgroundColor), this.store.setHoveredPointRingColor(this.config.hoveredPointRingColor ?? f.hoveredPointRingColor), this.store.setFocusedPointRingColor(this.config.focusedPointRingColor ?? f.focusedPointRingColor), this.config.focusedPointIndex !== void 0 && this.store.setFocusedPoint(this.config.focusedPointIndex), this.store.setGreyoutPointColor(this.config.pointGreyoutColor ?? Y), this.store.setHoveredLinkColor(this.config.hoveredLinkColor ?? f.hoveredLinkColor), this.store.updateLinkHoveringEnabled(this.config), this.config.showFPSMonitor && (this.fpsMonitor = new G(this.canvas)), this.config.randomSeed !== void 0 && this.store.addRandomSeed(this.config.randomSeed), n;
|
|
5657
|
+
}).catch((n) => {
|
|
5658
|
+
throw this.device = void 0, this.isReady = !1, console.error("Device initialization failed:", n), n;
|
|
5659
|
+
});
|
|
5660
|
+
this.ready = s.then(() => {
|
|
5431
5661
|
});
|
|
5432
5662
|
}
|
|
5433
5663
|
/**
|
|
@@ -5454,10 +5684,10 @@ class Ht {
|
|
|
5454
5684
|
* @param config Cosmos configuration object.
|
|
5455
5685
|
*/
|
|
5456
5686
|
setConfig(t) {
|
|
5457
|
-
var o, s, n, r, a,
|
|
5687
|
+
var o, s, n, r, a, d, l, c, h;
|
|
5458
5688
|
if (this._isDestroyed || this.ensureDevice(() => this.setConfig(t))) return;
|
|
5459
5689
|
const i = { ...this.config };
|
|
5460
|
-
this.config.init(t),
|
|
5690
|
+
this.config.init(t), i.pointDefaultColor !== this.config.pointDefaultColor && (this.graph.updatePointColor(), (o = this.points) == null || o.updateColor()), i.pointDefaultSize !== this.config.pointDefaultSize && (this.graph.updatePointSize(), (s = this.points) == null || s.updateSize()), i.linkDefaultColor !== this.config.linkDefaultColor && (this.graph.updateLinkColor(), (n = this.lines) == null || n.updateColor()), i.linkDefaultWidth !== this.config.linkDefaultWidth && (this.graph.updateLinkWidth(), (r = this.lines) == null || r.updateWidth()), i.linkDefaultArrows !== this.config.linkDefaultArrows && (this.graph.updateArrows(), (a = this.lines) == null || a.updateArrow()), (i.curvedLinkSegments !== this.config.curvedLinkSegments || i.curvedLinks !== this.config.curvedLinks) && ((d = this.lines) == null || d.updateCurveLineGeometry()), i.backgroundColor !== this.config.backgroundColor && (this.store.backgroundColor = z(this.config.backgroundColor ?? te)), i.hoveredPointRingColor !== this.config.hoveredPointRingColor && this.store.setHoveredPointRingColor(this.config.hoveredPointRingColor ?? f.hoveredPointRingColor), i.focusedPointRingColor !== this.config.focusedPointRingColor && this.store.setFocusedPointRingColor(this.config.focusedPointRingColor ?? f.focusedPointRingColor), i.pointGreyoutColor !== this.config.pointGreyoutColor && this.store.setGreyoutPointColor(this.config.pointGreyoutColor ?? Y), i.hoveredLinkColor !== this.config.hoveredLinkColor && this.store.setHoveredLinkColor(this.config.hoveredLinkColor ?? f.hoveredLinkColor), i.focusedPointIndex !== this.config.focusedPointIndex && this.store.setFocusedPoint(this.config.focusedPointIndex), i.pixelRatio !== this.config.pixelRatio && (l = this.device) != null && l.canvasContext && (this.device.canvasContext.setProps({ useDevicePixels: this.config.pixelRatio }), this.store.maxPointSize = $(this.device, this.config.pixelRatio)), i.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)), i.showFPSMonitor !== this.config.showFPSMonitor && (this.config.showFPSMonitor ? this.fpsMonitor = new G(this.canvas) : ((h = this.fpsMonitor) == null || h.destroy(), this.fpsMonitor = void 0)), (i.enableZoom !== this.config.enableZoom || i.enableDrag !== this.config.enableDrag) && this.updateZoomDragBehaviors(), (i.onLinkClick !== this.config.onLinkClick || i.onLinkContextMenu !== this.config.onLinkContextMenu || i.onLinkMouseOver !== this.config.onLinkMouseOver || i.onLinkMouseOut !== this.config.onLinkMouseOut) && this.store.updateLinkHoveringEnabled(this.config);
|
|
5461
5691
|
}
|
|
5462
5692
|
/**
|
|
5463
5693
|
* Sets the positions for the graph points.
|
|
@@ -5697,16 +5927,16 @@ class Ht {
|
|
|
5697
5927
|
render(t) {
|
|
5698
5928
|
if (this._isDestroyed || this.ensureDevice(() => this.render(t))) return;
|
|
5699
5929
|
this.graph.update();
|
|
5700
|
-
const { fitViewOnInit: i, fitViewDelay: o, fitViewPadding: s, fitViewDuration: n, fitViewByPointsInRect: r, fitViewByPointIndices: a, initialZoomLevel:
|
|
5930
|
+
const { fitViewOnInit: i, fitViewDelay: o, fitViewPadding: s, fitViewDuration: n, fitViewByPointsInRect: r, fitViewByPointIndices: a, initialZoomLevel: d } = this.config;
|
|
5701
5931
|
if (!this.graph.pointsNumber && !this.graph.linksNumber) {
|
|
5702
|
-
this.stopFrames(),
|
|
5932
|
+
this.stopFrames(), b(this.canvas).style("cursor", null), this.device && (this.device.beginRenderPass({
|
|
5703
5933
|
clearColor: this.store.backgroundColor,
|
|
5704
5934
|
clearDepth: 1,
|
|
5705
5935
|
clearStencil: 0
|
|
5706
5936
|
}).end(), this.device.submit());
|
|
5707
5937
|
return;
|
|
5708
5938
|
}
|
|
5709
|
-
this._isFirstRenderAfterInit && i &&
|
|
5939
|
+
this._isFirstRenderAfterInit && i && d === void 0 && (this._fitViewOnInitTimeoutID = window.setTimeout(() => {
|
|
5710
5940
|
a ? this.fitViewByPointIndices(a, n, s) : r ? this.setZoomTransformByPointPositions(
|
|
5711
5941
|
new Float32Array(this.flatten(r)),
|
|
5712
5942
|
n,
|
|
@@ -5722,18 +5952,18 @@ class Ht {
|
|
|
5722
5952
|
* @param scale Scale value to zoom in or out (`3` by default).
|
|
5723
5953
|
* @param canZoomOut Set to `false` to prevent zooming out from the point (`true` by default).
|
|
5724
5954
|
*/
|
|
5725
|
-
zoomToPointByIndex(t, i = 700, o =
|
|
5955
|
+
zoomToPointByIndex(t, i = 700, o = ye, s = !0) {
|
|
5726
5956
|
if (this._isDestroyed || this.ensureDevice(() => this.zoomToPointByIndex(t, i, o, s)) || !this.device || !this.points || !this.canvasD3Selection) return;
|
|
5727
|
-
const { store: { screenSize: n } } = this, r =
|
|
5957
|
+
const { store: { screenSize: n } } = this, r = y(this.device, this.points.currentPositionFbo);
|
|
5728
5958
|
if (t === void 0) return;
|
|
5729
|
-
const a = r[t * 4 + 0],
|
|
5730
|
-
if (a === void 0 ||
|
|
5731
|
-
const
|
|
5732
|
-
if (
|
|
5733
|
-
this.setZoomTransformByPointPositions(new Float32Array([a,
|
|
5959
|
+
const a = r[t * 4 + 0], d = r[t * 4 + 1];
|
|
5960
|
+
if (a === void 0 || d === void 0) return;
|
|
5961
|
+
const l = this.zoomInstance.getDistanceToPoint([a, d]), c = s ? o : Math.max(this.getZoomLevel(), o);
|
|
5962
|
+
if (l < Math.min(n[0], n[1]))
|
|
5963
|
+
this.setZoomTransformByPointPositions(new Float32Array([a, d]), i, c);
|
|
5734
5964
|
else {
|
|
5735
|
-
const
|
|
5736
|
-
this.canvasD3Selection.transition().ease(
|
|
5965
|
+
const h = this.zoomInstance.getTransform([a, d], c), p = this.zoomInstance.getMiddlePointTransform([a, d]);
|
|
5966
|
+
this.canvasD3Selection.transition().ease(oe).duration(i / 2).call(this.zoomInstance.behavior.transform, p).transition().ease(se).duration(i / 2).call(this.zoomInstance.behavior.transform, h);
|
|
5737
5967
|
}
|
|
5738
5968
|
}
|
|
5739
5969
|
/**
|
|
@@ -5766,7 +5996,7 @@ class Ht {
|
|
|
5766
5996
|
getPointPositions() {
|
|
5767
5997
|
if (this._isDestroyed || !this.device || !this.points) return [];
|
|
5768
5998
|
if (this.graph.pointsNumber === void 0) return [];
|
|
5769
|
-
const t = [], i =
|
|
5999
|
+
const t = [], i = y(this.device, this.points.currentPositionFbo);
|
|
5770
6000
|
t.length = this.graph.pointsNumber * 2;
|
|
5771
6001
|
for (let o = 0; o < this.graph.pointsNumber; o += 1) {
|
|
5772
6002
|
const s = i[o * 4 + 0], n = i[o * 4 + 1];
|
|
@@ -5782,7 +6012,7 @@ class Ht {
|
|
|
5782
6012
|
if (this._isDestroyed || !this.device || !this.clusters) return [];
|
|
5783
6013
|
if (this.graph.pointClusters === void 0 || this.clusters.clusterCount === void 0) return [];
|
|
5784
6014
|
this.clusters.calculateCentermass();
|
|
5785
|
-
const t = [], i =
|
|
6015
|
+
const t = [], i = y(this.device, this.clusters.centermassFbo);
|
|
5786
6016
|
t.length = this.clusters.clusterCount * 2;
|
|
5787
6017
|
for (let o = 0; o < t.length / 2; o += 1) {
|
|
5788
6018
|
const s = i[o * 4 + 0], n = i[o * 4 + 1], r = i[o * 4 + 2];
|
|
@@ -5833,7 +6063,7 @@ class Ht {
|
|
|
5833
6063
|
if (this._isDestroyed || this.ensureDevice(() => this.setZoomTransformByPointPositions(t, i, o, s))) return;
|
|
5834
6064
|
this.resizeCanvas();
|
|
5835
6065
|
const n = this.zoomInstance.getTransform(t, o, s);
|
|
5836
|
-
(r = this.canvasD3Selection) == null || r.transition().ease(
|
|
6066
|
+
(r = this.canvasD3Selection) == null || r.transition().ease(ne).duration(i).call(this.zoomInstance.behavior.transform, n);
|
|
5837
6067
|
}
|
|
5838
6068
|
/**
|
|
5839
6069
|
* Get points indices inside a rectangular area.
|
|
@@ -5845,18 +6075,7 @@ class Ht {
|
|
|
5845
6075
|
getPointsInRect(t) {
|
|
5846
6076
|
if (this._isDestroyed || !this.device || !this.points) return new Float32Array();
|
|
5847
6077
|
const i = this.store.screenSize[1];
|
|
5848
|
-
return this.store.selectedArea = [[t[0][0], i - t[1][1]], [t[1][0], i - t[0][1]]], this.points.findPointsOnAreaSelection(),
|
|
5849
|
-
}
|
|
5850
|
-
/**
|
|
5851
|
-
* Get points indices inside a rectangular area.
|
|
5852
|
-
* @param selection - Array of two corner points `[[left, top], [right, bottom]]`.
|
|
5853
|
-
* The `left` and `right` coordinates should be from 0 to the width of the canvas.
|
|
5854
|
-
* The `top` and `bottom` coordinates should be from 0 to the height of the canvas.
|
|
5855
|
-
* @returns A Float32Array containing the indices of points inside a rectangular area.
|
|
5856
|
-
* @deprecated Use `getPointsInRect` instead. This method will be removed in a future version.
|
|
5857
|
-
*/
|
|
5858
|
-
getPointsInRange(t) {
|
|
5859
|
-
return this.getPointsInRect(t);
|
|
6078
|
+
return this.store.selectedArea = [[t[0][0], i - t[1][1]], [t[1][0], i - t[0][1]]], this.points.findPointsOnAreaSelection(), y(this.device, this.points.selectedFbo).map((s, n) => n % 4 === 0 && s !== 0 ? n / 4 : -1).filter((s) => s !== -1);
|
|
5860
6079
|
}
|
|
5861
6080
|
/**
|
|
5862
6081
|
* Get points indices inside a polygon area.
|
|
@@ -5868,7 +6087,7 @@ class Ht {
|
|
|
5868
6087
|
if (this._isDestroyed || !this.device || !this.points) return new Float32Array();
|
|
5869
6088
|
if (t.length < 3) return new Float32Array();
|
|
5870
6089
|
const i = this.store.screenSize[1], o = t.map(([n, r]) => [n, i - r]);
|
|
5871
|
-
return this.points.updatePolygonPath(o), this.points.findPointsOnPolygonSelection(),
|
|
6090
|
+
return this.points.updatePolygonPath(o), this.points.findPointsOnPolygonSelection(), y(this.device, this.points.selectedFbo).map((n, r) => r % 4 === 0 && n !== 0 ? r / 4 : -1).filter((n) => n !== -1);
|
|
5872
6091
|
}
|
|
5873
6092
|
/** Select points inside a rectangular area.
|
|
5874
6093
|
* @param selection - Array of two corner points `[[left, top], [right, bottom]]`.
|
|
@@ -5879,22 +6098,13 @@ class Ht {
|
|
|
5879
6098
|
if (t) {
|
|
5880
6099
|
const i = this.store.screenSize[1];
|
|
5881
6100
|
this.store.selectedArea = [[t[0][0], i - t[1][1]], [t[1][0], i - t[0][1]]], this.points.findPointsOnAreaSelection();
|
|
5882
|
-
const o =
|
|
6101
|
+
const o = y(this.device, this.points.selectedFbo);
|
|
5883
6102
|
this.store.selectedIndices = o.map((s, n) => n % 4 === 0 && s !== 0 ? n / 4 : -1).filter((s) => s !== -1);
|
|
5884
6103
|
} else
|
|
5885
6104
|
this.store.selectedIndices = null;
|
|
5886
6105
|
this.points.updateGreyoutStatus();
|
|
5887
6106
|
}
|
|
5888
6107
|
}
|
|
5889
|
-
/** Select points inside a rectangular area.
|
|
5890
|
-
* @param selection - Array of two corner points `[[left, top], [right, bottom]]`.
|
|
5891
|
-
* The `left` and `right` coordinates should be from 0 to the width of the canvas.
|
|
5892
|
-
* The `top` and `bottom` coordinates should be from 0 to the height of the canvas.
|
|
5893
|
-
* @deprecated Use `selectPointsInRect` instead. This method will be removed in a future version.
|
|
5894
|
-
*/
|
|
5895
|
-
selectPointsInRange(t) {
|
|
5896
|
-
return this.selectPointsInRect(t);
|
|
5897
|
-
}
|
|
5898
6108
|
/** Select points inside a polygon area.
|
|
5899
6109
|
* @param polygonPath - Array of points `[[x1, y1], [x2, y2], ..., [xn, yn]]` that defines the polygon.
|
|
5900
6110
|
* The coordinates should be from 0 to the width/height of the canvas.
|
|
@@ -5908,7 +6118,7 @@ class Ht {
|
|
|
5908
6118
|
}
|
|
5909
6119
|
const i = this.store.screenSize[1], o = t.map(([n, r]) => [n, i - r]);
|
|
5910
6120
|
this.points.updatePolygonPath(o), this.points.findPointsOnPolygonSelection();
|
|
5911
|
-
const s =
|
|
6121
|
+
const s = y(this.device, this.points.selectedFbo);
|
|
5912
6122
|
this.store.selectedIndices = s.map((n, r) => r % 4 === 0 && n !== 0 ? r / 4 : -1).filter((n) => n !== -1);
|
|
5913
6123
|
} else
|
|
5914
6124
|
this.store.selectedIndices = null;
|
|
@@ -6035,6 +6245,24 @@ class Ht {
|
|
|
6035
6245
|
getSampledPoints() {
|
|
6036
6246
|
return this._isDestroyed || !this.points ? { indices: [], positions: [] } : this.points.getSampledPoints();
|
|
6037
6247
|
}
|
|
6248
|
+
/**
|
|
6249
|
+
* For the links that are currently visible on the screen, get a sample of link indices with their midpoint coordinates and angle.
|
|
6250
|
+
* The resulting number of links will depend on the `linkSamplingDistance` configuration property,
|
|
6251
|
+
* and the sampled links will be evenly distributed (one link per grid cell, based on link midpoint in screen space).
|
|
6252
|
+
* Each value is [x, y, angle]: position in data space; angle in radians for screen-space rotation (0 = right, positive = clockwise, e.g. for CSS rotation).
|
|
6253
|
+
*/
|
|
6254
|
+
getSampledLinkPositionsMap() {
|
|
6255
|
+
return this._isDestroyed || !this.lines ? /* @__PURE__ */ new Map() : this.lines.getSampledLinkPositionsMap();
|
|
6256
|
+
}
|
|
6257
|
+
/**
|
|
6258
|
+
* For the links that are currently visible on the screen, get a sample of link indices, midpoint positions, and angles.
|
|
6259
|
+
* The resulting number of links will depend on the `linkSamplingDistance` configuration property,
|
|
6260
|
+
* and the sampled links will be evenly distributed.
|
|
6261
|
+
* Positions are in data space; angles are in radians for screen-space rotation (0 = right, positive = clockwise, e.g. for CSS rotation).
|
|
6262
|
+
*/
|
|
6263
|
+
getSampledLinks() {
|
|
6264
|
+
return this._isDestroyed || !this.lines ? { indices: [], positions: [], angles: [] } : this.lines.getSampledLinks();
|
|
6265
|
+
}
|
|
6038
6266
|
/**
|
|
6039
6267
|
* Gets the X-axis of rescaling function.
|
|
6040
6268
|
*
|
|
@@ -6087,15 +6315,6 @@ class Ht {
|
|
|
6087
6315
|
var t, i;
|
|
6088
6316
|
this._isDestroyed || this.ensureDevice(() => this.unpause()) || (this.store.isSimulationRunning = !0, (i = (t = this.config).onSimulationUnpause) == null || i.call(t));
|
|
6089
6317
|
}
|
|
6090
|
-
/**
|
|
6091
|
-
* Restart/Resume the simulation. This method unpauses a paused
|
|
6092
|
-
* simulation and resumes its execution.
|
|
6093
|
-
* @deprecated Use `unpause()` instead. This method will be removed in a future version.
|
|
6094
|
-
*/
|
|
6095
|
-
restart() {
|
|
6096
|
-
var t, i;
|
|
6097
|
-
this._isDestroyed || this.ensureDevice(() => this.restart()) || (this.store.isSimulationRunning = !0, (i = (t = this.config).onSimulationRestart) == null || i.call(t));
|
|
6098
|
-
}
|
|
6099
6318
|
/**
|
|
6100
6319
|
* Run one step of the simulation manually.
|
|
6101
6320
|
* Works even when the simulation is paused.
|
|
@@ -6107,8 +6326,8 @@ class Ht {
|
|
|
6107
6326
|
* Destroy this Cosmos instance.
|
|
6108
6327
|
*/
|
|
6109
6328
|
destroy() {
|
|
6110
|
-
var t, i, o, s, n, r, a,
|
|
6111
|
-
this._isDestroyed || (this._isDestroyed = !0, this.isReady = !1, window.clearTimeout(this._fitViewOnInitTimeoutID), this.stopFrames(), this.canvasD3Selection && this.canvasD3Selection.on("mouseenter.cosmos", null).on("mousemove.cosmos", null).on("mouseleave.cosmos", null).on("click", null).on("mousemove", null).on("contextmenu", null).on(".drag", null).on(".zoom", null),
|
|
6329
|
+
var t, i, o, s, n, r, a, d, l, c, h, p, u;
|
|
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(), (h = this.forceLinkOutgoing) == null || h.destroy(), (p = this.forceMouse) == null || p.destroy(), this.device && this.shouldDestroyDevice && (this.device.beginRenderPass({
|
|
6112
6331
|
clearColor: this.store.backgroundColor,
|
|
6113
6332
|
clearDepth: 1,
|
|
6114
6333
|
clearStencil: 0
|
|
@@ -6119,7 +6338,7 @@ class Ht {
|
|
|
6119
6338
|
*/
|
|
6120
6339
|
create() {
|
|
6121
6340
|
var t, i, o, s, n;
|
|
6122
|
-
this._isDestroyed || this.ensureDevice(() => this.create()) || this.points && this.lines && (this.isPointPositionsUpdateNeeded && this.points.updatePositions(), this.isPointColorUpdateNeeded && this.points.updateColor(), this.isPointSizeUpdateNeeded && this.points.updateSize(), this.isPointShapeUpdateNeeded && this.points.updateShape(), this.isPointImageIndicesUpdateNeeded && this.points.updateImageIndices(), this.isPointImageSizesUpdateNeeded && this.points.updateImageSizes(), this.isLinksUpdateNeeded && this.lines.updatePointsBuffer(), this.isLinkColorUpdateNeeded && this.lines.updateColor(), this.isLinkWidthUpdateNeeded && this.lines.updateWidth(), this.isLinkArrowUpdateNeeded && this.lines.updateArrow(), this.isForceManyBodyUpdateNeeded && ((t = this.forceManyBody) == null || t.create()), this.isForceLinkUpdateNeeded && ((i = this.forceLinkIncoming) == null || i.create(
|
|
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(Z.INCOMING), (o = this.forceLinkOutgoing) == null || o.create(Z.OUTGOING)), this.isForceCenterUpdateNeeded && ((s = this.forceCenter) == null || s.create()), this.isPointClusterUpdateNeeded && ((n = this.clusters) == null || n.create()), this.isPointPositionsUpdateNeeded = !1, this.isPointColorUpdateNeeded = !1, this.isPointSizeUpdateNeeded = !1, this.isPointShapeUpdateNeeded = !1, this.isPointImageIndicesUpdateNeeded = !1, this.isPointImageSizesUpdateNeeded = !1, this.isLinksUpdateNeeded = !1, this.isLinkColorUpdateNeeded = !1, this.isLinkWidthUpdateNeeded = !1, this.isLinkArrowUpdateNeeded = !1, this.isPointClusterUpdateNeeded = !1, this.isForceManyBodyUpdateNeeded = !1, this.isForceLinkUpdateNeeded = !1, this.isForceCenterUpdateNeeded = !1);
|
|
6123
6342
|
}
|
|
6124
6343
|
/**
|
|
6125
6344
|
* Converts an array of tuple positions to a single array containing all coordinates sequentially
|
|
@@ -6172,9 +6391,9 @@ class Ht {
|
|
|
6172
6391
|
* Graph class decides what device to create with sensible defaults
|
|
6173
6392
|
*/
|
|
6174
6393
|
async createDevice(t) {
|
|
6175
|
-
return await
|
|
6394
|
+
return await ae.createDevice({
|
|
6176
6395
|
type: "webgl",
|
|
6177
|
-
adapters: [
|
|
6396
|
+
adapters: [de],
|
|
6178
6397
|
createCanvasContext: {
|
|
6179
6398
|
canvas: t,
|
|
6180
6399
|
// Provide existing canvas
|
|
@@ -6206,15 +6425,15 @@ class Ht {
|
|
|
6206
6425
|
* to respect pause/unpause state.
|
|
6207
6426
|
*/
|
|
6208
6427
|
runSimulationStep(t = !1) {
|
|
6209
|
-
var a,
|
|
6428
|
+
var a, d, l, c, h, p, u, _, R, I, P, A, F, U, E, N, O, B, k;
|
|
6210
6429
|
const { config: { simulationGravity: i, simulationCenter: o, enableSimulation: s }, store: { isSimulationRunning: n } } = this;
|
|
6211
6430
|
if (!s) return;
|
|
6212
|
-
this.isRightClickMouse && this.config.enableRightClickRepulsion && ((a = this.forceMouse) == null || a.run(), (
|
|
6431
|
+
this.isRightClickMouse && this.config.enableRightClickRepulsion && ((a = this.forceMouse) == null || a.run(), (d = this.points) == null || d.updatePosition()), (t || n && !(this.zoomInstance.isRunning && !this.config.enableSimulationDuringZoom)) && (i && ((l = this.forceGravity) == null || l.run(), (c = this.points) == null || c.updatePosition()), o && ((h = this.forceCenter) == null || h.run(), (p = this.points) == null || p.updatePosition()), (u = this.forceManyBody) == null || u.run(), (_ = this.points) == null || _.updatePosition(), this.store.linksTextureSize && ((R = this.forceLinkIncoming) == null || R.run(), (I = this.points) == null || I.updatePosition(), (P = this.forceLinkOutgoing) == null || P.run(), (A = this.points) == null || A.updatePosition()), (this.graph.pointClusters || this.graph.clusterPositions) && ((F = this.clusters) == null || F.run(), (U = this.points) == null || U.updatePosition()), this.store.alpha += this.store.addAlpha(this.config.simulationDecay ?? f.simulation.decay), 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 = (O = this.config).onSimulationTick) == null || B.call(
|
|
6213
6432
|
O,
|
|
6214
6433
|
this.store.alpha,
|
|
6215
6434
|
(E = this.store.hoveredPoint) == null ? void 0 : E.index,
|
|
6216
|
-
(
|
|
6217
|
-
)), (
|
|
6435
|
+
(N = this.store.hoveredPoint) == null ? void 0 : N.position
|
|
6436
|
+
)), (k = this.points) == null || k.trackPoints();
|
|
6218
6437
|
}
|
|
6219
6438
|
initPrograms() {
|
|
6220
6439
|
var t, i, o, s, n, r;
|
|
@@ -6226,7 +6445,7 @@ class Ht {
|
|
|
6226
6445
|
frame() {
|
|
6227
6446
|
if (this._isDestroyed) return;
|
|
6228
6447
|
const { store: { alpha: t, isSimulationRunning: i } } = this;
|
|
6229
|
-
t <
|
|
6448
|
+
t < K && i && this.end(), this.requestAnimationFrameId = window.requestAnimationFrame((o) => {
|
|
6230
6449
|
this.renderFrame(o), this._isDestroyed || this.frame();
|
|
6231
6450
|
});
|
|
6232
6451
|
}
|
|
@@ -6235,17 +6454,17 @@ class Ht {
|
|
|
6235
6454
|
* This does NOT schedule the next frame.
|
|
6236
6455
|
*/
|
|
6237
6456
|
renderFrame(t) {
|
|
6238
|
-
var i, o, s, n, r, a,
|
|
6457
|
+
var i, o, s, n, r, a, d;
|
|
6239
6458
|
if (!this._isDestroyed && this.store.pointsTextureSize) {
|
|
6240
6459
|
if ((i = this.fpsMonitor) == null || i.begin(), this.resizeCanvas(), this.dragInstance.isActive || this.findHoveredItem(), this.runSimulationStep(!1), this.device) {
|
|
6241
|
-
const
|
|
6242
|
-
clearColor:
|
|
6460
|
+
const l = this.store.backgroundColor ?? [0, 0, 0, 1], c = this.device.beginRenderPass({
|
|
6461
|
+
clearColor: l,
|
|
6243
6462
|
clearDepth: 1,
|
|
6244
6463
|
clearStencil: 0
|
|
6245
|
-
}), { config: { renderLinks:
|
|
6246
|
-
|
|
6464
|
+
}), { config: { renderLinks: h } } = this;
|
|
6465
|
+
h !== !1 && !!this.store.linksTextureSize && !!this.graph.linksNumber && this.graph.linksNumber > 0 && ((o = this.lines) == null || o.draw(c)), (s = this.points) == null || s.draw(c), this.dragInstance.isActive && ((n = this.points) == null || n.drag(), (r = this.points) == null || r.drag(), (a = this.points) == null || a.trackPoints()), c.end(), this.device.submit();
|
|
6247
6466
|
}
|
|
6248
|
-
(
|
|
6467
|
+
(d = this.fpsMonitor) == null || d.end(t ?? performance.now()), this.currentEvent = void 0;
|
|
6249
6468
|
}
|
|
6250
6469
|
}
|
|
6251
6470
|
stopFrames() {
|
|
@@ -6266,7 +6485,7 @@ class Ht {
|
|
|
6266
6485
|
this.store.isSimulationRunning = !1, this.store.simulationProgress = 1, (i = (t = this.config).onSimulationEnd) == null || i.call(t), this._shouldForceHoverDetection = !0;
|
|
6267
6486
|
}
|
|
6268
6487
|
onClick(t) {
|
|
6269
|
-
var i, o, s, n, r, a,
|
|
6488
|
+
var i, o, s, n, r, a, d, l, c, h;
|
|
6270
6489
|
(n = (s = this.config).onClick) == null || n.call(
|
|
6271
6490
|
s,
|
|
6272
6491
|
(i = this.store.hoveredPoint) == null ? void 0 : i.index,
|
|
@@ -6277,11 +6496,11 @@ class Ht {
|
|
|
6277
6496
|
this.store.hoveredPoint.index,
|
|
6278
6497
|
this.store.hoveredPoint.position,
|
|
6279
6498
|
t
|
|
6280
|
-
) : this.store.hoveredLinkIndex !== void 0 ? (
|
|
6281
|
-
|
|
6499
|
+
) : this.store.hoveredLinkIndex !== void 0 ? (l = (d = this.config).onLinkClick) == null || l.call(
|
|
6500
|
+
d,
|
|
6282
6501
|
this.store.hoveredLinkIndex,
|
|
6283
6502
|
t
|
|
6284
|
-
) : (
|
|
6503
|
+
) : (h = (c = this.config).onBackgroundClick) == null || h.call(
|
|
6285
6504
|
c,
|
|
6286
6505
|
t
|
|
6287
6506
|
);
|
|
@@ -6301,7 +6520,7 @@ class Ht {
|
|
|
6301
6520
|
);
|
|
6302
6521
|
}
|
|
6303
6522
|
onContextMenu(t) {
|
|
6304
|
-
var i, o, s, n, r, a,
|
|
6523
|
+
var i, o, s, n, r, a, d, l, c, h;
|
|
6305
6524
|
t.preventDefault(), (n = (s = this.config).onContextMenu) == null || n.call(
|
|
6306
6525
|
s,
|
|
6307
6526
|
(i = this.store.hoveredPoint) == null ? void 0 : i.index,
|
|
@@ -6312,22 +6531,22 @@ class Ht {
|
|
|
6312
6531
|
this.store.hoveredPoint.index,
|
|
6313
6532
|
this.store.hoveredPoint.position,
|
|
6314
6533
|
t
|
|
6315
|
-
) : this.store.hoveredLinkIndex !== void 0 ? (
|
|
6316
|
-
|
|
6534
|
+
) : this.store.hoveredLinkIndex !== void 0 ? (l = (d = this.config).onLinkContextMenu) == null || l.call(
|
|
6535
|
+
d,
|
|
6317
6536
|
this.store.hoveredLinkIndex,
|
|
6318
6537
|
t
|
|
6319
|
-
) : (
|
|
6538
|
+
) : (h = (c = this.config).onBackgroundContextMenu) == null || h.call(
|
|
6320
6539
|
c,
|
|
6321
6540
|
t
|
|
6322
6541
|
);
|
|
6323
6542
|
}
|
|
6324
6543
|
resizeCanvas(t = !1) {
|
|
6325
|
-
var r, a, l;
|
|
6544
|
+
var r, a, d, l;
|
|
6326
6545
|
if (this._isDestroyed) return;
|
|
6327
6546
|
const i = this.canvas.clientWidth, o = this.canvas.clientHeight, [s, n] = this.store.screenSize;
|
|
6328
6547
|
if (t || s !== i || n !== o) {
|
|
6329
|
-
const { k:
|
|
6330
|
-
this.store.updateScreenSize(i, o), (r = this.canvasD3Selection) == null || r.call(this.zoomInstance.behavior.transform, this.zoomInstance.getTransform(
|
|
6548
|
+
const { k: c } = this.zoomInstance.eventTransform, h = this.zoomInstance.convertScreenToSpacePosition([s / 2, n / 2]);
|
|
6549
|
+
this.store.updateScreenSize(i, o), (r = this.canvasD3Selection) == null || r.call(this.zoomInstance.behavior.transform, this.zoomInstance.getTransform(h, c)), (a = this.points) == null || a.updateSampledPointsGrid(), (d = this.lines) == null || d.updateSampledLinksGrid(), this.store.isLinkHoveringEnabled && ((l = this.lines) == null || l.updateLinkIndexFbo());
|
|
6331
6550
|
}
|
|
6332
6551
|
}
|
|
6333
6552
|
updateZoomDragBehaviors() {
|
|
@@ -6336,7 +6555,7 @@ class Ht {
|
|
|
6336
6555
|
}
|
|
6337
6556
|
findHoveredItem() {
|
|
6338
6557
|
if (this._isDestroyed || !this._isMouseOnCanvas) return;
|
|
6339
|
-
if (this._findHoveredItemExecutionCount <
|
|
6558
|
+
if (this._findHoveredItemExecutionCount < Fe) {
|
|
6340
6559
|
this._findHoveredItemExecutionCount += 1;
|
|
6341
6560
|
return;
|
|
6342
6561
|
}
|
|
@@ -6352,24 +6571,24 @@ class Ht {
|
|
|
6352
6571
|
}
|
|
6353
6572
|
}
|
|
6354
6573
|
findHoveredPoint() {
|
|
6355
|
-
var
|
|
6574
|
+
var d, l, c, h, p;
|
|
6356
6575
|
if (this._isDestroyed || !this.device || !this.points) return;
|
|
6357
6576
|
this.points.findHoveredPoint();
|
|
6358
6577
|
let t = !1, i = !1;
|
|
6359
|
-
const o =
|
|
6578
|
+
const o = y(this.device, this.points.hoveredFbo, 0, 0, 2, 2), s = o[0], n = o[1], r = o[2], a = o[3];
|
|
6360
6579
|
n > 0 ? ((this.store.hoveredPoint === void 0 || this.store.hoveredPoint.index !== s) && (t = !0), this.store.hoveredPoint = {
|
|
6361
6580
|
index: s,
|
|
6362
6581
|
position: [r, a]
|
|
6363
|
-
}) : (this.store.hoveredPoint && (i = !0), this.store.hoveredPoint = void 0), t && this.store.hoveredPoint && ((c = (
|
|
6364
|
-
|
|
6582
|
+
}) : (this.store.hoveredPoint && (i = !0), this.store.hoveredPoint = void 0), t && this.store.hoveredPoint && ((c = (l = this.config).onPointMouseOver) == null || c.call(
|
|
6583
|
+
l,
|
|
6365
6584
|
this.store.hoveredPoint.index,
|
|
6366
6585
|
this.store.hoveredPoint.position,
|
|
6367
6586
|
this.currentEvent,
|
|
6368
|
-
((
|
|
6369
|
-
)), i && ((p = (
|
|
6587
|
+
((d = this.store.selectedIndices) == null ? void 0 : d.includes(this.store.hoveredPoint.index)) ?? !1
|
|
6588
|
+
)), i && ((p = (h = this.config).onPointMouseOut) == null || p.call(h, this.currentEvent));
|
|
6370
6589
|
}
|
|
6371
6590
|
findHoveredLine() {
|
|
6372
|
-
var n, r, a,
|
|
6591
|
+
var n, r, a, d, l, c;
|
|
6373
6592
|
if (this._isDestroyed || !this.lines) return;
|
|
6374
6593
|
if (this.store.hoveredPoint) {
|
|
6375
6594
|
this.store.hoveredLinkIndex !== void 0 && (this.store.hoveredLinkIndex = void 0, (r = (n = this.config).onLinkMouseOut) == null || r.call(n, this.currentEvent));
|
|
@@ -6378,12 +6597,12 @@ class Ht {
|
|
|
6378
6597
|
this.lines.findHoveredLine();
|
|
6379
6598
|
let t = !1, i = !1;
|
|
6380
6599
|
if (!this.device) return;
|
|
6381
|
-
const s =
|
|
6382
|
-
s >= 0 ? (this.store.hoveredLinkIndex !== s && (t = !0), this.store.hoveredLinkIndex = s) : (this.store.hoveredLinkIndex !== void 0 && (i = !0), this.store.hoveredLinkIndex = void 0), t && this.store.hoveredLinkIndex !== void 0 && ((
|
|
6600
|
+
const s = y(this.device, this.lines.hoveredLineIndexFbo)[0];
|
|
6601
|
+
s >= 0 ? (this.store.hoveredLinkIndex !== s && (t = !0), this.store.hoveredLinkIndex = s) : (this.store.hoveredLinkIndex !== void 0 && (i = !0), this.store.hoveredLinkIndex = void 0), t && this.store.hoveredLinkIndex !== void 0 && ((d = (a = this.config).onLinkMouseOver) == null || d.call(a, this.store.hoveredLinkIndex)), i && ((c = (l = this.config).onLinkMouseOut) == null || c.call(l, this.currentEvent));
|
|
6383
6602
|
}
|
|
6384
6603
|
updateCanvasCursor() {
|
|
6385
6604
|
const { hoveredPointCursor: t, hoveredLinkCursor: i } = this.config;
|
|
6386
|
-
this.dragInstance.isActive ?
|
|
6605
|
+
this.dragInstance.isActive ? b(this.canvas).style("cursor", "grabbing") : this.store.hoveredPoint ? !this.config.enableDrag || this.store.isSpaceKeyPressed ? b(this.canvas).style("cursor", t) : b(this.canvas).style("cursor", "grab") : this.store.isLinkHoveringEnabled && this.store.hoveredLinkIndex !== void 0 ? b(this.canvas).style("cursor", i) : b(this.canvas).style("cursor", null);
|
|
6387
6606
|
}
|
|
6388
6607
|
addAttribution() {
|
|
6389
6608
|
var t;
|
|
@@ -6396,26 +6615,40 @@ class Ht {
|
|
|
6396
6615
|
margin: 0 0.6rem 0.6rem 0;
|
|
6397
6616
|
font-size: 0.7rem;
|
|
6398
6617
|
font-family: inherit;
|
|
6399
|
-
`, this.attributionDivElement.innerHTML =
|
|
6618
|
+
`, this.attributionDivElement.innerHTML = Be(this.config.attribution, {
|
|
6400
6619
|
ALLOWED_TAGS: ["a", "b", "i", "em", "strong", "span", "div", "p", "br", "img"],
|
|
6401
6620
|
ALLOWED_ATTR: ["href", "target", "class", "id", "style", "src", "alt", "title"]
|
|
6402
6621
|
}), (t = this.store.div) == null || t.appendChild(this.attributionDivElement));
|
|
6403
6622
|
}
|
|
6404
6623
|
}
|
|
6405
6624
|
export {
|
|
6406
|
-
|
|
6407
|
-
|
|
6408
|
-
|
|
6625
|
+
Lt as Graph,
|
|
6626
|
+
it as PointShape,
|
|
6627
|
+
Ue as clamp,
|
|
6628
|
+
te as defaultBackgroundColor,
|
|
6629
|
+
f as defaultConfigValues,
|
|
6630
|
+
xe as defaultGreyoutLinkOpacity,
|
|
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,
|
|
6409
6641
|
$ as getMaxPointSize,
|
|
6410
|
-
|
|
6642
|
+
z as getRgbaColor,
|
|
6643
|
+
me as hoveredPointRingOpacity,
|
|
6411
6644
|
De as isAClassInstance,
|
|
6412
|
-
|
|
6413
|
-
|
|
6414
|
-
|
|
6415
|
-
|
|
6645
|
+
ie as isArray,
|
|
6646
|
+
Ne as isFunction,
|
|
6647
|
+
M as isNumber,
|
|
6648
|
+
Me as isObject,
|
|
6416
6649
|
Q as isPlainObject,
|
|
6417
|
-
|
|
6418
|
-
|
|
6419
|
-
|
|
6650
|
+
y as readPixels,
|
|
6651
|
+
Oe as rgbToBrightness,
|
|
6652
|
+
Be as sanitizeHtml
|
|
6420
6653
|
};
|
|
6421
6654
|
//# sourceMappingURL=index.js.map
|