Skip to content

Commit

Permalink
v2.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric Rowell authored and Eric Rowell committed May 11, 2019
1 parent 40ba1f2 commit cbb44c8
Show file tree
Hide file tree
Showing 14 changed files with 59 additions and 55 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## v2.4.0
* node hover and selected visual treatments
* new darkMode property
* new globalAlpha property
* new glowBlend property
* new setDarkMode() method
* new nodeOutline property
* new selectNode() method
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ let graph = new ElGrapho({

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

* ```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```.
* ```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```.

* ```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```.

Expand Down
45 changes: 22 additions & 23 deletions engine/dist/ElGrapho.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* El Grapho v2.3.1
* El Grapho v2.4.0
* A high performance WebGL graph data visualization engine
* Release Date: 05-09-2019
* Release Date: 05-10-2019
* https://github.com/ericdrowell/elgrapho
* Licensed under the MIT or GPL Version 2 licenses.
*
Expand Down Expand Up @@ -579,10 +579,10 @@ void main() {

if (!isFocused) {
if (darkMode) {
vVertexColor = vec4(60.0/255.0, 60.0/255.0, 60.0/255.0, globalAlpha) * 0.5;
vVertexColor = vec4(60.0/255.0, 60.0/255.0, 60.0/255.0, globalAlpha);
}
else {
vVertexColor = vec4(220.0/255.0, 220.0/255.0, 220.0/255.0, globalAlpha) * 0.5;
vVertexColor = vec4(220.0/255.0, 220.0/255.0, 220.0/255.0, globalAlpha);
}
}
else if (validColor == 0.0) {
Expand Down Expand Up @@ -801,10 +801,10 @@ void main() {

if (!isFocused) {
if (darkMode) {
vVertexColor = vec4(60.0/255.0, 60.0/255.0, 60.0/255.0, globalAlpha) * 0.5;
vVertexColor = vec4(60.0/255.0, 60.0/255.0, 60.0/255.0, globalAlpha);
}
else {
vVertexColor = vec4(220.0/255.0, 220.0/255.0, 220.0/255.0, globalAlpha) * 0.5;
vVertexColor = vec4(220.0/255.0, 220.0/255.0, 220.0/255.0, globalAlpha);
}
}
else if (validColor == 0.0) {
Expand Down Expand Up @@ -842,7 +842,7 @@ void main() {
/*! no static exports found */
/***/ (function(module, exports) {

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}
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}
`;

/***/ }),
Expand Down Expand Up @@ -1032,7 +1032,7 @@ ElGrapho.prototype = {
this.focusedGroup = -1;
this.tooltips = config.tooltips === undefined ? true : config.tooltips;
this.fillContainer = config.fillContainer === undefined ? false : config.fillContainer;
this.globalAlpha = config.globalAlpha === undefined ? 1 : config.globalAlpha;
this.glowBlend = config.glowBlend === undefined ? 0 : config.glowBlend;
this.nodeOutline = config.nodeOutline === undefined ? true : config.nodeOutline;
this.animations = [];
this.wrapper = document.createElement('div');
Expand Down Expand Up @@ -1916,12 +1916,9 @@ let ElGraphoCollection = {
if (graph.dirty) {
idle = false;
let focusedGroup = graph.focusedGroup;
let globalAlpha = graph.globalAlpha;
let glowBlend = graph.glowBlend;

// if (focusedGroup > -1) {
// globalAlpha = 1;
// }
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);
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);

graph.labelsLayer.scene.clear();

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



gl.uniformMatrix4fv(shaderProgram.projectionMatrixUniform, false, projectionMatrix);
gl.uniformMatrix4fv(shaderProgram.modelViewMatrixUniform, false, modelViewMatrix);
gl.uniform1i(shaderProgram.magicZoom, magicZoom);
gl.uniform1f(shaderProgram.nodeSize, nodeSize);
gl.uniform1f(shaderProgram.focusedGroup, focusedGroup);
gl.uniform1f(shaderProgram.zoom, zoom);
gl.uniform1f(shaderProgram.globalAlpha, globalAlpha);
gl.uniform1f(shaderProgram.globalAlpha, 1-glowBlend);
gl.uniform1i(shaderProgram.darkMode, darkMode);

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

gl.drawArrays(gl.POINTS, 0, buffers.positions.numItems);
},
drawSceneTriangles: function(projectionMatrix, modelViewMatrix, magicZoom, nodeSize, focusedGroup, edgeSize, zoom, globalAlpha, darkMode) {
drawSceneTriangles: function(projectionMatrix, modelViewMatrix, magicZoom, nodeSize, focusedGroup, edgeSize, zoom, glowBlend, darkMode) {
let layer = this.layer;
let gl = layer.scene.context;
let shaderProgram = this.getTriangleShaderProgram();
let buffers = this.buffers.triangles;

gl.uniformMatrix4fv(shaderProgram.projectionMatrixUniform, false, projectionMatrix);
gl.uniformMatrix4fv(shaderProgram.modelViewMatrixUniform, false, modelViewMatrix);
gl.uniform1i(shaderProgram.magicZoom, magicZoom);
gl.uniform1f(shaderProgram.nodeSize, nodeSize);
gl.uniform1f(shaderProgram.edgeSize, edgeSize);
gl.uniform1f(shaderProgram.focusedGroup, focusedGroup);
gl.uniform1f(shaderProgram.zoom, zoom);
gl.uniform1f(shaderProgram.globalAlpha, globalAlpha);
gl.uniform1f(shaderProgram.globalAlpha, 1-glowBlend);
gl.uniform1i(shaderProgram.darkMode, darkMode);

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

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

if (globalAlpha === 1) {
if (glowBlend === 0) {
gl.enable(gl.DEPTH_TEST);
}
else {
gl.enable(gl.BLEND);
gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA);
gl.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA);
}

if (this.buffers.triangles) {
this.drawSceneTriangles(projectionMatrix, modelViewMatrix, magicZoom, nodeSize, focusedGroup, edgeSize, zoom, globalAlpha, darkMode);
this.drawSceneTriangles(projectionMatrix, modelViewMatrix, magicZoom, nodeSize, focusedGroup, edgeSize, zoom, glowBlend, darkMode);
}

if (this.buffers.points) {

if (nodeOutline) {
this.drawScenePointStrokes(projectionMatrix, modelViewMatrix, magicZoom, nodeSize, focusedGroup, hoverNode, zoom, darkMode);
}
this.drawScenePoints(projectionMatrix, modelViewMatrix, magicZoom, nodeSize, focusedGroup, zoom, globalAlpha, darkMode);
this.drawScenePoints(projectionMatrix, modelViewMatrix, magicZoom, nodeSize, focusedGroup, zoom, glowBlend, darkMode);
}


Expand Down
6 changes: 3 additions & 3 deletions engine/dist/ElGrapho.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion engine/src/ElGrapho.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ ElGrapho.prototype = {
this.focusedGroup = -1;
this.tooltips = config.tooltips === undefined ? true : config.tooltips;
this.fillContainer = config.fillContainer === undefined ? false : config.fillContainer;
this.globalAlpha = config.globalAlpha === undefined ? 1 : config.globalAlpha;
this.glowBlend = config.glowBlend === undefined ? 0 : config.glowBlend;
this.nodeOutline = config.nodeOutline === undefined ? true : config.nodeOutline;
this.animations = [];
this.wrapper = document.createElement('div');
Expand Down
7 changes: 2 additions & 5 deletions engine/src/ElGraphoCollection.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,9 @@ let ElGraphoCollection = {
if (graph.dirty) {
idle = false;
let focusedGroup = graph.focusedGroup;
let globalAlpha = graph.globalAlpha;
let glowBlend = graph.glowBlend;

// if (focusedGroup > -1) {
// globalAlpha = 1;
// }
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);
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);

graph.labelsLayer.scene.clear();

Expand Down
Loading

0 comments on commit cbb44c8

Please sign in to comment.