Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sigma

Package Overview
Dependencies
Maintainers
2
Versions
116
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sigma - npm Package Compare versions

Comparing version 3.0.0-beta.38 to 3.0.0-beta.39

dist/declarations/src/rendering/programs/edge-double-arrow/index.d.ts

8

dist/declarations/src/rendering/index.d.ts

@@ -16,7 +16,9 @@ export { NodeProgram, AbstractNodeProgram, createNodeCompoundProgram } from "./node.js";

export { default as NodePointProgram } from "./programs/node-point/index.js";
export * from "./programs/edge-arrow-head/index.js";
export * from "./programs/edge-clamped/index.js";
export { createEdgeArrowProgram, default as EdgeArrowProgram } from "./programs/edge-arrow/index.js";
export { default as EdgeArrowHeadProgram, createEdgeArrowHeadProgram, DEFAULT_EDGE_ARROW_HEAD_PROGRAM_OPTIONS, type CreateEdgeArrowHeadProgramOptions, } from "./programs/edge-arrow-head/index.js";
export { default as EdgeClampedProgram, createEdgeClampedProgram, DEFAULT_EDGE_CLAMPED_PROGRAM_OPTIONS, type CreateEdgeClampedProgramOptions, } from "./programs/edge-clamped/index.js";
export { default as EdgeDoubleClampedProgram, createEdgeDoubleClampedProgram, DEFAULT_EDGE_DOUBLE_CLAMPED_PROGRAM_OPTIONS, type CreateEdgeDoubleClampedProgramOptions, } from "./programs/edge-double-clamped/index.js";
export { default as EdgeArrowProgram, createEdgeArrowProgram } from "./programs/edge-arrow/index.js";
export { default as EdgeDoubleArrowProgram, createEdgeDoubleArrowProgram } from "./programs/edge-double-arrow/index.js";
export { default as EdgeLineProgram } from "./programs/edge-line/index.js";
export { default as EdgeRectangleProgram } from "./programs/edge-rectangle/index.js";
export { default as EdgeTriangleProgram } from "./programs/edge-triangle/index.js";
import { Attributes } from "graphology-types";
import { EdgeProgramType } from "../../edge.js";
export type CreateEdgeArrowHeadProgramOptions = {
extremity: "source" | "target";
lengthToThicknessRatio: number;

@@ -5,0 +6,0 @@ widenessToThicknessRatio: number;

import { Attributes } from "graphology-types";
import { EdgeProgramType } from "../../edge.js";
import { CreateEdgeArrowHeadProgramOptions } from "../edge-arrow-head/index.js";
export declare function createEdgeArrowProgram<N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes>(inputOptions?: Partial<CreateEdgeArrowHeadProgramOptions>): EdgeProgramType<N, E, G>;
export declare function createEdgeArrowProgram<N extends Attributes = Attributes, E extends Attributes = Attributes, G extends Attributes = Attributes>(inputOptions?: Partial<Omit<CreateEdgeArrowHeadProgramOptions, "extremity">>): EdgeProgramType<N, E, G>;
declare const EdgeArrowProgram: EdgeProgramType<Attributes, Attributes, Attributes>;
export default EdgeArrowProgram;
{
"name": "sigma",
"version": "3.0.0-beta.38",
"version": "3.0.0-beta.39",
"description": "A JavaScript library aimed at visualizing graphs of thousands of nodes and edges.",

@@ -93,3 +93,3 @@ "homepage": "https://www.sigmajs.org",

},
"gitHead": "fc828dcb6e14282f323f2f1c62987444f9cf0c6f"
"gitHead": "e1ec97d88185f2e6d94a17abc5c007723b317c3c"
}

@@ -5,3 +5,3 @@ 'use strict';

var index = require('../../dist/index-ee48a08c.cjs.dev.js');
var index = require('../../dist/index-f81ac934.cjs.dev.js');
var inherits = require('../../dist/inherits-3d03d999.cjs.dev.js');

@@ -11,13 +11,13 @@ var colors = require('../../dist/colors-fe6de9d2.cjs.dev.js');

// language=GLSL
var SHADER_SOURCE$5 = /*glsl*/"\nprecision mediump float;\n\nvarying vec4 v_color;\nvarying float v_border;\n\nconst float radius = 0.5;\nconst vec4 transparent = vec4(0.0, 0.0, 0.0, 0.0);\n\nvoid main(void) {\n vec2 m = gl_PointCoord - vec2(0.5, 0.5);\n float dist = radius - length(m);\n\n // No antialiasing for picking mode:\n #ifdef PICKING_MODE\n if (dist > v_border)\n gl_FragColor = v_color;\n else\n gl_FragColor = transparent;\n\n #else\n float t = 0.0;\n if (dist > v_border)\n t = 1.0;\n else if (dist > 0.0)\n t = dist / v_border;\n\n gl_FragColor = mix(transparent, v_color, t);\n #endif\n}\n";
var FRAGMENT_SHADER_SOURCE$2 = SHADER_SOURCE$5;
var SHADER_SOURCE$6 = /*glsl*/"\nprecision mediump float;\n\nvarying vec4 v_color;\nvarying float v_border;\n\nconst float radius = 0.5;\nconst vec4 transparent = vec4(0.0, 0.0, 0.0, 0.0);\n\nvoid main(void) {\n vec2 m = gl_PointCoord - vec2(0.5, 0.5);\n float dist = radius - length(m);\n\n // No antialiasing for picking mode:\n #ifdef PICKING_MODE\n if (dist > v_border)\n gl_FragColor = v_color;\n else\n gl_FragColor = transparent;\n\n #else\n float t = 0.0;\n if (dist > v_border)\n t = 1.0;\n else if (dist > 0.0)\n t = dist / v_border;\n\n gl_FragColor = mix(transparent, v_color, t);\n #endif\n}\n";
var FRAGMENT_SHADER_SOURCE$2 = SHADER_SOURCE$6;
// language=GLSL
var SHADER_SOURCE$4 = /*glsl*/"\nattribute vec4 a_id;\nattribute vec4 a_color;\nattribute vec2 a_position;\nattribute float a_size;\n\nuniform float u_sizeRatio;\nuniform float u_pixelRatio;\nuniform mat3 u_matrix;\n\nvarying vec4 v_color;\nvarying float v_border;\n\nconst float bias = 255.0 / 254.0;\n\nvoid main() {\n gl_Position = vec4(\n (u_matrix * vec3(a_position, 1)).xy,\n 0,\n 1\n );\n\n // Multiply the point size twice:\n // - x SCALING_RATIO to correct the canvas scaling\n // - x 2 to correct the formulae\n gl_PointSize = a_size / u_sizeRatio * u_pixelRatio * 2.0;\n\n v_border = (0.5 / a_size) * u_sizeRatio;\n\n #ifdef PICKING_MODE\n // For picking mode, we use the ID as the color:\n v_color = a_id;\n #else\n // For normal mode, we use the color:\n v_color = a_color;\n #endif\n\n v_color.a *= bias;\n}\n";
var VERTEX_SHADER_SOURCE$2 = SHADER_SOURCE$4;
var SHADER_SOURCE$5 = /*glsl*/"\nattribute vec4 a_id;\nattribute vec4 a_color;\nattribute vec2 a_position;\nattribute float a_size;\n\nuniform float u_sizeRatio;\nuniform float u_pixelRatio;\nuniform mat3 u_matrix;\n\nvarying vec4 v_color;\nvarying float v_border;\n\nconst float bias = 255.0 / 254.0;\n\nvoid main() {\n gl_Position = vec4(\n (u_matrix * vec3(a_position, 1)).xy,\n 0,\n 1\n );\n\n // Multiply the point size twice:\n // - x SCALING_RATIO to correct the canvas scaling\n // - x 2 to correct the formulae\n gl_PointSize = a_size / u_sizeRatio * u_pixelRatio * 2.0;\n\n v_border = (0.5 / a_size) * u_sizeRatio;\n\n #ifdef PICKING_MODE\n // For picking mode, we use the ID as the color:\n v_color = a_id;\n #else\n // For normal mode, we use the color:\n v_color = a_color;\n #endif\n\n v_color.a *= bias;\n}\n";
var VERTEX_SHADER_SOURCE$3 = SHADER_SOURCE$5;
var _WebGLRenderingContex$2 = WebGLRenderingContext,
UNSIGNED_BYTE$2 = _WebGLRenderingContex$2.UNSIGNED_BYTE,
FLOAT$2 = _WebGLRenderingContex$2.FLOAT;
var UNIFORMS$2 = ["u_sizeRatio", "u_pixelRatio", "u_matrix"];
var _WebGLRenderingContex$3 = WebGLRenderingContext,
UNSIGNED_BYTE$3 = _WebGLRenderingContex$3.UNSIGNED_BYTE,
FLOAT$3 = _WebGLRenderingContex$3.FLOAT;
var UNIFORMS$3 = ["u_sizeRatio", "u_pixelRatio", "u_matrix"];
var NodePointProgram = /*#__PURE__*/function (_NodeProgram) {

@@ -34,18 +34,18 @@ inherits._inherits(NodePointProgram, _NodeProgram);

VERTICES: 1,
VERTEX_SHADER_SOURCE: VERTEX_SHADER_SOURCE$2,
VERTEX_SHADER_SOURCE: VERTEX_SHADER_SOURCE$3,
FRAGMENT_SHADER_SOURCE: FRAGMENT_SHADER_SOURCE$2,
METHOD: WebGLRenderingContext.POINTS,
UNIFORMS: UNIFORMS$2,
UNIFORMS: UNIFORMS$3,
ATTRIBUTES: [{
name: "a_position",
size: 2,
type: FLOAT$2
type: FLOAT$3
}, {
name: "a_size",
size: 1,
type: FLOAT$2
type: FLOAT$3
}, {
name: "a_color",
size: 4,
type: UNSIGNED_BYTE$2,
type: UNSIGNED_BYTE$3,
normalized: true

@@ -55,3 +55,3 @@ }, {

size: 4,
type: UNSIGNED_BYTE$2,
type: UNSIGNED_BYTE$3,
normalized: true

@@ -91,2 +91,156 @@ }]

// language=GLSL
var SHADER_SOURCE$4 = /*glsl*/"\nattribute vec4 a_id;\nattribute vec4 a_color;\nattribute vec2 a_normal;\nattribute float a_normalCoef;\nattribute vec2 a_positionStart;\nattribute vec2 a_positionEnd;\nattribute float a_positionCoef;\nattribute float a_sourceRadius;\nattribute float a_targetRadius;\nattribute float a_sourceRadiusCoef;\nattribute float a_targetRadiusCoef;\n\nuniform mat3 u_matrix;\nuniform float u_zoomRatio;\nuniform float u_sizeRatio;\nuniform float u_pixelRatio;\nuniform float u_correctionRatio;\nuniform float u_minEdgeThickness;\nuniform float u_lengthToThicknessRatio;\nuniform float u_feather;\n\nvarying vec4 v_color;\nvarying vec2 v_normal;\nvarying float v_thickness;\nvarying float v_feather;\n\nconst float bias = 255.0 / 254.0;\n\nvoid main() {\n float minThickness = u_minEdgeThickness;\n\n vec2 normal = a_normal * a_normalCoef;\n vec2 position = a_positionStart * (1.0 - a_positionCoef) + a_positionEnd * a_positionCoef;\n\n float normalLength = length(normal);\n vec2 unitNormal = normal / normalLength;\n\n // These first computations are taken from edge.vert.glsl. Please read it to\n // get better comments on what's happening:\n float pixelsThickness = max(normalLength, minThickness * u_sizeRatio);\n float webGLThickness = pixelsThickness * u_correctionRatio / u_sizeRatio;\n\n // Here, we move the point to leave space for the arrow heads:\n // Source arrow head\n float sourceRadius = a_sourceRadius * a_sourceRadiusCoef;\n float sourceDirection = sign(sourceRadius);\n float webGLSourceRadius = sourceDirection * sourceRadius * 2.0 * u_correctionRatio / u_sizeRatio;\n float webGLSourceArrowHeadLength = webGLThickness * u_lengthToThicknessRatio * 2.0;\n vec2 sourceCompensationVector =\n vec2(-sourceDirection * unitNormal.y, sourceDirection * unitNormal.x)\n * (webGLSourceRadius + webGLSourceArrowHeadLength);\n \n // Target arrow head\n float targetRadius = a_targetRadius * a_targetRadiusCoef;\n float targetDirection = sign(targetRadius);\n float webGLTargetRadius = targetDirection * targetRadius * 2.0 * u_correctionRatio / u_sizeRatio;\n float webGLTargetArrowHeadLength = webGLThickness * u_lengthToThicknessRatio * 2.0;\n vec2 targetCompensationVector =\n vec2(-targetDirection * unitNormal.y, targetDirection * unitNormal.x)\n * (webGLTargetRadius + webGLTargetArrowHeadLength);\n\n // Here is the proper position of the vertex\n gl_Position = vec4((u_matrix * vec3(position + unitNormal * webGLThickness + sourceCompensationVector + targetCompensationVector, 1)).xy, 0, 1);\n\n v_thickness = webGLThickness / u_zoomRatio;\n\n v_normal = unitNormal;\n\n v_feather = u_feather * u_correctionRatio / u_zoomRatio / u_pixelRatio * 2.0;\n\n #ifdef PICKING_MODE\n // For picking mode, we use the ID as the color:\n v_color = a_id;\n #else\n // For normal mode, we use the color:\n v_color = a_color;\n #endif\n\n v_color.a *= bias;\n}\n";
var VERTEX_SHADER_SOURCE$2 = SHADER_SOURCE$4;
var _WebGLRenderingContex$2 = WebGLRenderingContext,
UNSIGNED_BYTE$2 = _WebGLRenderingContex$2.UNSIGNED_BYTE,
FLOAT$2 = _WebGLRenderingContex$2.FLOAT;
var UNIFORMS$2 = ["u_matrix", "u_zoomRatio", "u_sizeRatio", "u_correctionRatio", "u_pixelRatio", "u_feather", "u_minEdgeThickness", "u_lengthToThicknessRatio"];
var DEFAULT_EDGE_DOUBLE_CLAMPED_PROGRAM_OPTIONS = {
lengthToThicknessRatio: index.DEFAULT_EDGE_ARROW_HEAD_PROGRAM_OPTIONS.lengthToThicknessRatio
};
function createEdgeDoubleClampedProgram(inputOptions) {
var options = index._objectSpread2(index._objectSpread2({}, DEFAULT_EDGE_DOUBLE_CLAMPED_PROGRAM_OPTIONS), inputOptions || {});
return /*#__PURE__*/function (_EdgeProgram) {
inherits._inherits(EdgeDoubleClampedProgram, _EdgeProgram);
function EdgeDoubleClampedProgram() {
inherits._classCallCheck(this, EdgeDoubleClampedProgram);
return inherits._callSuper(this, EdgeDoubleClampedProgram, arguments);
}
inherits._createClass(EdgeDoubleClampedProgram, [{
key: "getDefinition",
value: function getDefinition() {
return {
VERTICES: 6,
VERTEX_SHADER_SOURCE: VERTEX_SHADER_SOURCE$2,
FRAGMENT_SHADER_SOURCE: index.FRAGMENT_SHADER_SOURCE,
METHOD: WebGLRenderingContext.TRIANGLES,
UNIFORMS: UNIFORMS$2,
ATTRIBUTES: [{
name: "a_positionStart",
size: 2,
type: FLOAT$2
}, {
name: "a_positionEnd",
size: 2,
type: FLOAT$2
}, {
name: "a_normal",
size: 2,
type: FLOAT$2
}, {
name: "a_color",
size: 4,
type: UNSIGNED_BYTE$2,
normalized: true
}, {
name: "a_id",
size: 4,
type: UNSIGNED_BYTE$2,
normalized: true
}, {
name: "a_sourceRadius",
size: 1,
type: FLOAT$2
}, {
name: "a_targetRadius",
size: 1,
type: FLOAT$2
}],
CONSTANT_ATTRIBUTES: [
// If 0, then position will be a_positionStart
// If 1, then position will be a_positionEnd
{
name: "a_positionCoef",
size: 1,
type: FLOAT$2
}, {
name: "a_normalCoef",
size: 1,
type: FLOAT$2
}, {
name: "a_sourceRadiusCoef",
size: 1,
type: FLOAT$2
}, {
name: "a_targetRadiusCoef",
size: 1,
type: FLOAT$2
}],
CONSTANT_DATA: [[0, 1, -1, 0], [0, -1, 1, 0], [1, 1, 0, 1], [1, 1, 0, 1], [0, -1, 1, 0], [1, -1, 0, -1]]
};
}
}, {
key: "processVisibleItem",
value: function processVisibleItem(edgeIndex, startIndex, sourceData, targetData, data) {
var thickness = data.size || 1;
var x1 = sourceData.x;
var y1 = sourceData.y;
var x2 = targetData.x;
var y2 = targetData.y;
var color = colors.floatColor(data.color);
// Computing normals
var dx = x2 - x1;
var dy = y2 - y1;
var sourceRadius = sourceData.size || 1;
var targetRadius = targetData.size || 1;
var len = dx * dx + dy * dy;
var n1 = 0;
var n2 = 0;
if (len) {
len = 1 / Math.sqrt(len);
n1 = -dy * len * thickness;
n2 = dx * len * thickness;
}
var array = this.array;
array[startIndex++] = x1;
array[startIndex++] = y1;
array[startIndex++] = x2;
array[startIndex++] = y2;
array[startIndex++] = n1;
array[startIndex++] = n2;
array[startIndex++] = color;
array[startIndex++] = edgeIndex;
array[startIndex++] = sourceRadius;
array[startIndex++] = targetRadius;
}
}, {
key: "setUniforms",
value: function setUniforms(params, _ref) {
var gl = _ref.gl,
uniformLocations = _ref.uniformLocations;
var u_matrix = uniformLocations.u_matrix,
u_zoomRatio = uniformLocations.u_zoomRatio,
u_feather = uniformLocations.u_feather,
u_pixelRatio = uniformLocations.u_pixelRatio,
u_correctionRatio = uniformLocations.u_correctionRatio,
u_sizeRatio = uniformLocations.u_sizeRatio,
u_minEdgeThickness = uniformLocations.u_minEdgeThickness,
u_lengthToThicknessRatio = uniformLocations.u_lengthToThicknessRatio;
gl.uniformMatrix3fv(u_matrix, false, params.matrix);
gl.uniform1f(u_zoomRatio, params.zoomRatio);
gl.uniform1f(u_sizeRatio, params.sizeRatio);
gl.uniform1f(u_correctionRatio, params.correctionRatio);
gl.uniform1f(u_pixelRatio, params.pixelRatio);
gl.uniform1f(u_feather, params.antiAliasingFeather);
gl.uniform1f(u_minEdgeThickness, params.minEdgeThickness);
gl.uniform1f(u_lengthToThicknessRatio, options.lengthToThicknessRatio);
}
}]);
return EdgeDoubleClampedProgram;
}(index.EdgeProgram);
}
var EdgeDoubleClampedProgram = createEdgeDoubleClampedProgram();
var EdgeDoubleClampedProgram$1 = EdgeDoubleClampedProgram;
function createEdgeDoubleArrowProgram(inputOptions) {
return index.createEdgeCompoundProgram([createEdgeDoubleClampedProgram(inputOptions), index.createEdgeArrowHeadProgram(inputOptions), index.createEdgeArrowHeadProgram(index._objectSpread2(index._objectSpread2({}, inputOptions), {}, {
extremity: "source"
}))]);
}
var EdgeDoubleArrowProgram = createEdgeDoubleArrowProgram();
var EdgeDoubleArrowProgram$1 = EdgeDoubleArrowProgram;
// language=GLSL
var SHADER_SOURCE$3 = /*glsl*/"\nprecision mediump float;\n\nvarying vec4 v_color;\n\nvoid main(void) {\n gl_FragColor = v_color;\n}\n";

@@ -290,3 +444,5 @@ var FRAGMENT_SHADER_SOURCE$1 = SHADER_SOURCE$3;

exports.DEFAULT_EDGE_CLAMPED_PROGRAM_OPTIONS = index.DEFAULT_EDGE_CLAMPED_PROGRAM_OPTIONS;
exports.EdgeArrowHeadProgram = index.EdgeArrowHeadProgram;
exports.EdgeArrowProgram = index.EdgeArrowProgram;
exports.EdgeClampedProgram = index.EdgeClampedProgram;
exports.EdgeProgram = index.EdgeProgram;

@@ -312,4 +468,9 @@ exports.EdgeRectangleProgram = index.EdgeRectangleProgram;

exports.numberToGLSLFloat = index.numberToGLSLFloat;
exports.DEFAULT_EDGE_DOUBLE_CLAMPED_PROGRAM_OPTIONS = DEFAULT_EDGE_DOUBLE_CLAMPED_PROGRAM_OPTIONS;
exports.EdgeDoubleArrowProgram = EdgeDoubleArrowProgram$1;
exports.EdgeDoubleClampedProgram = EdgeDoubleClampedProgram$1;
exports.EdgeLineProgram = EdgeLineProgram;
exports.EdgeTriangleProgram = EdgeTriangleProgram;
exports.NodePointProgram = NodePointProgram;
exports.createEdgeDoubleArrowProgram = createEdgeDoubleArrowProgram;
exports.createEdgeDoubleClampedProgram = createEdgeDoubleClampedProgram;

@@ -5,3 +5,3 @@ 'use strict';

var index = require('../../dist/index-4cdce1d5.cjs.prod.js');
var index = require('../../dist/index-a45faf79.cjs.prod.js');
var inherits = require('../../dist/inherits-bddcfb5f.cjs.prod.js');

@@ -11,13 +11,13 @@ var colors = require('../../dist/colors-ee2e2828.cjs.prod.js');

// language=GLSL
var SHADER_SOURCE$5 = /*glsl*/"\nprecision mediump float;\n\nvarying vec4 v_color;\nvarying float v_border;\n\nconst float radius = 0.5;\nconst vec4 transparent = vec4(0.0, 0.0, 0.0, 0.0);\n\nvoid main(void) {\n vec2 m = gl_PointCoord - vec2(0.5, 0.5);\n float dist = radius - length(m);\n\n // No antialiasing for picking mode:\n #ifdef PICKING_MODE\n if (dist > v_border)\n gl_FragColor = v_color;\n else\n gl_FragColor = transparent;\n\n #else\n float t = 0.0;\n if (dist > v_border)\n t = 1.0;\n else if (dist > 0.0)\n t = dist / v_border;\n\n gl_FragColor = mix(transparent, v_color, t);\n #endif\n}\n";
var FRAGMENT_SHADER_SOURCE$2 = SHADER_SOURCE$5;
var SHADER_SOURCE$6 = /*glsl*/"\nprecision mediump float;\n\nvarying vec4 v_color;\nvarying float v_border;\n\nconst float radius = 0.5;\nconst vec4 transparent = vec4(0.0, 0.0, 0.0, 0.0);\n\nvoid main(void) {\n vec2 m = gl_PointCoord - vec2(0.5, 0.5);\n float dist = radius - length(m);\n\n // No antialiasing for picking mode:\n #ifdef PICKING_MODE\n if (dist > v_border)\n gl_FragColor = v_color;\n else\n gl_FragColor = transparent;\n\n #else\n float t = 0.0;\n if (dist > v_border)\n t = 1.0;\n else if (dist > 0.0)\n t = dist / v_border;\n\n gl_FragColor = mix(transparent, v_color, t);\n #endif\n}\n";
var FRAGMENT_SHADER_SOURCE$2 = SHADER_SOURCE$6;
// language=GLSL
var SHADER_SOURCE$4 = /*glsl*/"\nattribute vec4 a_id;\nattribute vec4 a_color;\nattribute vec2 a_position;\nattribute float a_size;\n\nuniform float u_sizeRatio;\nuniform float u_pixelRatio;\nuniform mat3 u_matrix;\n\nvarying vec4 v_color;\nvarying float v_border;\n\nconst float bias = 255.0 / 254.0;\n\nvoid main() {\n gl_Position = vec4(\n (u_matrix * vec3(a_position, 1)).xy,\n 0,\n 1\n );\n\n // Multiply the point size twice:\n // - x SCALING_RATIO to correct the canvas scaling\n // - x 2 to correct the formulae\n gl_PointSize = a_size / u_sizeRatio * u_pixelRatio * 2.0;\n\n v_border = (0.5 / a_size) * u_sizeRatio;\n\n #ifdef PICKING_MODE\n // For picking mode, we use the ID as the color:\n v_color = a_id;\n #else\n // For normal mode, we use the color:\n v_color = a_color;\n #endif\n\n v_color.a *= bias;\n}\n";
var VERTEX_SHADER_SOURCE$2 = SHADER_SOURCE$4;
var SHADER_SOURCE$5 = /*glsl*/"\nattribute vec4 a_id;\nattribute vec4 a_color;\nattribute vec2 a_position;\nattribute float a_size;\n\nuniform float u_sizeRatio;\nuniform float u_pixelRatio;\nuniform mat3 u_matrix;\n\nvarying vec4 v_color;\nvarying float v_border;\n\nconst float bias = 255.0 / 254.0;\n\nvoid main() {\n gl_Position = vec4(\n (u_matrix * vec3(a_position, 1)).xy,\n 0,\n 1\n );\n\n // Multiply the point size twice:\n // - x SCALING_RATIO to correct the canvas scaling\n // - x 2 to correct the formulae\n gl_PointSize = a_size / u_sizeRatio * u_pixelRatio * 2.0;\n\n v_border = (0.5 / a_size) * u_sizeRatio;\n\n #ifdef PICKING_MODE\n // For picking mode, we use the ID as the color:\n v_color = a_id;\n #else\n // For normal mode, we use the color:\n v_color = a_color;\n #endif\n\n v_color.a *= bias;\n}\n";
var VERTEX_SHADER_SOURCE$3 = SHADER_SOURCE$5;
var _WebGLRenderingContex$2 = WebGLRenderingContext,
UNSIGNED_BYTE$2 = _WebGLRenderingContex$2.UNSIGNED_BYTE,
FLOAT$2 = _WebGLRenderingContex$2.FLOAT;
var UNIFORMS$2 = ["u_sizeRatio", "u_pixelRatio", "u_matrix"];
var _WebGLRenderingContex$3 = WebGLRenderingContext,
UNSIGNED_BYTE$3 = _WebGLRenderingContex$3.UNSIGNED_BYTE,
FLOAT$3 = _WebGLRenderingContex$3.FLOAT;
var UNIFORMS$3 = ["u_sizeRatio", "u_pixelRatio", "u_matrix"];
var NodePointProgram = /*#__PURE__*/function (_NodeProgram) {

@@ -34,18 +34,18 @@ inherits._inherits(NodePointProgram, _NodeProgram);

VERTICES: 1,
VERTEX_SHADER_SOURCE: VERTEX_SHADER_SOURCE$2,
VERTEX_SHADER_SOURCE: VERTEX_SHADER_SOURCE$3,
FRAGMENT_SHADER_SOURCE: FRAGMENT_SHADER_SOURCE$2,
METHOD: WebGLRenderingContext.POINTS,
UNIFORMS: UNIFORMS$2,
UNIFORMS: UNIFORMS$3,
ATTRIBUTES: [{
name: "a_position",
size: 2,
type: FLOAT$2
type: FLOAT$3
}, {
name: "a_size",
size: 1,
type: FLOAT$2
type: FLOAT$3
}, {
name: "a_color",
size: 4,
type: UNSIGNED_BYTE$2,
type: UNSIGNED_BYTE$3,
normalized: true

@@ -55,3 +55,3 @@ }, {

size: 4,
type: UNSIGNED_BYTE$2,
type: UNSIGNED_BYTE$3,
normalized: true

@@ -91,2 +91,156 @@ }]

// language=GLSL
var SHADER_SOURCE$4 = /*glsl*/"\nattribute vec4 a_id;\nattribute vec4 a_color;\nattribute vec2 a_normal;\nattribute float a_normalCoef;\nattribute vec2 a_positionStart;\nattribute vec2 a_positionEnd;\nattribute float a_positionCoef;\nattribute float a_sourceRadius;\nattribute float a_targetRadius;\nattribute float a_sourceRadiusCoef;\nattribute float a_targetRadiusCoef;\n\nuniform mat3 u_matrix;\nuniform float u_zoomRatio;\nuniform float u_sizeRatio;\nuniform float u_pixelRatio;\nuniform float u_correctionRatio;\nuniform float u_minEdgeThickness;\nuniform float u_lengthToThicknessRatio;\nuniform float u_feather;\n\nvarying vec4 v_color;\nvarying vec2 v_normal;\nvarying float v_thickness;\nvarying float v_feather;\n\nconst float bias = 255.0 / 254.0;\n\nvoid main() {\n float minThickness = u_minEdgeThickness;\n\n vec2 normal = a_normal * a_normalCoef;\n vec2 position = a_positionStart * (1.0 - a_positionCoef) + a_positionEnd * a_positionCoef;\n\n float normalLength = length(normal);\n vec2 unitNormal = normal / normalLength;\n\n // These first computations are taken from edge.vert.glsl. Please read it to\n // get better comments on what's happening:\n float pixelsThickness = max(normalLength, minThickness * u_sizeRatio);\n float webGLThickness = pixelsThickness * u_correctionRatio / u_sizeRatio;\n\n // Here, we move the point to leave space for the arrow heads:\n // Source arrow head\n float sourceRadius = a_sourceRadius * a_sourceRadiusCoef;\n float sourceDirection = sign(sourceRadius);\n float webGLSourceRadius = sourceDirection * sourceRadius * 2.0 * u_correctionRatio / u_sizeRatio;\n float webGLSourceArrowHeadLength = webGLThickness * u_lengthToThicknessRatio * 2.0;\n vec2 sourceCompensationVector =\n vec2(-sourceDirection * unitNormal.y, sourceDirection * unitNormal.x)\n * (webGLSourceRadius + webGLSourceArrowHeadLength);\n \n // Target arrow head\n float targetRadius = a_targetRadius * a_targetRadiusCoef;\n float targetDirection = sign(targetRadius);\n float webGLTargetRadius = targetDirection * targetRadius * 2.0 * u_correctionRatio / u_sizeRatio;\n float webGLTargetArrowHeadLength = webGLThickness * u_lengthToThicknessRatio * 2.0;\n vec2 targetCompensationVector =\n vec2(-targetDirection * unitNormal.y, targetDirection * unitNormal.x)\n * (webGLTargetRadius + webGLTargetArrowHeadLength);\n\n // Here is the proper position of the vertex\n gl_Position = vec4((u_matrix * vec3(position + unitNormal * webGLThickness + sourceCompensationVector + targetCompensationVector, 1)).xy, 0, 1);\n\n v_thickness = webGLThickness / u_zoomRatio;\n\n v_normal = unitNormal;\n\n v_feather = u_feather * u_correctionRatio / u_zoomRatio / u_pixelRatio * 2.0;\n\n #ifdef PICKING_MODE\n // For picking mode, we use the ID as the color:\n v_color = a_id;\n #else\n // For normal mode, we use the color:\n v_color = a_color;\n #endif\n\n v_color.a *= bias;\n}\n";
var VERTEX_SHADER_SOURCE$2 = SHADER_SOURCE$4;
var _WebGLRenderingContex$2 = WebGLRenderingContext,
UNSIGNED_BYTE$2 = _WebGLRenderingContex$2.UNSIGNED_BYTE,
FLOAT$2 = _WebGLRenderingContex$2.FLOAT;
var UNIFORMS$2 = ["u_matrix", "u_zoomRatio", "u_sizeRatio", "u_correctionRatio", "u_pixelRatio", "u_feather", "u_minEdgeThickness", "u_lengthToThicknessRatio"];
var DEFAULT_EDGE_DOUBLE_CLAMPED_PROGRAM_OPTIONS = {
lengthToThicknessRatio: index.DEFAULT_EDGE_ARROW_HEAD_PROGRAM_OPTIONS.lengthToThicknessRatio
};
function createEdgeDoubleClampedProgram(inputOptions) {
var options = index._objectSpread2(index._objectSpread2({}, DEFAULT_EDGE_DOUBLE_CLAMPED_PROGRAM_OPTIONS), inputOptions || {});
return /*#__PURE__*/function (_EdgeProgram) {
inherits._inherits(EdgeDoubleClampedProgram, _EdgeProgram);
function EdgeDoubleClampedProgram() {
inherits._classCallCheck(this, EdgeDoubleClampedProgram);
return inherits._callSuper(this, EdgeDoubleClampedProgram, arguments);
}
inherits._createClass(EdgeDoubleClampedProgram, [{
key: "getDefinition",
value: function getDefinition() {
return {
VERTICES: 6,
VERTEX_SHADER_SOURCE: VERTEX_SHADER_SOURCE$2,
FRAGMENT_SHADER_SOURCE: index.FRAGMENT_SHADER_SOURCE,
METHOD: WebGLRenderingContext.TRIANGLES,
UNIFORMS: UNIFORMS$2,
ATTRIBUTES: [{
name: "a_positionStart",
size: 2,
type: FLOAT$2
}, {
name: "a_positionEnd",
size: 2,
type: FLOAT$2
}, {
name: "a_normal",
size: 2,
type: FLOAT$2
}, {
name: "a_color",
size: 4,
type: UNSIGNED_BYTE$2,
normalized: true
}, {
name: "a_id",
size: 4,
type: UNSIGNED_BYTE$2,
normalized: true
}, {
name: "a_sourceRadius",
size: 1,
type: FLOAT$2
}, {
name: "a_targetRadius",
size: 1,
type: FLOAT$2
}],
CONSTANT_ATTRIBUTES: [
// If 0, then position will be a_positionStart
// If 1, then position will be a_positionEnd
{
name: "a_positionCoef",
size: 1,
type: FLOAT$2
}, {
name: "a_normalCoef",
size: 1,
type: FLOAT$2
}, {
name: "a_sourceRadiusCoef",
size: 1,
type: FLOAT$2
}, {
name: "a_targetRadiusCoef",
size: 1,
type: FLOAT$2
}],
CONSTANT_DATA: [[0, 1, -1, 0], [0, -1, 1, 0], [1, 1, 0, 1], [1, 1, 0, 1], [0, -1, 1, 0], [1, -1, 0, -1]]
};
}
}, {
key: "processVisibleItem",
value: function processVisibleItem(edgeIndex, startIndex, sourceData, targetData, data) {
var thickness = data.size || 1;
var x1 = sourceData.x;
var y1 = sourceData.y;
var x2 = targetData.x;
var y2 = targetData.y;
var color = colors.floatColor(data.color);
// Computing normals
var dx = x2 - x1;
var dy = y2 - y1;
var sourceRadius = sourceData.size || 1;
var targetRadius = targetData.size || 1;
var len = dx * dx + dy * dy;
var n1 = 0;
var n2 = 0;
if (len) {
len = 1 / Math.sqrt(len);
n1 = -dy * len * thickness;
n2 = dx * len * thickness;
}
var array = this.array;
array[startIndex++] = x1;
array[startIndex++] = y1;
array[startIndex++] = x2;
array[startIndex++] = y2;
array[startIndex++] = n1;
array[startIndex++] = n2;
array[startIndex++] = color;
array[startIndex++] = edgeIndex;
array[startIndex++] = sourceRadius;
array[startIndex++] = targetRadius;
}
}, {
key: "setUniforms",
value: function setUniforms(params, _ref) {
var gl = _ref.gl,
uniformLocations = _ref.uniformLocations;
var u_matrix = uniformLocations.u_matrix,
u_zoomRatio = uniformLocations.u_zoomRatio,
u_feather = uniformLocations.u_feather,
u_pixelRatio = uniformLocations.u_pixelRatio,
u_correctionRatio = uniformLocations.u_correctionRatio,
u_sizeRatio = uniformLocations.u_sizeRatio,
u_minEdgeThickness = uniformLocations.u_minEdgeThickness,
u_lengthToThicknessRatio = uniformLocations.u_lengthToThicknessRatio;
gl.uniformMatrix3fv(u_matrix, false, params.matrix);
gl.uniform1f(u_zoomRatio, params.zoomRatio);
gl.uniform1f(u_sizeRatio, params.sizeRatio);
gl.uniform1f(u_correctionRatio, params.correctionRatio);
gl.uniform1f(u_pixelRatio, params.pixelRatio);
gl.uniform1f(u_feather, params.antiAliasingFeather);
gl.uniform1f(u_minEdgeThickness, params.minEdgeThickness);
gl.uniform1f(u_lengthToThicknessRatio, options.lengthToThicknessRatio);
}
}]);
return EdgeDoubleClampedProgram;
}(index.EdgeProgram);
}
var EdgeDoubleClampedProgram = createEdgeDoubleClampedProgram();
var EdgeDoubleClampedProgram$1 = EdgeDoubleClampedProgram;
function createEdgeDoubleArrowProgram(inputOptions) {
return index.createEdgeCompoundProgram([createEdgeDoubleClampedProgram(inputOptions), index.createEdgeArrowHeadProgram(inputOptions), index.createEdgeArrowHeadProgram(index._objectSpread2(index._objectSpread2({}, inputOptions), {}, {
extremity: "source"
}))]);
}
var EdgeDoubleArrowProgram = createEdgeDoubleArrowProgram();
var EdgeDoubleArrowProgram$1 = EdgeDoubleArrowProgram;
// language=GLSL
var SHADER_SOURCE$3 = /*glsl*/"\nprecision mediump float;\n\nvarying vec4 v_color;\n\nvoid main(void) {\n gl_FragColor = v_color;\n}\n";

@@ -290,3 +444,5 @@ var FRAGMENT_SHADER_SOURCE$1 = SHADER_SOURCE$3;

exports.DEFAULT_EDGE_CLAMPED_PROGRAM_OPTIONS = index.DEFAULT_EDGE_CLAMPED_PROGRAM_OPTIONS;
exports.EdgeArrowHeadProgram = index.EdgeArrowHeadProgram;
exports.EdgeArrowProgram = index.EdgeArrowProgram;
exports.EdgeClampedProgram = index.EdgeClampedProgram;
exports.EdgeProgram = index.EdgeProgram;

@@ -312,4 +468,9 @@ exports.EdgeRectangleProgram = index.EdgeRectangleProgram;

exports.numberToGLSLFloat = index.numberToGLSLFloat;
exports.DEFAULT_EDGE_DOUBLE_CLAMPED_PROGRAM_OPTIONS = DEFAULT_EDGE_DOUBLE_CLAMPED_PROGRAM_OPTIONS;
exports.EdgeDoubleArrowProgram = EdgeDoubleArrowProgram$1;
exports.EdgeDoubleClampedProgram = EdgeDoubleClampedProgram$1;
exports.EdgeLineProgram = EdgeLineProgram;
exports.EdgeTriangleProgram = EdgeTriangleProgram;
exports.NodePointProgram = NodePointProgram;
exports.createEdgeDoubleArrowProgram = createEdgeDoubleArrowProgram;
exports.createEdgeDoubleClampedProgram = createEdgeDoubleClampedProgram;

@@ -1,3 +0,3 @@

import { f as NodeProgram, g as EdgeProgram } from '../../dist/index-991e05f6.esm.js';
export { i as AbstractEdgeProgram, A as AbstractNodeProgram, k as AbstractProgram, D as DEFAULT_EDGE_ARROW_HEAD_PROGRAM_OPTIONS, u as DEFAULT_EDGE_CLAMPED_PROGRAM_OPTIONS, E as EdgeArrowProgram, g as EdgeProgram, e as EdgeRectangleProgram, N as NodeCircleProgram, f as NodeProgram, P as Program, t as createEdgeArrowHeadProgram, l as createEdgeArrowProgram, v as createEdgeClampedProgram, j as createEdgeCompoundProgram, h as createNodeCompoundProgram, c as drawDiscNodeHover, b as drawDiscNodeLabel, d as drawStraightEdgeLabel, m as getAttributeItemsCount, n as getAttributesItemsCount, r as killProgram, p as loadFragmentShader, q as loadProgram, o as loadVertexShader, s as numberToGLSLFloat } from '../../dist/index-991e05f6.esm.js';
import { f as NodeProgram, D as DEFAULT_EDGE_ARROW_HEAD_PROGRAM_OPTIONS, a as _objectSpread2, F as FRAGMENT_SHADER_SOURCE$3, g as EdgeProgram, h as createEdgeCompoundProgram, i as createEdgeArrowHeadProgram } from '../../dist/index-4d79933a.esm.js';
export { k as AbstractEdgeProgram, A as AbstractNodeProgram, l as AbstractProgram, D as DEFAULT_EDGE_ARROW_HEAD_PROGRAM_OPTIONS, p as DEFAULT_EDGE_CLAMPED_PROGRAM_OPTIONS, m as EdgeArrowHeadProgram, E as EdgeArrowProgram, n as EdgeClampedProgram, g as EdgeProgram, e as EdgeRectangleProgram, N as NodeCircleProgram, f as NodeProgram, P as Program, i as createEdgeArrowHeadProgram, q as createEdgeArrowProgram, o as createEdgeClampedProgram, h as createEdgeCompoundProgram, j as createNodeCompoundProgram, c as drawDiscNodeHover, b as drawDiscNodeLabel, d as drawStraightEdgeLabel, r as getAttributeItemsCount, s as getAttributesItemsCount, w as killProgram, u as loadFragmentShader, v as loadProgram, t as loadVertexShader, x as numberToGLSLFloat } from '../../dist/index-4d79933a.esm.js';
import { _ as _inherits, a as _createClass, b as _classCallCheck, c as _callSuper } from '../../dist/inherits-c41b88d9.esm.js';

@@ -7,13 +7,13 @@ import { f as floatColor } from '../../dist/colors-beb06eb2.esm.js';

// language=GLSL
var SHADER_SOURCE$5 = /*glsl*/"\nprecision mediump float;\n\nvarying vec4 v_color;\nvarying float v_border;\n\nconst float radius = 0.5;\nconst vec4 transparent = vec4(0.0, 0.0, 0.0, 0.0);\n\nvoid main(void) {\n vec2 m = gl_PointCoord - vec2(0.5, 0.5);\n float dist = radius - length(m);\n\n // No antialiasing for picking mode:\n #ifdef PICKING_MODE\n if (dist > v_border)\n gl_FragColor = v_color;\n else\n gl_FragColor = transparent;\n\n #else\n float t = 0.0;\n if (dist > v_border)\n t = 1.0;\n else if (dist > 0.0)\n t = dist / v_border;\n\n gl_FragColor = mix(transparent, v_color, t);\n #endif\n}\n";
var FRAGMENT_SHADER_SOURCE$2 = SHADER_SOURCE$5;
var SHADER_SOURCE$6 = /*glsl*/"\nprecision mediump float;\n\nvarying vec4 v_color;\nvarying float v_border;\n\nconst float radius = 0.5;\nconst vec4 transparent = vec4(0.0, 0.0, 0.0, 0.0);\n\nvoid main(void) {\n vec2 m = gl_PointCoord - vec2(0.5, 0.5);\n float dist = radius - length(m);\n\n // No antialiasing for picking mode:\n #ifdef PICKING_MODE\n if (dist > v_border)\n gl_FragColor = v_color;\n else\n gl_FragColor = transparent;\n\n #else\n float t = 0.0;\n if (dist > v_border)\n t = 1.0;\n else if (dist > 0.0)\n t = dist / v_border;\n\n gl_FragColor = mix(transparent, v_color, t);\n #endif\n}\n";
var FRAGMENT_SHADER_SOURCE$2 = SHADER_SOURCE$6;
// language=GLSL
var SHADER_SOURCE$4 = /*glsl*/"\nattribute vec4 a_id;\nattribute vec4 a_color;\nattribute vec2 a_position;\nattribute float a_size;\n\nuniform float u_sizeRatio;\nuniform float u_pixelRatio;\nuniform mat3 u_matrix;\n\nvarying vec4 v_color;\nvarying float v_border;\n\nconst float bias = 255.0 / 254.0;\n\nvoid main() {\n gl_Position = vec4(\n (u_matrix * vec3(a_position, 1)).xy,\n 0,\n 1\n );\n\n // Multiply the point size twice:\n // - x SCALING_RATIO to correct the canvas scaling\n // - x 2 to correct the formulae\n gl_PointSize = a_size / u_sizeRatio * u_pixelRatio * 2.0;\n\n v_border = (0.5 / a_size) * u_sizeRatio;\n\n #ifdef PICKING_MODE\n // For picking mode, we use the ID as the color:\n v_color = a_id;\n #else\n // For normal mode, we use the color:\n v_color = a_color;\n #endif\n\n v_color.a *= bias;\n}\n";
var VERTEX_SHADER_SOURCE$2 = SHADER_SOURCE$4;
var SHADER_SOURCE$5 = /*glsl*/"\nattribute vec4 a_id;\nattribute vec4 a_color;\nattribute vec2 a_position;\nattribute float a_size;\n\nuniform float u_sizeRatio;\nuniform float u_pixelRatio;\nuniform mat3 u_matrix;\n\nvarying vec4 v_color;\nvarying float v_border;\n\nconst float bias = 255.0 / 254.0;\n\nvoid main() {\n gl_Position = vec4(\n (u_matrix * vec3(a_position, 1)).xy,\n 0,\n 1\n );\n\n // Multiply the point size twice:\n // - x SCALING_RATIO to correct the canvas scaling\n // - x 2 to correct the formulae\n gl_PointSize = a_size / u_sizeRatio * u_pixelRatio * 2.0;\n\n v_border = (0.5 / a_size) * u_sizeRatio;\n\n #ifdef PICKING_MODE\n // For picking mode, we use the ID as the color:\n v_color = a_id;\n #else\n // For normal mode, we use the color:\n v_color = a_color;\n #endif\n\n v_color.a *= bias;\n}\n";
var VERTEX_SHADER_SOURCE$3 = SHADER_SOURCE$5;
var _WebGLRenderingContex$2 = WebGLRenderingContext,
UNSIGNED_BYTE$2 = _WebGLRenderingContex$2.UNSIGNED_BYTE,
FLOAT$2 = _WebGLRenderingContex$2.FLOAT;
var UNIFORMS$2 = ["u_sizeRatio", "u_pixelRatio", "u_matrix"];
var _WebGLRenderingContex$3 = WebGLRenderingContext,
UNSIGNED_BYTE$3 = _WebGLRenderingContex$3.UNSIGNED_BYTE,
FLOAT$3 = _WebGLRenderingContex$3.FLOAT;
var UNIFORMS$3 = ["u_sizeRatio", "u_pixelRatio", "u_matrix"];
var NodePointProgram = /*#__PURE__*/function (_NodeProgram) {

@@ -30,18 +30,18 @@ _inherits(NodePointProgram, _NodeProgram);

VERTICES: 1,
VERTEX_SHADER_SOURCE: VERTEX_SHADER_SOURCE$2,
VERTEX_SHADER_SOURCE: VERTEX_SHADER_SOURCE$3,
FRAGMENT_SHADER_SOURCE: FRAGMENT_SHADER_SOURCE$2,
METHOD: WebGLRenderingContext.POINTS,
UNIFORMS: UNIFORMS$2,
UNIFORMS: UNIFORMS$3,
ATTRIBUTES: [{
name: "a_position",
size: 2,
type: FLOAT$2
type: FLOAT$3
}, {
name: "a_size",
size: 1,
type: FLOAT$2
type: FLOAT$3
}, {
name: "a_color",
size: 4,
type: UNSIGNED_BYTE$2,
type: UNSIGNED_BYTE$3,
normalized: true

@@ -51,3 +51,3 @@ }, {

size: 4,
type: UNSIGNED_BYTE$2,
type: UNSIGNED_BYTE$3,
normalized: true

@@ -87,2 +87,156 @@ }]

// language=GLSL
var SHADER_SOURCE$4 = /*glsl*/"\nattribute vec4 a_id;\nattribute vec4 a_color;\nattribute vec2 a_normal;\nattribute float a_normalCoef;\nattribute vec2 a_positionStart;\nattribute vec2 a_positionEnd;\nattribute float a_positionCoef;\nattribute float a_sourceRadius;\nattribute float a_targetRadius;\nattribute float a_sourceRadiusCoef;\nattribute float a_targetRadiusCoef;\n\nuniform mat3 u_matrix;\nuniform float u_zoomRatio;\nuniform float u_sizeRatio;\nuniform float u_pixelRatio;\nuniform float u_correctionRatio;\nuniform float u_minEdgeThickness;\nuniform float u_lengthToThicknessRatio;\nuniform float u_feather;\n\nvarying vec4 v_color;\nvarying vec2 v_normal;\nvarying float v_thickness;\nvarying float v_feather;\n\nconst float bias = 255.0 / 254.0;\n\nvoid main() {\n float minThickness = u_minEdgeThickness;\n\n vec2 normal = a_normal * a_normalCoef;\n vec2 position = a_positionStart * (1.0 - a_positionCoef) + a_positionEnd * a_positionCoef;\n\n float normalLength = length(normal);\n vec2 unitNormal = normal / normalLength;\n\n // These first computations are taken from edge.vert.glsl. Please read it to\n // get better comments on what's happening:\n float pixelsThickness = max(normalLength, minThickness * u_sizeRatio);\n float webGLThickness = pixelsThickness * u_correctionRatio / u_sizeRatio;\n\n // Here, we move the point to leave space for the arrow heads:\n // Source arrow head\n float sourceRadius = a_sourceRadius * a_sourceRadiusCoef;\n float sourceDirection = sign(sourceRadius);\n float webGLSourceRadius = sourceDirection * sourceRadius * 2.0 * u_correctionRatio / u_sizeRatio;\n float webGLSourceArrowHeadLength = webGLThickness * u_lengthToThicknessRatio * 2.0;\n vec2 sourceCompensationVector =\n vec2(-sourceDirection * unitNormal.y, sourceDirection * unitNormal.x)\n * (webGLSourceRadius + webGLSourceArrowHeadLength);\n \n // Target arrow head\n float targetRadius = a_targetRadius * a_targetRadiusCoef;\n float targetDirection = sign(targetRadius);\n float webGLTargetRadius = targetDirection * targetRadius * 2.0 * u_correctionRatio / u_sizeRatio;\n float webGLTargetArrowHeadLength = webGLThickness * u_lengthToThicknessRatio * 2.0;\n vec2 targetCompensationVector =\n vec2(-targetDirection * unitNormal.y, targetDirection * unitNormal.x)\n * (webGLTargetRadius + webGLTargetArrowHeadLength);\n\n // Here is the proper position of the vertex\n gl_Position = vec4((u_matrix * vec3(position + unitNormal * webGLThickness + sourceCompensationVector + targetCompensationVector, 1)).xy, 0, 1);\n\n v_thickness = webGLThickness / u_zoomRatio;\n\n v_normal = unitNormal;\n\n v_feather = u_feather * u_correctionRatio / u_zoomRatio / u_pixelRatio * 2.0;\n\n #ifdef PICKING_MODE\n // For picking mode, we use the ID as the color:\n v_color = a_id;\n #else\n // For normal mode, we use the color:\n v_color = a_color;\n #endif\n\n v_color.a *= bias;\n}\n";
var VERTEX_SHADER_SOURCE$2 = SHADER_SOURCE$4;
var _WebGLRenderingContex$2 = WebGLRenderingContext,
UNSIGNED_BYTE$2 = _WebGLRenderingContex$2.UNSIGNED_BYTE,
FLOAT$2 = _WebGLRenderingContex$2.FLOAT;
var UNIFORMS$2 = ["u_matrix", "u_zoomRatio", "u_sizeRatio", "u_correctionRatio", "u_pixelRatio", "u_feather", "u_minEdgeThickness", "u_lengthToThicknessRatio"];
var DEFAULT_EDGE_DOUBLE_CLAMPED_PROGRAM_OPTIONS = {
lengthToThicknessRatio: DEFAULT_EDGE_ARROW_HEAD_PROGRAM_OPTIONS.lengthToThicknessRatio
};
function createEdgeDoubleClampedProgram(inputOptions) {
var options = _objectSpread2(_objectSpread2({}, DEFAULT_EDGE_DOUBLE_CLAMPED_PROGRAM_OPTIONS), inputOptions || {});
return /*#__PURE__*/function (_EdgeProgram) {
_inherits(EdgeDoubleClampedProgram, _EdgeProgram);
function EdgeDoubleClampedProgram() {
_classCallCheck(this, EdgeDoubleClampedProgram);
return _callSuper(this, EdgeDoubleClampedProgram, arguments);
}
_createClass(EdgeDoubleClampedProgram, [{
key: "getDefinition",
value: function getDefinition() {
return {
VERTICES: 6,
VERTEX_SHADER_SOURCE: VERTEX_SHADER_SOURCE$2,
FRAGMENT_SHADER_SOURCE: FRAGMENT_SHADER_SOURCE$3,
METHOD: WebGLRenderingContext.TRIANGLES,
UNIFORMS: UNIFORMS$2,
ATTRIBUTES: [{
name: "a_positionStart",
size: 2,
type: FLOAT$2
}, {
name: "a_positionEnd",
size: 2,
type: FLOAT$2
}, {
name: "a_normal",
size: 2,
type: FLOAT$2
}, {
name: "a_color",
size: 4,
type: UNSIGNED_BYTE$2,
normalized: true
}, {
name: "a_id",
size: 4,
type: UNSIGNED_BYTE$2,
normalized: true
}, {
name: "a_sourceRadius",
size: 1,
type: FLOAT$2
}, {
name: "a_targetRadius",
size: 1,
type: FLOAT$2
}],
CONSTANT_ATTRIBUTES: [
// If 0, then position will be a_positionStart
// If 1, then position will be a_positionEnd
{
name: "a_positionCoef",
size: 1,
type: FLOAT$2
}, {
name: "a_normalCoef",
size: 1,
type: FLOAT$2
}, {
name: "a_sourceRadiusCoef",
size: 1,
type: FLOAT$2
}, {
name: "a_targetRadiusCoef",
size: 1,
type: FLOAT$2
}],
CONSTANT_DATA: [[0, 1, -1, 0], [0, -1, 1, 0], [1, 1, 0, 1], [1, 1, 0, 1], [0, -1, 1, 0], [1, -1, 0, -1]]
};
}
}, {
key: "processVisibleItem",
value: function processVisibleItem(edgeIndex, startIndex, sourceData, targetData, data) {
var thickness = data.size || 1;
var x1 = sourceData.x;
var y1 = sourceData.y;
var x2 = targetData.x;
var y2 = targetData.y;
var color = floatColor(data.color);
// Computing normals
var dx = x2 - x1;
var dy = y2 - y1;
var sourceRadius = sourceData.size || 1;
var targetRadius = targetData.size || 1;
var len = dx * dx + dy * dy;
var n1 = 0;
var n2 = 0;
if (len) {
len = 1 / Math.sqrt(len);
n1 = -dy * len * thickness;
n2 = dx * len * thickness;
}
var array = this.array;
array[startIndex++] = x1;
array[startIndex++] = y1;
array[startIndex++] = x2;
array[startIndex++] = y2;
array[startIndex++] = n1;
array[startIndex++] = n2;
array[startIndex++] = color;
array[startIndex++] = edgeIndex;
array[startIndex++] = sourceRadius;
array[startIndex++] = targetRadius;
}
}, {
key: "setUniforms",
value: function setUniforms(params, _ref) {
var gl = _ref.gl,
uniformLocations = _ref.uniformLocations;
var u_matrix = uniformLocations.u_matrix,
u_zoomRatio = uniformLocations.u_zoomRatio,
u_feather = uniformLocations.u_feather,
u_pixelRatio = uniformLocations.u_pixelRatio,
u_correctionRatio = uniformLocations.u_correctionRatio,
u_sizeRatio = uniformLocations.u_sizeRatio,
u_minEdgeThickness = uniformLocations.u_minEdgeThickness,
u_lengthToThicknessRatio = uniformLocations.u_lengthToThicknessRatio;
gl.uniformMatrix3fv(u_matrix, false, params.matrix);
gl.uniform1f(u_zoomRatio, params.zoomRatio);
gl.uniform1f(u_sizeRatio, params.sizeRatio);
gl.uniform1f(u_correctionRatio, params.correctionRatio);
gl.uniform1f(u_pixelRatio, params.pixelRatio);
gl.uniform1f(u_feather, params.antiAliasingFeather);
gl.uniform1f(u_minEdgeThickness, params.minEdgeThickness);
gl.uniform1f(u_lengthToThicknessRatio, options.lengthToThicknessRatio);
}
}]);
return EdgeDoubleClampedProgram;
}(EdgeProgram);
}
var EdgeDoubleClampedProgram = createEdgeDoubleClampedProgram();
var EdgeDoubleClampedProgram$1 = EdgeDoubleClampedProgram;
function createEdgeDoubleArrowProgram(inputOptions) {
return createEdgeCompoundProgram([createEdgeDoubleClampedProgram(inputOptions), createEdgeArrowHeadProgram(inputOptions), createEdgeArrowHeadProgram(_objectSpread2(_objectSpread2({}, inputOptions), {}, {
extremity: "source"
}))]);
}
var EdgeDoubleArrowProgram = createEdgeDoubleArrowProgram();
var EdgeDoubleArrowProgram$1 = EdgeDoubleArrowProgram;
// language=GLSL
var SHADER_SOURCE$3 = /*glsl*/"\nprecision mediump float;\n\nvarying vec4 v_color;\n\nvoid main(void) {\n gl_FragColor = v_color;\n}\n";

@@ -281,2 +435,2 @@ var FRAGMENT_SHADER_SOURCE$1 = SHADER_SOURCE$3;

export { EdgeLineProgram, EdgeTriangleProgram, NodePointProgram };
export { DEFAULT_EDGE_DOUBLE_CLAMPED_PROGRAM_OPTIONS, EdgeDoubleArrowProgram$1 as EdgeDoubleArrowProgram, EdgeDoubleClampedProgram$1 as EdgeDoubleClampedProgram, EdgeLineProgram, EdgeTriangleProgram, NodePointProgram, createEdgeDoubleArrowProgram, createEdgeDoubleClampedProgram };

@@ -5,3 +5,3 @@ 'use strict';

var index = require('../../dist/index-ee48a08c.cjs.dev.js');
var index = require('../../dist/index-f81ac934.cjs.dev.js');
var data = require('../../dist/data-d0a8f6df.cjs.dev.js');

@@ -8,0 +8,0 @@ require('../../dist/inherits-3d03d999.cjs.dev.js');

@@ -5,3 +5,3 @@ 'use strict';

var index = require('../../dist/index-4cdce1d5.cjs.prod.js');
var index = require('../../dist/index-a45faf79.cjs.prod.js');
var data = require('../../dist/data-7e3d4a4a.cjs.prod.js');

@@ -8,0 +8,0 @@ require('../../dist/inherits-bddcfb5f.cjs.prod.js');

@@ -1,2 +0,2 @@

import { d as drawStraightEdgeLabel, b as drawDiscNodeLabel, c as drawDiscNodeHover, N as NodeCircleProgram, E as EdgeArrowProgram, e as EdgeRectangleProgram } from '../../dist/index-991e05f6.esm.js';
import { d as drawStraightEdgeLabel, b as drawDiscNodeLabel, c as drawDiscNodeHover, N as NodeCircleProgram, E as EdgeArrowProgram, e as EdgeRectangleProgram } from '../../dist/index-4d79933a.esm.js';
import { a as assign } from '../../dist/data-31990a76.esm.js';

@@ -3,0 +3,0 @@ import '../../dist/inherits-c41b88d9.esm.js';

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc