Comparing version 3.0.0-alpha1 to 3.0.0-alpha2
{ | ||
"name": "sigma", | ||
"version": "3.0.0-alpha1", | ||
"version": "3.0.0-alpha2", | ||
"description": "A JavaScript library aimed at visualizing graphs of thousands of nodes and edges.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://www.sigmajs.org", |
@@ -9,11 +9,3 @@ /** | ||
import type Sigma from "../../../../sigma"; | ||
export interface RenderParams { | ||
width: number; | ||
height: number; | ||
sizeRatio: number; | ||
zoomRatio: number; | ||
pixelRatio: number; | ||
correctionRatio: number; | ||
matrix: Float32Array; | ||
} | ||
import type { RenderParams } from "../../../../types"; | ||
export interface ProgramAttributeSpecification { | ||
@@ -20,0 +12,0 @@ name: string; |
"use strict"; | ||
var _a; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -6,2 +7,12 @@ exports.Program = exports.AbstractProgram = void 0; | ||
var utils_2 = require("../../shaders/utils"); | ||
var SIZE_FACTOR_PER_ATTRIBUTE_TYPE = (_a = {}, | ||
_a[WebGL2RenderingContext.BOOL] = 1, | ||
_a[WebGL2RenderingContext.BYTE] = 1, | ||
_a[WebGL2RenderingContext.UNSIGNED_BYTE] = 1, | ||
_a[WebGL2RenderingContext.SHORT] = 2, | ||
_a[WebGL2RenderingContext.UNSIGNED_SHORT] = 2, | ||
_a[WebGL2RenderingContext.INT] = 4, | ||
_a[WebGL2RenderingContext.UNSIGNED_INT] = 4, | ||
_a[WebGL2RenderingContext.FLOAT] = 4, | ||
_a); | ||
var AbstractProgram = /** @class */ (function () { | ||
@@ -81,11 +92,6 @@ // eslint-disable-next-line @typescript-eslint/no-empty-function | ||
gl.vertexAttribPointer(location, attr.size, attr.type, attr.normalized || false, _this.ARRAY_ITEMS_PER_VERTEX * Float32Array.BYTES_PER_ELEMENT, offset); | ||
if (attr.type === WebGLRenderingContext.UNSIGNED_BYTE) { | ||
offset += attr.size; | ||
} | ||
else if (attr.type === WebGLRenderingContext.FLOAT) { | ||
offset += attr.size * 4; | ||
} | ||
else { | ||
throw new Error("yet unsupported attribute type"); | ||
} | ||
var sizeFactor = SIZE_FACTOR_PER_ATTRIBUTE_TYPE[attr.type]; | ||
if (typeof sizeFactor !== "number") | ||
throw new Error("Program.bind: yet unsupported attribute type \"".concat(attr.type, "\"!")); | ||
offset += attr.size * sizeFactor; | ||
}); | ||
@@ -92,0 +98,0 @@ }; |
@@ -8,5 +8,4 @@ /** | ||
*/ | ||
import { NodeDisplayData, EdgeDisplayData } from "../../../types"; | ||
import { NodeDisplayData, EdgeDisplayData, RenderParams } from "../../../types"; | ||
import { EdgeProgram } from "./common/edge"; | ||
import { RenderParams } from "./common/program"; | ||
declare const UNIFORMS: readonly ["u_matrix", "u_sizeRatio", "u_correctionRatio"]; | ||
@@ -13,0 +12,0 @@ export default class EdgeArrowHeadProgram extends EdgeProgram<typeof UNIFORMS[number]> { |
@@ -9,5 +9,4 @@ /** | ||
*/ | ||
import { NodeDisplayData, EdgeDisplayData } from "../../../types"; | ||
import { NodeDisplayData, EdgeDisplayData, RenderParams } from "../../../types"; | ||
import { EdgeProgram } from "./common/edge"; | ||
import { RenderParams } from "./common/program"; | ||
declare const UNIFORMS: readonly ["u_matrix"]; | ||
@@ -14,0 +13,0 @@ export default class EdgeLineProgram extends EdgeProgram<typeof UNIFORMS[number]> { |
@@ -18,5 +18,4 @@ /** | ||
*/ | ||
import { NodeDisplayData, EdgeDisplayData } from "../../../types"; | ||
import { NodeDisplayData, EdgeDisplayData, RenderParams } from "../../../types"; | ||
import { EdgeProgram } from "./common/edge"; | ||
import { RenderParams } from "./common/program"; | ||
declare const UNIFORMS: readonly ["u_matrix", "u_zoomRatio", "u_sizeRatio", "u_correctionRatio"]; | ||
@@ -23,0 +22,0 @@ export default class EdgeRectangleProgram extends EdgeProgram<typeof UNIFORMS[number]> { |
@@ -8,5 +8,4 @@ /** | ||
*/ | ||
import { NodeDisplayData, EdgeDisplayData } from "../../../types"; | ||
import { NodeDisplayData, EdgeDisplayData, RenderParams } from "../../../types"; | ||
import { EdgeProgram } from "./common/edge"; | ||
import { RenderParams } from "./common/program"; | ||
declare const UNIFORMS: readonly ["u_matrix", "u_sizeRatio", "u_correctionRatio"]; | ||
@@ -13,0 +12,0 @@ export default class EdgeTriangleProgram extends EdgeProgram<typeof UNIFORMS[number]> { |
@@ -11,7 +11,9 @@ /** | ||
*/ | ||
import { NodeDisplayData } from "../../../types"; | ||
import { NodeDisplayData, RenderParams } from "../../../types"; | ||
import { NodeProgram } from "./common/node"; | ||
import { RenderParams } from "./common/program"; | ||
declare const UNIFORMS: readonly ["u_sizeRatio", "u_correctionRatio", "u_matrix"]; | ||
export default class NodeCircleProgram extends NodeProgram<typeof UNIFORMS[number]> { | ||
static readonly ANGLE_1 = 0; | ||
static readonly ANGLE_2: number; | ||
static readonly ANGLE_3: number; | ||
getDefinition(): { | ||
@@ -18,0 +20,0 @@ VERTICES: number; |
@@ -26,5 +26,2 @@ "use strict"; | ||
var UNSIGNED_BYTE = WebGLRenderingContext.UNSIGNED_BYTE, FLOAT = WebGLRenderingContext.FLOAT; | ||
var ANGLE_1 = 0; | ||
var ANGLE_2 = (2 * Math.PI) / 3; | ||
var ANGLE_3 = (4 * Math.PI) / 3; | ||
var UNIFORMS = ["u_sizeRatio", "u_correctionRatio", "u_matrix"]; | ||
@@ -58,3 +55,3 @@ var NodeCircleProgram = /** @class */ (function (_super) { | ||
array[i++] = color; | ||
array[i++] = ANGLE_1; | ||
array[i++] = NodeCircleProgram.ANGLE_1; | ||
array[i++] = data.x; | ||
@@ -64,3 +61,3 @@ array[i++] = data.y; | ||
array[i++] = color; | ||
array[i++] = ANGLE_2; | ||
array[i++] = NodeCircleProgram.ANGLE_2; | ||
array[i++] = data.x; | ||
@@ -70,3 +67,3 @@ array[i++] = data.y; | ||
array[i++] = color; | ||
array[i] = ANGLE_3; | ||
array[i] = NodeCircleProgram.ANGLE_3; | ||
}; | ||
@@ -81,4 +78,7 @@ NodeCircleProgram.prototype.draw = function (params) { | ||
}; | ||
NodeCircleProgram.ANGLE_1 = 0; | ||
NodeCircleProgram.ANGLE_2 = (2 * Math.PI) / 3; | ||
NodeCircleProgram.ANGLE_3 = (4 * Math.PI) / 3; | ||
return NodeCircleProgram; | ||
}(node_1.NodeProgram)); | ||
exports.default = NodeCircleProgram; |
@@ -10,5 +10,4 @@ /** | ||
*/ | ||
import { NodeDisplayData } from "../../../types"; | ||
import { NodeDisplayData, RenderParams } from "../../../types"; | ||
import { NodeProgram } from "./common/node"; | ||
import { RenderParams } from "./common/program"; | ||
declare const UNIFORMS: readonly ["u_sizeRatio", "u_pixelRatio", "u_matrix"]; | ||
@@ -15,0 +14,0 @@ export default class NodePointProgram extends NodeProgram<typeof UNIFORMS[number]> { |
@@ -71,2 +71,11 @@ /// <reference types="node" /> | ||
}; | ||
export interface RenderParams { | ||
width: number; | ||
height: number; | ||
sizeRatio: number; | ||
zoomRatio: number; | ||
pixelRatio: number; | ||
correctionRatio: number; | ||
matrix: Float32Array; | ||
} | ||
/** | ||
@@ -73,0 +82,0 @@ * Custom event emitter types. |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
684062
12375