Skip to content

Commit cbb44c8

Browse files
Eric RowellEric Rowell
authored andcommitted
v2.4.0
1 parent 40ba1f2 commit cbb44c8

14 files changed

Lines changed: 59 additions & 55 deletions

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
## v2.4.0
44
* node hover and selected visual treatments
55
* new darkMode property
6-
* new globalAlpha property
6+
* new glowBlend property
77
* new setDarkMode() method
88
* new nodeOutline property
99
* new selectNode() method

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ let graph = new ElGrapho({
8383

8484
* ```darkMode``` - boolean that enables or disables dark mode. The default is ```false```.
8585

86-
* ```globalAlpha``` - number between 0 and 1 that defines the global alpha of nodes and edges. Alphas are blended where nodes and edges intersect, resulting in a brightening effect at the intersections. The default is ```1```.
86+
* ```glowBlend``` - number between 0 and 1 that defines the glow blending of nodes and edges. A value of 0 has no glow blending, and a value of 1 has full glow blending. Glow blending can be used as a visual treatment to emphasize node clustering or edge bundling. It is most effective when used in conjunction with dark mode. The default is ```0```.
8787

8888
* ```fillContainer``` - boolean that enables or disables auto filling the container. When true, El Grapho will automatically detect anytime its container has changed shape, and will auto resize itself. The default is ```false```.
8989

engine/dist/ElGrapho.js

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
2-
* El Grapho v2.3.1
2+
* El Grapho v2.4.0
33
* A high performance WebGL graph data visualization engine
4-
* Release Date: 05-09-2019
4+
* Release Date: 05-10-2019
55
* https://github.com/ericdrowell/elgrapho
66
* Licensed under the MIT or GPL Version 2 licenses.
77
*
@@ -579,10 +579,10 @@ void main() {
579579

580580
if (!isFocused) {
581581
if (darkMode) {
582-
vVertexColor = vec4(60.0/255.0, 60.0/255.0, 60.0/255.0, globalAlpha) * 0.5;
582+
vVertexColor = vec4(60.0/255.0, 60.0/255.0, 60.0/255.0, globalAlpha);
583583
}
584584
else {
585-
vVertexColor = vec4(220.0/255.0, 220.0/255.0, 220.0/255.0, globalAlpha) * 0.5;
585+
vVertexColor = vec4(220.0/255.0, 220.0/255.0, 220.0/255.0, globalAlpha);
586586
}
587587
}
588588
else if (validColor == 0.0) {
@@ -801,10 +801,10 @@ void main() {
801801

802802
if (!isFocused) {
803803
if (darkMode) {
804-
vVertexColor = vec4(60.0/255.0, 60.0/255.0, 60.0/255.0, globalAlpha) * 0.5;
804+
vVertexColor = vec4(60.0/255.0, 60.0/255.0, 60.0/255.0, globalAlpha);
805805
}
806806
else {
807-
vVertexColor = vec4(220.0/255.0, 220.0/255.0, 220.0/255.0, globalAlpha) * 0.5;
807+
vVertexColor = vec4(220.0/255.0, 220.0/255.0, 220.0/255.0, globalAlpha);
808808
}
809809
}
810810
else if (validColor == 0.0) {
@@ -842,7 +842,7 @@ void main() {
842842
/*! no static exports found */
843843
/***/ (function(module, exports) {
844844

845-
module.exports = `.el-grapho-tooltip{position:fixed;background-color:white;pointer-events:none;padding:10px;border:1px solid #333;border-radius:3px;font-family:verdana;font-size:12px;user-select:none}.el-grapho-controls{position:absolute;right:0;top:5px;opacity:0;transition:opacity .3s ease-in-out}.el-grapho-controls button{background:white;padding:5px;cursor:pointer;outline:0;border:2px solid black;border-radius:3px;margin-right:5px}.el-grapho-controls .el-grapho-step-down-control{transform:scale(1,-1)}.el-grapho-wrapper:hover .el-grapho-controls{opacity:1}.el-grapho-wrapper.el-grapho-dark-mode .el-grapho-controls button{background:black;border-color:white;color:white;border-color:#aaa}.el-grapho-wrapper.el-grapho-dark-mode .el-grapho-controls button path,.el-grapho-wrapper.el-grapho-dark-mode .el-grapho-controls button polygon,.el-grapho-wrapper.el-grapho-dark-mode .el-grapho-controls button rect{fill:white}.el-grapho-wrapper.el-grapho-select-interaction-mode{cursor:default}.el-grapho-wrapper.el-grapho-select-interaction-mode .el-grapho-controls .el-grapho-select-control{border-color:#119fe0}.el-grapho-wrapper.el-grapho-select-interaction-mode .el-grapho-controls .el-grapho-select-control path,.el-grapho-wrapper.el-grapho-select-interaction-mode .el-grapho-controls .el-grapho-select-control polygon{fill:#119fe0}.el-grapho-wrapper.el-grapho-pan-interaction-mode{cursor:move}.el-grapho-wrapper.el-grapho-pan-interaction-mode .el-grapho-controls .el-grapho-pan-control{border-color:#119fe0}.el-grapho-wrapper.el-grapho-pan-interaction-mode .el-grapho-controls .el-grapho-pan-control path,.el-grapho-wrapper.el-grapho-pan-interaction-mode .el-grapho-controls .el-grapho-pan-control polygon{fill:#119fe0}.el-grapho-wrapper.el-grapho-box-zoom-interaction-mode{cursor:zoom-in}.el-grapho-wrapper.el-grapho-box-zoom-interaction-mode .el-grapho-controls .el-grapho-box-zoom-control{border-color:#119fe0}.el-grapho-wrapper.el-grapho-box-zoom-interaction-mode .el-grapho-controls .el-grapho-box-zoom-control path,.el-grapho-wrapper.el-grapho-box-zoom-interaction-mode .el-grapho-controls .el-grapho-box-zoom-control polygon{fill:#119fe0}.el-grapho-count{position:absolute;bottom:5px;right:5px;pointer-events:none;font-family:monospace;background-color:white;border-radius:3px;padding:3px;opacity:.9}.el-grapho-count::selection{background:transparent}.el-grapho-wrapper.el-grapho-dark-mode .el-grapho-count{background-color:black;color:white}.el-grapho-box-zoom-component{position:fixed;border:1px solid #119fe0;background-color:rgba(17,159,224,0.1);pointer-events:none}.el-grapho-loading-component{width:100%;height:100%;background-color:rgba(255,255,255,0.9);position:absolute;top:0;opacity:0;transition:opacity .3s ease-in-out;pointer-events:none}.el-grapho-loading .el-grapho-loading-component{opacity:1}.spinner{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.spinner>div{width:18px;height:18px;background-color:#333;border-radius:100%;display:inline-block;-webkit-animation:sk-bouncedelay 1.4s infinite ease-in-out both;animation:sk-bouncedelay 1.4s infinite ease-in-out both}.spinner .bounce1{-webkit-animation-delay:-0.32s;animation-delay:-0.32s}.spinner .bounce2{-webkit-animation-delay:-0.16s;animation-delay:-0.16s}@-webkit-keyframes sk-bouncedelay{0%,80%,100%{-webkit-transform:scale(0)}40%{-webkit-transform:scale(1)}}@keyframes sk-bouncedelay{0%,80%,100%{-webkit-transform:scale(0);transform:scale(0)}40%{-webkit-transform:scale(1);transform:scale(1)}}.el-grapho-wrapper{display:inline-block;position:relative;background-color:white;overflow:hidden}.el-grapho-wrapper.el-grapho-select-interaction-mode{cursor:default}.el-grapho-wrapper.el-grapho-pan-interaction-mode{cursor:move}.el-grapho-wrapper.el-grapho-box-zoom-interaction-mode{cursor:zoom-in}
845+
module.exports = `.el-grapho-tooltip{position:fixed;background-color:white;pointer-events:none;padding:10px;border:1px solid #333;border-radius:3px;font-family:verdana;font-size:12px;user-select:none}.el-grapho-controls{position:absolute;right:0;top:5px;opacity:0;transition:opacity .3s ease-in-out}.el-grapho-controls button{background:white;padding:5px;cursor:pointer;outline:0;border:2px solid black;border-radius:3px;margin-right:5px}.el-grapho-controls .el-grapho-step-down-control{transform:scale(1,-1)}.el-grapho-wrapper:hover .el-grapho-controls{opacity:1}.el-grapho-wrapper.el-grapho-dark-mode .el-grapho-controls button{background:black;border-color:white;color:white;border-color:#aaa}.el-grapho-wrapper.el-grapho-dark-mode .el-grapho-controls button path,.el-grapho-wrapper.el-grapho-dark-mode .el-grapho-controls button polygon,.el-grapho-wrapper.el-grapho-dark-mode .el-grapho-controls button rect{fill:white}.el-grapho-wrapper.el-grapho-select-interaction-mode{cursor:default}.el-grapho-wrapper.el-grapho-select-interaction-mode .el-grapho-controls .el-grapho-select-control{border-color:#119fe0}.el-grapho-wrapper.el-grapho-select-interaction-mode .el-grapho-controls .el-grapho-select-control path,.el-grapho-wrapper.el-grapho-select-interaction-mode .el-grapho-controls .el-grapho-select-control polygon{fill:#119fe0}.el-grapho-wrapper.el-grapho-pan-interaction-mode{cursor:move}.el-grapho-wrapper.el-grapho-pan-interaction-mode .el-grapho-controls .el-grapho-pan-control{border-color:#119fe0}.el-grapho-wrapper.el-grapho-pan-interaction-mode .el-grapho-controls .el-grapho-pan-control path,.el-grapho-wrapper.el-grapho-pan-interaction-mode .el-grapho-controls .el-grapho-pan-control polygon{fill:#119fe0}.el-grapho-wrapper.el-grapho-box-zoom-interaction-mode{cursor:zoom-in}.el-grapho-wrapper.el-grapho-box-zoom-interaction-mode .el-grapho-controls .el-grapho-box-zoom-control{border-color:#119fe0}.el-grapho-wrapper.el-grapho-box-zoom-interaction-mode .el-grapho-controls .el-grapho-box-zoom-control path,.el-grapho-wrapper.el-grapho-box-zoom-interaction-mode .el-grapho-controls .el-grapho-box-zoom-control polygon{fill:#119fe0}.el-grapho-count{position:absolute;bottom:5px;right:5px;pointer-events:none;font-family:monospace;background-color:white;border-radius:3px;padding:3px;opacity:.9}.el-grapho-count::selection{background:transparent}.el-grapho-wrapper.el-grapho-dark-mode .el-grapho-count{background-color:black;color:white}.el-grapho-box-zoom-component{position:fixed;border:1px solid #119fe0;background-color:rgba(17,159,224,0.1);pointer-events:none}.el-grapho-loading-component{width:100%;height:100%;background-color:rgba(255,255,255,0.9);position:absolute;top:0;opacity:0;transition:opacity .3s ease-in-out;pointer-events:none}.el-grapho-loading .el-grapho-loading-component{opacity:1}.spinner{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.spinner>div{width:18px;height:18px;background-color:#333;border-radius:100%;display:inline-block;-webkit-animation:sk-bouncedelay 1.4s infinite ease-in-out both;animation:sk-bouncedelay 1.4s infinite ease-in-out both}.spinner .bounce1{-webkit-animation-delay:-0.32s;animation-delay:-0.32s}.spinner .bounce2{-webkit-animation-delay:-0.16s;animation-delay:-0.16s}@-webkit-keyframes sk-bouncedelay{0%,80%,100%{-webkit-transform:scale(0)}40%{-webkit-transform:scale(1)}}@keyframes sk-bouncedelay{0%,80%,100%{-webkit-transform:scale(0);transform:scale(0)}40%{-webkit-transform:scale(1);transform:scale(1)}}.el-grapho-wrapper{display:inline-block;position:relative;background-color:white;overflow:hidden}.el-grapho-wrapper.el-grapho-select-interaction-mode{cursor:default}.el-grapho-wrapper.el-grapho-pan-interaction-mode{cursor:move}.el-grapho-wrapper.el-grapho-box-zoom-interaction-mode{cursor:zoom-in}.el-grapho-wrapper.el-grapho-dark-mode{background-color:black}
846846
`;
847847

848848
/***/ }),
@@ -1032,7 +1032,7 @@ ElGrapho.prototype = {
10321032
this.focusedGroup = -1;
10331033
this.tooltips = config.tooltips === undefined ? true : config.tooltips;
10341034
this.fillContainer = config.fillContainer === undefined ? false : config.fillContainer;
1035-
this.globalAlpha = config.globalAlpha === undefined ? 1 : config.globalAlpha;
1035+
this.glowBlend = config.glowBlend === undefined ? 0 : config.glowBlend;
10361036
this.nodeOutline = config.nodeOutline === undefined ? true : config.nodeOutline;
10371037
this.animations = [];
10381038
this.wrapper = document.createElement('div');
@@ -1916,12 +1916,9 @@ let ElGraphoCollection = {
19161916
if (graph.dirty) {
19171917
idle = false;
19181918
let focusedGroup = graph.focusedGroup;
1919-
let globalAlpha = graph.globalAlpha;
1919+
let glowBlend = graph.glowBlend;
19201920

1921-
// if (focusedGroup > -1) {
1922-
// globalAlpha = 1;
1923-
// }
1924-
graph.webgl.drawScene(graph.width, graph.height, graph.panX, graph.panY, graph.zoomX, graph.zoomY, magicZoom, nodeSize, focusedGroup, graph.hoveredDataIndex, graph.edgeSize, graph.darkMode, globalAlpha, graph.nodeOutline);
1921+
graph.webgl.drawScene(graph.width, graph.height, graph.panX, graph.panY, graph.zoomX, graph.zoomY, magicZoom, nodeSize, focusedGroup, graph.hoveredDataIndex, graph.edgeSize, graph.darkMode, glowBlend, graph.nodeOutline);
19251922

19261923
graph.labelsLayer.scene.clear();
19271924

@@ -2575,19 +2572,21 @@ WebGL.prototype = {
25752572
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
25762573
gl.vertexAttribPointer(attribute, buffer.itemSize, gl.FLOAT, false, 0, 0);
25772574
},
2578-
drawScenePoints: function(projectionMatrix, modelViewMatrix, magicZoom, nodeSize, focusedGroup, zoom, globalAlpha, darkMode) {
2575+
drawScenePoints: function(projectionMatrix, modelViewMatrix, magicZoom, nodeSize, focusedGroup, zoom, glowBlend, darkMode) {
25792576
let layer = this.layer;
25802577
let gl = layer.scene.context;
25812578
let shaderProgram = this.getPointShaderProgram();
25822579
let buffers = this.buffers.points;
25832580

2581+
2582+
25842583
gl.uniformMatrix4fv(shaderProgram.projectionMatrixUniform, false, projectionMatrix);
25852584
gl.uniformMatrix4fv(shaderProgram.modelViewMatrixUniform, false, modelViewMatrix);
25862585
gl.uniform1i(shaderProgram.magicZoom, magicZoom);
25872586
gl.uniform1f(shaderProgram.nodeSize, nodeSize);
25882587
gl.uniform1f(shaderProgram.focusedGroup, focusedGroup);
25892588
gl.uniform1f(shaderProgram.zoom, zoom);
2590-
gl.uniform1f(shaderProgram.globalAlpha, globalAlpha);
2589+
gl.uniform1f(shaderProgram.globalAlpha, 1-glowBlend);
25912590
gl.uniform1i(shaderProgram.darkMode, darkMode);
25922591

25932592
this.bindBuffer(buffers.positions, shaderProgram.vertexPositionAttribute, gl);
@@ -2615,20 +2614,20 @@ WebGL.prototype = {
26152614

26162615
gl.drawArrays(gl.POINTS, 0, buffers.positions.numItems);
26172616
},
2618-
drawSceneTriangles: function(projectionMatrix, modelViewMatrix, magicZoom, nodeSize, focusedGroup, edgeSize, zoom, globalAlpha, darkMode) {
2617+
drawSceneTriangles: function(projectionMatrix, modelViewMatrix, magicZoom, nodeSize, focusedGroup, edgeSize, zoom, glowBlend, darkMode) {
26192618
let layer = this.layer;
26202619
let gl = layer.scene.context;
26212620
let shaderProgram = this.getTriangleShaderProgram();
26222621
let buffers = this.buffers.triangles;
2623-
2622+
26242623
gl.uniformMatrix4fv(shaderProgram.projectionMatrixUniform, false, projectionMatrix);
26252624
gl.uniformMatrix4fv(shaderProgram.modelViewMatrixUniform, false, modelViewMatrix);
26262625
gl.uniform1i(shaderProgram.magicZoom, magicZoom);
26272626
gl.uniform1f(shaderProgram.nodeSize, nodeSize);
26282627
gl.uniform1f(shaderProgram.edgeSize, edgeSize);
26292628
gl.uniform1f(shaderProgram.focusedGroup, focusedGroup);
26302629
gl.uniform1f(shaderProgram.zoom, zoom);
2631-
gl.uniform1f(shaderProgram.globalAlpha, globalAlpha);
2630+
gl.uniform1f(shaderProgram.globalAlpha, 1-glowBlend);
26322631
gl.uniform1i(shaderProgram.darkMode, darkMode);
26332632

26342633
this.bindBuffer(buffers.positions, shaderProgram.vertexPositionAttribute, gl);
@@ -2637,7 +2636,7 @@ WebGL.prototype = {
26372636

26382637
gl.drawArrays(gl.TRIANGLES, 0, buffers.positions.numItems);
26392638
},
2640-
drawScene: function(width, height, panX, panY, zoomX, zoomY, magicZoom, nodeSize, focusedGroup, hoverNode, edgeSize, darkMode, globalAlpha, nodeOutline) {
2639+
drawScene: function(width, height, panX, panY, zoomX, zoomY, magicZoom, nodeSize, focusedGroup, hoverNode, edgeSize, darkMode, glowBlend, nodeOutline) {
26412640
let layer = this.layer;
26422641
let gl = layer.scene.context;
26432642
let zoom = Math.min(zoomX, zoomY);
@@ -2685,24 +2684,24 @@ WebGL.prototype = {
26852684
gl.disable(gl.DEPTH_TEST);
26862685
gl.disable(gl.BLEND);
26872686

2688-
if (globalAlpha === 1) {
2687+
if (glowBlend === 0) {
26892688
gl.enable(gl.DEPTH_TEST);
26902689
}
26912690
else {
26922691
gl.enable(gl.BLEND);
2693-
gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA);
2692+
gl.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA);
26942693
}
26952694

26962695
if (this.buffers.triangles) {
2697-
this.drawSceneTriangles(projectionMatrix, modelViewMatrix, magicZoom, nodeSize, focusedGroup, edgeSize, zoom, globalAlpha, darkMode);
2696+
this.drawSceneTriangles(projectionMatrix, modelViewMatrix, magicZoom, nodeSize, focusedGroup, edgeSize, zoom, glowBlend, darkMode);
26982697
}
26992698

27002699
if (this.buffers.points) {
27012700

27022701
if (nodeOutline) {
27032702
this.drawScenePointStrokes(projectionMatrix, modelViewMatrix, magicZoom, nodeSize, focusedGroup, hoverNode, zoom, darkMode);
27042703
}
2705-
this.drawScenePoints(projectionMatrix, modelViewMatrix, magicZoom, nodeSize, focusedGroup, zoom, globalAlpha, darkMode);
2704+
this.drawScenePoints(projectionMatrix, modelViewMatrix, magicZoom, nodeSize, focusedGroup, zoom, glowBlend, darkMode);
27062705
}
27072706

27082707

engine/dist/ElGrapho.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

engine/src/ElGrapho.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ ElGrapho.prototype = {
7070
this.focusedGroup = -1;
7171
this.tooltips = config.tooltips === undefined ? true : config.tooltips;
7272
this.fillContainer = config.fillContainer === undefined ? false : config.fillContainer;
73-
this.globalAlpha = config.globalAlpha === undefined ? 1 : config.globalAlpha;
73+
this.glowBlend = config.glowBlend === undefined ? 0 : config.glowBlend;
7474
this.nodeOutline = config.nodeOutline === undefined ? true : config.nodeOutline;
7575
this.animations = [];
7676
this.wrapper = document.createElement('div');

engine/src/ElGraphoCollection.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,9 @@ let ElGraphoCollection = {
9090
if (graph.dirty) {
9191
idle = false;
9292
let focusedGroup = graph.focusedGroup;
93-
let globalAlpha = graph.globalAlpha;
93+
let glowBlend = graph.glowBlend;
9494

95-
// if (focusedGroup > -1) {
96-
// globalAlpha = 1;
97-
// }
98-
graph.webgl.drawScene(graph.width, graph.height, graph.panX, graph.panY, graph.zoomX, graph.zoomY, magicZoom, nodeSize, focusedGroup, graph.hoveredDataIndex, graph.edgeSize, graph.darkMode, globalAlpha, graph.nodeOutline);
95+
graph.webgl.drawScene(graph.width, graph.height, graph.panX, graph.panY, graph.zoomX, graph.zoomY, magicZoom, nodeSize, focusedGroup, graph.hoveredDataIndex, graph.edgeSize, graph.darkMode, glowBlend, graph.nodeOutline);
9996

10097
graph.labelsLayer.scene.clear();
10198

0 commit comments

Comments
 (0)