Browse Source

moved the entire network to triple ===. Bugs arise in scaling

flowchartTest
Alex de Mulder 9 years ago
parent
commit
b3580874d1
30 changed files with 29760 additions and 29722 deletions
  1. +29604
    -29566
      dist/vis.js
  2. +1
    -1
      lib/network/Images.js
  3. +3
    -3
      lib/network/Network.js
  4. +30
    -30
      lib/network/dotparser.js
  5. +1
    -1
      lib/network/gephiParser.js
  6. +3
    -3
      lib/network/modules/CanvasRenderer.js
  7. +9
    -9
      lib/network/modules/Clustering.js
  8. +1
    -1
      lib/network/modules/ConfigurationSystem.js
  9. +2
    -2
      lib/network/modules/EdgesHandler.js
  10. +2
    -2
      lib/network/modules/Groups.js
  11. +9
    -9
      lib/network/modules/InteractionHandler.js
  12. +17
    -17
      lib/network/modules/LayoutEngine.js
  13. +7
    -7
      lib/network/modules/ManipulationSystem.js
  14. +1
    -1
      lib/network/modules/NodesHandler.js
  15. +10
    -10
      lib/network/modules/PhysicsEngine.js
  16. +6
    -6
      lib/network/modules/SelectionHandler.js
  17. +4
    -4
      lib/network/modules/View.js
  18. +6
    -6
      lib/network/modules/components/Edge.js
  19. +1
    -1
      lib/network/modules/components/NavigationHandler.js
  20. +5
    -5
      lib/network/modules/components/Node.js
  21. +8
    -8
      lib/network/modules/components/edges/bezierEdgeStatic.js
  22. +2
    -2
      lib/network/modules/components/edges/util/BezierEdgeBase.js
  23. +17
    -17
      lib/network/modules/components/edges/util/EdgeBase.js
  24. +1
    -1
      lib/network/modules/components/physics/CentralGravitySolver.js
  25. +3
    -3
      lib/network/modules/components/physics/HierarchicalRepulsionSolver.js
  26. +1
    -1
      lib/network/modules/components/physics/HierarchicalSpringSolver.js
  27. +2
    -2
      lib/network/modules/components/physics/RepulsionSolver.js
  28. +1
    -1
      lib/network/modules/components/physics/SpringSolver.js
  29. +2
    -2
      lib/network/modules/components/unified/label.js
  30. +1
    -1
      lib/network/shapes.js

+ 29604
- 29566
dist/vis.js
File diff suppressed because it is too large
View File


+ 1
- 1
lib/network/Images.js View File

@ -22,7 +22,7 @@ Images.prototype.load = function(url, brokenUrl) {
img = new Image(); img = new Image();
img.onload = function () { img.onload = function () {
// IE11 fix -- thanks dponch! // IE11 fix -- thanks dponch!
if (this.width == 0) {
if (this.width === 0) {
document.body.appendChild(this); document.body.appendChild(this);
this.width = this.offsetWidth; this.width = this.offsetWidth;
this.height = this.offsetHeight; this.height = this.offsetHeight;

+ 3
- 3
lib/network/Network.js View File

@ -382,7 +382,7 @@ Network.prototype.storePositions = function() {
Network.prototype.getPositions = function(ids) { Network.prototype.getPositions = function(ids) {
var dataArray = {}; var dataArray = {};
if (ids !== undefined) { if (ids !== undefined) {
if (Array.isArray(ids) == true) {
if (Array.isArray(ids) === true) {
for (var i = 0; i < ids.length; i++) { for (var i = 0; i < ids.length; i++) {
if (this.body.nodes[ids[i]] !== undefined) { if (this.body.nodes[ids[i]] !== undefined) {
var node = this.body.nodes[ids[i]]; var node = this.body.nodes[ids[i]];
@ -473,13 +473,13 @@ Network.prototype.getConnectedNodes = function(nodeId) {
var nodeObj = {nodeId : true}; // used to quickly check if node already exists var nodeObj = {nodeId : true}; // used to quickly check if node already exists
for (var i = 0; i < node.edges.length; i++) { for (var i = 0; i < node.edges.length; i++) {
var edge = node.edges[i]; var edge = node.edges[i];
if (edge.toId == nodeId) {
if (edge.toId === nodeId) {
if (nodeObj[edge.fromId] === undefined) { if (nodeObj[edge.fromId] === undefined) {
nodeList.push(edge.fromId); nodeList.push(edge.fromId);
nodeObj[edge.fromId] = true; nodeObj[edge.fromId] = true;
} }
} }
else if (edge.fromId == nodeId) {
else if (edge.fromId === nodeId) {
if (nodeObj[edge.toId] === undefined) { if (nodeObj[edge.toId] === undefined) {
nodeList.push(edge.toId) nodeList.push(edge.toId)
nodeObj[edge.toId] = true; nodeObj[edge.toId] = true;

+ 30
- 30
lib/network/dotparser.js View File

@ -178,7 +178,7 @@ function addNode(graph, node) {
if (!g.nodes) { if (!g.nodes) {
g.nodes = []; g.nodes = [];
} }
if (g.nodes.indexOf(current) == -1) {
if (g.nodes.indexOf(current) === -1) {
g.nodes.push(current); g.nodes.push(current);
} }
} }
@ -238,7 +238,7 @@ function getToken() {
token = ''; token = '';
// skip over whitespaces // skip over whitespaces
while (c == ' ' || c == '\t' || c == '\n' || c == '\r') { // space, tab, enter
while (c === ' ' || c === '\t' || c === '\n' || c === '\r') { // space, tab, enter
next(); next();
} }
@ -246,13 +246,13 @@ function getToken() {
var isComment = false; var isComment = false;
// skip comment // skip comment
if (c == '#') {
if (c === '#') {
// find the previous non-space character // find the previous non-space character
var i = index - 1; var i = index - 1;
while (dot.charAt(i) == ' ' || dot.charAt(i) == '\t') {
while (dot.charAt(i) === ' ' || dot.charAt(i) === '\t') {
i--; i--;
} }
if (dot.charAt(i) == '\n' || dot.charAt(i) == '') {
if (dot.charAt(i) === '\n' || dot.charAt(i) === '') {
// the # is at the start of a line, this is indeed a line comment // the # is at the start of a line, this is indeed a line comment
while (c != '' && c != '\n') { while (c != '' && c != '\n') {
next(); next();
@ -260,17 +260,17 @@ function getToken() {
isComment = true; isComment = true;
} }
} }
if (c == '/' && nextPreview() == '/') {
if (c === '/' && nextPreview() === '/') {
// skip line comment // skip line comment
while (c != '' && c != '\n') { while (c != '' && c != '\n') {
next(); next();
} }
isComment = true; isComment = true;
} }
if (c == '/' && nextPreview() == '*') {
if (c === '/' && nextPreview() === '*') {
// skip block comment // skip block comment
while (c != '') { while (c != '') {
if (c == '*' && nextPreview() == '/') {
if (c === '*' && nextPreview() === '/') {
// end of block comment found. skip these last two characters // end of block comment found. skip these last two characters
next(); next();
next(); next();
@ -284,14 +284,14 @@ function getToken() {
} }
// skip over whitespaces // skip over whitespaces
while (c == ' ' || c == '\t' || c == '\n' || c == '\r') { // space, tab, enter
while (c === ' ' || c === '\t' || c === '\n' || c === '\r') { // space, tab, enter
next(); next();
} }
} }
while (isComment); while (isComment);
// check for end of dot file // check for end of dot file
if (c == '') {
if (c === '') {
// token is still empty // token is still empty
tokenType = TOKENTYPE.DELIMITER; tokenType = TOKENTYPE.DELIMITER;
return; return;
@ -317,7 +317,7 @@ function getToken() {
// check for an identifier (number or string) // check for an identifier (number or string)
// TODO: more precise parsing of numbers/strings (and the port separator ':') // TODO: more precise parsing of numbers/strings (and the port separator ':')
if (isAlphaNumeric(c) || c == '-') {
if (isAlphaNumeric(c) || c === '-') {
token += c; token += c;
next(); next();
@ -325,10 +325,10 @@ function getToken() {
token += c; token += c;
next(); next();
} }
if (token == 'false') {
if (token === 'false') {
token = false; // convert to boolean token = false; // convert to boolean
} }
else if (token == 'true') {
else if (token === 'true') {
token = true; // convert to boolean token = true; // convert to boolean
} }
else if (!isNaN(Number(token))) { else if (!isNaN(Number(token))) {
@ -339,11 +339,11 @@ function getToken() {
} }
// check for a string enclosed by double quotes // check for a string enclosed by double quotes
if (c == '"') {
if (c === '"') {
next(); next();
while (c != '' && (c != '"' || (c == '"' && nextPreview() == '"'))) {
while (c != '' && (c != '"' || (c === '"' && nextPreview() === '"'))) {
token += c; token += c;
if (c == '"') { // skip the escape character
if (c === '"') { // skip the escape character
next(); next();
} }
next(); next();
@ -376,19 +376,19 @@ function parseGraph() {
getToken(); getToken();
// optional strict keyword // optional strict keyword
if (token == 'strict') {
if (token === 'strict') {
graph.strict = true; graph.strict = true;
getToken(); getToken();
} }
// graph or digraph keyword // graph or digraph keyword
if (token == 'graph' || token == 'digraph') {
if (token === 'graph' || token === 'digraph') {
graph.type = token; graph.type = token;
getToken(); getToken();
} }
// optional graph id // optional graph id
if (tokenType == TOKENTYPE.IDENTIFIER) {
if (tokenType === TOKENTYPE.IDENTIFIER) {
graph.id = token; graph.id = token;
getToken(); getToken();
} }
@ -429,7 +429,7 @@ function parseGraph() {
function parseStatements (graph) { function parseStatements (graph) {
while (token !== '' && token != '}') { while (token !== '' && token != '}') {
parseStatement(graph); parseStatement(graph);
if (token == ';') {
if (token === ';') {
getToken(); getToken();
} }
} }
@ -464,7 +464,7 @@ function parseStatement(graph) {
var id = token; // id can be a string or a number var id = token; // id can be a string or a number
getToken(); getToken();
if (token == '=') {
if (token === '=') {
// id statement // id statement
getToken(); getToken();
if (tokenType != TOKENTYPE.IDENTIFIER) { if (tokenType != TOKENTYPE.IDENTIFIER) {
@ -488,20 +488,20 @@ function parseSubgraph (graph) {
var subgraph = null; var subgraph = null;
// optional subgraph keyword // optional subgraph keyword
if (token == 'subgraph') {
if (token === 'subgraph') {
subgraph = {}; subgraph = {};
subgraph.type = 'subgraph'; subgraph.type = 'subgraph';
getToken(); getToken();
// optional graph id // optional graph id
if (tokenType == TOKENTYPE.IDENTIFIER) {
if (tokenType === TOKENTYPE.IDENTIFIER) {
subgraph.id = token; subgraph.id = token;
getToken(); getToken();
} }
} }
// open angle bracket // open angle bracket
if (token == '{') {
if (token === '{') {
getToken(); getToken();
if (!subgraph) { if (!subgraph) {
@ -548,21 +548,21 @@ function parseSubgraph (graph) {
*/ */
function parseAttributeStatement (graph) { function parseAttributeStatement (graph) {
// attribute statements // attribute statements
if (token == 'node') {
if (token === 'node') {
getToken(); getToken();
// node attributes // node attributes
graph.node = parseAttributeList(); graph.node = parseAttributeList();
return 'node'; return 'node';
} }
else if (token == 'edge') {
else if (token === 'edge') {
getToken(); getToken();
// edge attributes // edge attributes
graph.edge = parseAttributeList(); graph.edge = parseAttributeList();
return 'edge'; return 'edge';
} }
else if (token == 'graph') {
else if (token === 'graph') {
getToken(); getToken();
// graph attributes // graph attributes
@ -599,7 +599,7 @@ function parseNodeStatement(graph, id) {
* @param {String | Number} from Id of the from node * @param {String | Number} from Id of the from node
*/ */
function parseEdge(graph, from) { function parseEdge(graph, from) {
while (token == '->' || token == '--') {
while (token === '->' || token === '--') {
var to; var to;
var type = token; var type = token;
getToken(); getToken();
@ -638,7 +638,7 @@ function parseEdge(graph, from) {
function parseAttributeList() { function parseAttributeList() {
var attr = null; var attr = null;
while (token == '[') {
while (token === '[') {
getToken(); getToken();
attr = {}; attr = {};
while (token !== '' && token != ']') { while (token !== '' && token != ']') {
@ -767,7 +767,7 @@ function DOTToGraph (data) {
to: dotEdge.to to: dotEdge.to
}; };
merge(graphEdge, dotEdge.attr); merge(graphEdge, dotEdge.attr);
graphEdge.style = (dotEdge.type == '->') ? 'arrow' : 'line';
graphEdge.style = (dotEdge.type === '->') ? 'arrow' : 'line';
return graphEdge; return graphEdge;
} }

+ 1
- 1
lib/network/gephiParser.js View File

@ -42,7 +42,7 @@ function parseGephi(gephiJSON, options) {
node['x'] = gNode.x; node['x'] = gNode.x;
node['y'] = gNode.y; node['y'] = gNode.y;
node['label'] = gNode.label; node['label'] = gNode.label;
if (this.options.nodes.parseColor == true) {
if (this.options.nodes.parseColor === true) {
node['color'] = gNode.color; node['color'] = gNode.color;
} }
else { else {

+ 3
- 3
lib/network/modules/CanvasRenderer.js View File

@ -50,7 +50,7 @@ class CanvasRenderer {
startRendering() { startRendering() {
if (this.renderingActive === true) { if (this.renderingActive === true) {
if (!this.renderTimer) { if (!this.renderTimer) {
if (this.requiresTimeout == true) {
if (this.requiresTimeout === true) {
this.renderTimer = window.setTimeout(this.renderStep.bind(this), this.simulationInterval); // wait this.renderTimeStep milliseconds and perform the animation step function this.renderTimer = window.setTimeout(this.renderStep.bind(this), this.simulationInterval); // wait this.renderTimeStep milliseconds and perform the animation step function
} }
else { else {
@ -67,14 +67,14 @@ class CanvasRenderer {
// reset the renderTimer so a new scheduled animation step can be set // reset the renderTimer so a new scheduled animation step can be set
this.renderTimer = undefined; this.renderTimer = undefined;
if (this.requiresTimeout == true) {
if (this.requiresTimeout === true) {
// this schedules a new simulation step // this schedules a new simulation step
this.startRendering(); this.startRendering();
} }
this._redraw(); this._redraw();
if (this.requiresTimeout == false) {
if (this.requiresTimeout === false) {
// this schedules a new simulation step // this schedules a new simulation step
this.startRendering(); this.startRendering();
} }

+ 9
- 9
lib/network/modules/Clustering.js View File

@ -30,7 +30,7 @@ class ClusterEngine {
if (hubsize === undefined) { if (hubsize === undefined) {
hubsize = this._getHubSize(); hubsize = this._getHubSize();
} }
else if (tyepof(hubsize) == "object") {
else if (tyepof(hubsize) === "object") {
options = this._checkOptions(hubsize); options = this._checkOptions(hubsize);
hubsize = this._getHubSize(); hubsize = this._getHubSize();
} }
@ -69,7 +69,7 @@ class ClusterEngine {
for (var i = 0; i < this.body.nodeIndices.length; i++) { for (var i = 0; i < this.body.nodeIndices.length; i++) {
var nodeId = this.body.nodeIndices[i]; var nodeId = this.body.nodeIndices[i];
var clonedOptions = this._cloneOptions(nodeId); var clonedOptions = this._cloneOptions(nodeId);
if (options.joinCondition(clonedOptions) == true) {
if (options.joinCondition(clonedOptions) === true) {
childNodesObj[nodeId] = this.body.nodes[nodeId]; childNodesObj[nodeId] = this.body.nodes[nodeId];
} }
} }
@ -92,7 +92,7 @@ class ClusterEngine {
var childNodesObj = {}; var childNodesObj = {};
var childEdgesObj = {}; var childEdgesObj = {};
var nodeId = this.body.nodeIndices[i]; var nodeId = this.body.nodeIndices[i];
if (this.body.nodes[nodeId].edges.length == 1) {
if (this.body.nodes[nodeId].edges.length === 1) {
var edge = this.body.nodes[nodeId].edges[0]; var edge = this.body.nodes[nodeId].edges[0];
var childNodeId = this._getConnectedId(edge, nodeId); var childNodeId = this._getConnectedId(edge, nodeId);
if (childNodeId != nodeId) { if (childNodeId != nodeId) {
@ -102,11 +102,11 @@ class ClusterEngine {
} }
else { else {
var clonedOptions = this._cloneOptions(nodeId); var clonedOptions = this._cloneOptions(nodeId);
if (options.joinCondition(clonedOptions) == true) {
if (options.joinCondition(clonedOptions) === true) {
childNodesObj[nodeId] = this.body.nodes[nodeId]; childNodesObj[nodeId] = this.body.nodes[nodeId];
} }
clonedOptions = this._cloneOptions(childNodeId); clonedOptions = this._cloneOptions(childNodeId);
if (options.joinCondition(clonedOptions) == true) {
if (options.joinCondition(clonedOptions) === true) {
childNodesObj[childNodeId] = this.body.nodes[childNodeId]; childNodesObj[childNodeId] = this.body.nodes[childNodeId];
} }
} }
@ -165,7 +165,7 @@ class ClusterEngine {
else { else {
// clone the options and insert some additional parameters that could be interesting. // clone the options and insert some additional parameters that could be interesting.
var childClonedOptions = this._cloneOptions(childNodeId); var childClonedOptions = this._cloneOptions(childNodeId);
if (options.joinCondition(parentClonedOptions, childClonedOptions) == true) {
if (options.joinCondition(parentClonedOptions, childClonedOptions) === true) {
childEdgesObj[edge.id] = edge; childEdgesObj[edge.id] = edge;
childNodesObj[childNodeId] = this.body.nodes[childNodeId]; childNodesObj[childNodeId] = this.body.nodes[childNodeId];
} }
@ -189,7 +189,7 @@ class ClusterEngine {
*/ */
_cloneOptions(objId, type) { _cloneOptions(objId, type) {
var clonedOptions = {}; var clonedOptions = {};
if (type === undefined || type == 'node') {
if (type === undefined || type === 'node') {
util.deepExtend(clonedOptions, this.body.nodes[objId].options, true); util.deepExtend(clonedOptions, this.body.nodes[objId].options, true);
util.deepExtend(clonedOptions, this.body.nodes[objId].properties, true); util.deepExtend(clonedOptions, this.body.nodes[objId].properties, true);
clonedOptions.amountOfConnections = this.body.nodes[objId].edges.length; clonedOptions.amountOfConnections = this.body.nodes[objId].edges.length;
@ -277,7 +277,7 @@ class ClusterEngine {
*/ */
_cluster(childNodesObj, childEdgesObj, options, refreshData = true) { _cluster(childNodesObj, childEdgesObj, options, refreshData = true) {
// kill condition: no children so cant cluster // kill condition: no children so cant cluster
if (Object.keys(childNodesObj).length == 0) {return;}
if (Object.keys(childNodesObj).length === 0) {return;}
// check if we have an unique id; // check if we have an unique id;
if (options.clusterNodeProperties.id === undefined) {options.clusterNodeProperties.id = 'cluster:' + util.randomUUID();} if (options.clusterNodeProperties.id === undefined) {options.clusterNodeProperties.id = 'cluster:' + util.randomUUID();}
@ -500,7 +500,7 @@ class ClusterEngine {
*/ */
_connectEdge(edge, nodeId, from) { _connectEdge(edge, nodeId, from) {
var clusterStack = this._getClusterStack(nodeId); var clusterStack = this._getClusterStack(nodeId);
if (from == true) {
if (from === true) {
edge.from = clusterStack[clusterStack.length - 1]; edge.from = clusterStack[clusterStack.length - 1];
edge.fromId = clusterStack[clusterStack.length - 1].id; edge.fromId = clusterStack[clusterStack.length - 1].id;
clusterStack.pop() clusterStack.pop()

+ 1
- 1
lib/network/modules/ConfigurationSystem.js View File

@ -443,7 +443,7 @@ class ConfigurationSystem {
for (let i = 0; i < arr.length; i++) { for (let i = 0; i < arr.length; i++) {
let option = document.createElement('option'); let option = document.createElement('option');
option.value = arr[i]; option.value = arr[i];
if (i == selectedValue) {
if (i === selectedValue) {
option.selected = 'selected'; option.selected = 'selected';
} }
option.innerHTML = arr[i]; option.innerHTML = arr[i];

+ 2
- 2
lib/network/modules/EdgesHandler.js View File

@ -74,7 +74,7 @@ class EdgesHandler {
drawThreshold: 3 drawThreshold: 3
}, },
customScalingFunction: function (min,max,total,value) { customScalingFunction: function (min,max,total,value) {
if (max == min) {
if (max === min) {
return 0.5; return 0.5;
} }
else { else {
@ -222,7 +222,7 @@ class EdgesHandler {
this.options.font.face = optionsArray[1]; this.options.font.face = optionsArray[1];
this.options.font.color = optionsArray[2]; this.options.font.color = optionsArray[2];
} }
else if (typeof options.font == 'object') {
else if (typeof options.font === 'object') {
this.options.font = util.bridgeObject(options.font); this.options.font = util.bridgeObject(options.font);
} }
this.options.font.size = Number(this.options.font.size); this.options.font.size = Number(this.options.font.size);

+ 2
- 2
lib/network/modules/Groups.js View File

@ -51,7 +51,7 @@ class Groups {
if (options !== undefined) { if (options !== undefined) {
for (let groupName in options) { for (let groupName in options) {
if (options.hasOwnProperty(groupName)) { if (options.hasOwnProperty(groupName)) {
if (optionFields.indexOf(groupName) == -1) {
if (optionFields.indexOf(groupName) === -1) {
let group = options[groupName]; let group = options[groupName];
this.add(groupName, group); this.add(groupName, group);
} }
@ -77,7 +77,7 @@ class Groups {
*/ */
get(groupname) { get(groupname) {
let group = this.groups[groupname]; let group = this.groups[groupname];
if (group == undefined) {
if (group === undefined) {
if (this.options.useDefaultGroups === false && this.groupsArray.length > 0) { if (this.options.useDefaultGroups === false && this.groupsArray.length > 0) {
// create new group // create new group
let index = this.groupIndex % this.groupsArray.length; let index = this.groupIndex % this.groupsArray.length;

+ 9
- 9
lib/network/modules/InteractionHandler.js View File

@ -124,7 +124,7 @@ class InteractionHandler {
let previouslySelected = this.selectionHandler._getSelectedObjectCount() > 0; let previouslySelected = this.selectionHandler._getSelectedObjectCount() > 0;
let selected = this.selectionHandler.selectOnPoint(pointer); let selected = this.selectionHandler.selectOnPoint(pointer);
if (selected === true || (previouslySelected == true && selected === false)) { // select or unselect
if (selected === true || (previouslySelected === true && selected === false)) { // select or unselect
this.body.emitter.emit('select', this.selectionHandler.getSelection()); this.body.emitter.emit('select', this.selectionHandler.getSelection());
} }
@ -440,7 +440,7 @@ class InteractionHandler {
} }
// if we bind the keyboard to the div, we have to highlight it to use it. This highlights it on mouse over. // if we bind the keyboard to the div, we have to highlight it to use it. This highlights it on mouse over.
if (this.options.keyboard.bindToWindow == false && this.options.keyboard.enabled === true) {
if (this.options.keyboard.bindToWindow === false && this.options.keyboard.enabled === true) {
this.canvas.frame.focus(); this.canvas.frame.focus();
} }
@ -469,7 +469,7 @@ class InteractionHandler {
// adding hover highlights // adding hover highlights
let obj = this.selectionHandler.getNodeAt(pointer); let obj = this.selectionHandler.getNodeAt(pointer);
if (obj == undefined) {
if (obj === undefined) {
obj = this.selectionHandler.getEdgeAt(pointer); obj = this.selectionHandler.getEdgeAt(pointer);
} }
if (obj != undefined) { if (obj != undefined) {
@ -479,7 +479,7 @@ class InteractionHandler {
// removing all node hover highlights except for the selected one. // removing all node hover highlights except for the selected one.
for (let nodeId in this.hoverObj.nodes) { for (let nodeId in this.hoverObj.nodes) {
if (this.hoverObj.nodes.hasOwnProperty(nodeId)) { if (this.hoverObj.nodes.hasOwnProperty(nodeId)) {
if (obj instanceof Node && obj.id != nodeId || obj instanceof Edge || obj == undefined) {
if (obj instanceof Node && obj.id != nodeId || obj instanceof Edge || obj === undefined) {
this.selectionHandler.blurObject(this.hoverObj.nodes[nodeId]); this.selectionHandler.blurObject(this.hoverObj.nodes[nodeId]);
delete this.hoverObj.nodes[nodeId]; delete this.hoverObj.nodes[nodeId];
} }
@ -509,7 +509,7 @@ class InteractionHandler {
bottom: y bottom: y
}; };
let previousPopupObjId = this.popupObj === undefined ? "" : this.popupObj.id;
let previousPopupObjId = this.popupObj === undefined ? undefined : this.popupObj.id;
let nodeUnderCursor = false; let nodeUnderCursor = false;
let popupType = "node"; let popupType = "node";
@ -537,7 +537,7 @@ class InteractionHandler {
} }
} }
if (this.popupObj === undefined && nodeUnderCursor == false) {
if (this.popupObj === undefined && nodeUnderCursor === false) {
// search the edges for overlap // search the edges for overlap
let edgeIndices = this.body.edgeIndices; let edgeIndices = this.body.edgeIndices;
let edges = this.body.edges; let edges = this.body.edges;
@ -560,7 +560,7 @@ class InteractionHandler {
if (this.popupObj !== undefined) { if (this.popupObj !== undefined) {
// show popup message window // show popup message window
if (this.popupObj.id != previousPopupObjId) {
if (this.popupObj.id !== previousPopupObjId) {
if (this.popup === undefined) { if (this.popup === undefined) {
this.popup = new Popup(this.frame, this.options.tooltip); this.popup = new Popup(this.frame, this.options.tooltip);
} }
@ -601,7 +601,7 @@ class InteractionHandler {
}; };
let stillOnObj = false; let stillOnObj = false;
if (this.popup.popupTargetType == 'node') {
if (this.popup.popupTargetType === 'node') {
if (this.body.nodes[this.popup.popupTargetId] !== undefined) { if (this.body.nodes[this.popup.popupTargetId] !== undefined) {
stillOnObj = this.body.nodes[this.popup.popupTargetId].isOverlappingWith(pointerObj); stillOnObj = this.body.nodes[this.popup.popupTargetId].isOverlappingWith(pointerObj);
@ -609,7 +609,7 @@ class InteractionHandler {
// we initially only check stillOnObj because this is much faster. // we initially only check stillOnObj because this is much faster.
if (stillOnObj === true) { if (stillOnObj === true) {
let overNode = this.selectionHandler.getNodeAt(pointer); let overNode = this.selectionHandler.getNodeAt(pointer);
stillOnObj = overNode.id == this.popup.popupTargetId;
stillOnObj = overNode.id === this.popup.popupTargetId;
} }
} }
} }

+ 17
- 17
lib/network/modules/LayoutEngine.js View File

@ -38,7 +38,7 @@ class LayoutEngine {
if (this.options.hierarchical.enabled === true) { if (this.options.hierarchical.enabled === true) {
// make sure the level seperation is the right way up // make sure the level seperation is the right way up
if (this.options.hierarchical.direction == "RL" || this.options.hierarchical.direction == "DU") {
if (this.options.hierarchical.direction === "RL" || this.options.hierarchical.direction === "DU") {
if (this.options.hierarchical.levelSeparation > 0) { if (this.options.hierarchical.levelSeparation > 0) {
this.options.hierarchical.levelSeparation *= -1; this.options.hierarchical.levelSeparation *= -1;
} }
@ -68,7 +68,7 @@ class LayoutEngine {
// get the type of static smooth curve in case it is required // get the type of static smooth curve in case it is required
let type = 'horizontal'; let type = 'horizontal';
if (this.options.hierarchical.direction == "RL" || this.options.hierarchical.direction == "LR") {
if (this.options.hierarchical.direction === "RL" || this.options.hierarchical.direction === "LR") {
type = 'vertical'; type = 'vertical';
} }
@ -102,10 +102,10 @@ class LayoutEngine {
let radius = 10 * 0.1 * nodesArray.length + 10; let radius = 10 * 0.1 * nodesArray.length + 10;
let angle = 2 * Math.PI * this.seededRandom(); let angle = 2 * Math.PI * this.seededRandom();
if (node.options.fixed.x == false) {
if (node.options.fixed.x === false) {
node.x = radius * Math.cos(angle); node.x = radius * Math.cos(angle);
} }
if (node.options.fixed.x == false) {
if (node.options.fixed.x === false) {
node.y = radius * Math.sin(angle); node.y = radius * Math.sin(angle);
} }
} }
@ -124,7 +124,7 @@ class LayoutEngine {
* @private * @private
*/ */
setupHierarchicalLayout() { setupHierarchicalLayout() {
if (this.options.hierarchical.enabled == true && this.body.nodeIndices.length > 0) {
if (this.options.hierarchical.enabled === true && this.body.nodeIndices.length > 0) {
// get the size of the largest hubs and check if the user has defined a level for a node. // get the size of the largest hubs and check if the user has defined a level for a node.
let node, nodeId; let node, nodeId;
let definedLevel = false; let definedLevel = false;
@ -146,7 +146,7 @@ class LayoutEngine {
} }
// if the user defined some levels but not all, alert and run without hierarchical layout // if the user defined some levels but not all, alert and run without hierarchical layout
if (undefinedLevel == true && definedLevel == true) {
if (undefinedLevel === true && definedLevel === true) {
throw new Error("To use the hierarchical layout, nodes require either no predefined levels or levels have to be defined for all nodes."); throw new Error("To use the hierarchical layout, nodes require either no predefined levels or levels have to be defined for all nodes.");
return; return;
} }
@ -155,11 +155,11 @@ class LayoutEngine {
//this._changeConstants(); //this._changeConstants();
// define levels if undefined by the users. Based on hubsize // define levels if undefined by the users. Based on hubsize
if (undefinedLevel == true) {
if (this.options.hierarchical.sortMethod == "hubsize") {
if (undefinedLevel === true) {
if (this.options.hierarchical.sortMethod === "hubsize") {
this._determineLevelsByHubsize(); this._determineLevelsByHubsize();
} }
else if (this.options.hierarchical.sortMethod == "directed" || "direction") {
else if (this.options.hierarchical.sortMethod === "directed" || "direction") {
this._determineLevelsDirected(); this._determineLevelsDirected();
} }
} }
@ -189,7 +189,7 @@ class LayoutEngine {
if (distribution[level].nodes.hasOwnProperty(nodeId)) { if (distribution[level].nodes.hasOwnProperty(nodeId)) {
node = distribution[level].nodes[nodeId]; node = distribution[level].nodes[nodeId];
if (this.options.hierarchical.direction == "UD" || this.options.hierarchical.direction == "DU") {
if (this.options.hierarchical.direction === "UD" || this.options.hierarchical.direction === "DU") {
if (node.x === undefined) {node.x = distribution[level].distance;} if (node.x === undefined) {node.x = distribution[level].distance;}
distribution[level].distance = node.x + this.nodeSpacing; distribution[level].distance = node.x + this.nodeSpacing;
} }
@ -222,7 +222,7 @@ class LayoutEngine {
for (nodeId in this.body.nodes) { for (nodeId in this.body.nodes) {
if (this.body.nodes.hasOwnProperty(nodeId)) { if (this.body.nodes.hasOwnProperty(nodeId)) {
node = this.body.nodes[nodeId]; node = this.body.nodes[nodeId];
if (this.options.hierarchical.direction == "UD" || this.options.hierarchical.direction == "DU") {
if (this.options.hierarchical.direction === "UD" || this.options.hierarchical.direction === "DU") {
node.y = this.options.hierarchical.levelSeparation * this.hierarchicalLevels[nodeId]; node.y = this.options.hierarchical.levelSeparation * this.hierarchicalLevels[nodeId];
node.options.fixed.y = true; node.options.fixed.y = true;
} }
@ -274,13 +274,13 @@ class LayoutEngine {
while (hubSize > 0) { while (hubSize > 0) {
// determine hubs // determine hubs
hubSize = this._getHubSize(); hubSize = this._getHubSize();
if (hubSize == 0)
if (hubSize === 0)
break; break;
for (nodeId in this.body.nodes) { for (nodeId in this.body.nodes) {
if (this.body.nodes.hasOwnProperty(nodeId)) { if (this.body.nodes.hasOwnProperty(nodeId)) {
node = this.body.nodes[nodeId]; node = this.body.nodes[nodeId];
if (node.edges.length == hubSize) {
if (node.edges.length === hubSize) {
this._setLevel(0, node); this._setLevel(0, node);
} }
} }
@ -304,7 +304,7 @@ class LayoutEngine {
let childNode; let childNode;
this.hierarchicalLevels[node.id] = level; this.hierarchicalLevels[node.id] = level;
for (let i = 0; i < node.edges.length; i++) { for (let i = 0; i < node.edges.length; i++) {
if (node.edges[i].toId == node.id) {
if (node.edges[i].toId === node.id) {
childNode = node.edges[i].from; childNode = node.edges[i].from;
} }
else { else {
@ -366,7 +366,7 @@ class LayoutEngine {
this.hierarchicalLevels[node.id] = level; this.hierarchicalLevels[node.id] = level;
for (let i = 0; i < node.edges.length; i++) { for (let i = 0; i < node.edges.length; i++) {
if (node.edges[i].toId == node.id) {
if (node.edges[i].toId === node.id) {
childNode = node.edges[i].from; childNode = node.edges[i].from;
this._setLevelDirected(level - 1, childNode); this._setLevelDirected(level - 1, childNode);
} }
@ -393,7 +393,7 @@ class LayoutEngine {
for (let i = 0; i < edges.length; i++) { for (let i = 0; i < edges.length; i++) {
let childNode = undefined; let childNode = undefined;
let parentNode = undefined; let parentNode = undefined;
if (edges[i].toId == parentId) {
if (edges[i].toId === parentId) {
childNode = edges[i].from; childNode = edges[i].from;
parentNode = edges[i].to; parentNode = edges[i].to;
} }
@ -405,7 +405,7 @@ class LayoutEngine {
if (this.positionedNodes[childNode.id] === undefined) { if (this.positionedNodes[childNode.id] === undefined) {
// if a node is conneceted to another node on the same level (or higher (means lower level))!, this is not handled here. // if a node is conneceted to another node on the same level (or higher (means lower level))!, this is not handled here.
if (childNodeLevel > parentLevel) { if (childNodeLevel > parentLevel) {
if (this.options.hierarchical.direction == "UD" || this.options.hierarchical.direction == "DU") {
if (this.options.hierarchical.direction === "UD" || this.options.hierarchical.direction === "DU") {
if (childNode.x === undefined) { if (childNode.x === undefined) {
childNode.x = Math.max(distribution[childNodeLevel].distance, parentNode.x); childNode.x = Math.max(distribution[childNodeLevel].distance, parentNode.x);
} }

+ 7
- 7
lib/network/modules/ManipulationSystem.js View File

@ -69,7 +69,7 @@ class ManipulationSystem {
*/ */
setOptions(options) { setOptions(options) {
if (options !== undefined) { if (options !== undefined) {
if (typeof options == 'boolean') {
if (typeof options === 'boolean') {
this.options.enabled = options; this.options.enabled = options;
} }
else { else {
@ -207,7 +207,7 @@ class ManipulationSystem {
data.x = node.x; data.x = node.x;
data.y = node.y; data.y = node.y;
if (this.options.handlerFunctions.editNode.length == 2) {
if (this.options.handlerFunctions.editNode.length === 2) {
this.options.handlerFunctions.editNode(data, (finalizedData) => { this.options.handlerFunctions.editNode(data, (finalizedData) => {
this.body.data.nodes.update(finalizedData); this.body.data.nodes.update(finalizedData);
this.showManipulatorToolbar(); this.showManipulatorToolbar();
@ -343,7 +343,7 @@ class ManipulationSystem {
if (typeof deleteFunction === 'function') { if (typeof deleteFunction === 'function') {
let data = {nodes: selectedNodes, edges: selectedEdges}; let data = {nodes: selectedNodes, edges: selectedEdges};
if (deleteFunction.length == 2) {
if (deleteFunction.length === 2) {
deleteFunction(data, (finalizedData) => { deleteFunction(data, (finalizedData) => {
this.body.data.edges.remove(finalizedData.edges); this.body.data.edges.remove(finalizedData.edges);
this.body.data.nodes.remove(finalizedData.nodes); this.body.data.nodes.remove(finalizedData.nodes);
@ -799,7 +799,7 @@ class ManipulationSystem {
} }
else { else {
let from = this.body.nodes[this.temporaryIds.nodes[0]]; let from = this.body.nodes[this.temporaryIds.nodes[0]];
if (this.selectedControlNode.id == from.id) {
if (this.selectedControlNode.id === from.id) {
this._performEditEdge(node.id, edge.to.id); this._performEditEdge(node.id, edge.to.id);
} }
else { else {
@ -943,7 +943,7 @@ class ManipulationSystem {
}; };
if (typeof this.options.handlerFunctions.addNode === 'function') { if (typeof this.options.handlerFunctions.addNode === 'function') {
if (this.options.handlerFunctions.addNode.length == 2) {
if (this.options.handlerFunctions.addNode.length === 2) {
this.options.handlerFunctions.addNode(defaultData, (finalizedData) => { this.options.handlerFunctions.addNode(defaultData, (finalizedData) => {
this.body.data.nodes.add(finalizedData); this.body.data.nodes.add(finalizedData);
this.showManipulatorToolbar(); this.showManipulatorToolbar();
@ -969,7 +969,7 @@ class ManipulationSystem {
_performCreateEdge(sourceNodeId, targetNodeId) { _performCreateEdge(sourceNodeId, targetNodeId) {
let defaultData = {from: sourceNodeId, to: targetNodeId}; let defaultData = {from: sourceNodeId, to: targetNodeId};
if (this.options.handlerFunctions.addEdge) { if (this.options.handlerFunctions.addEdge) {
if (this.options.handlerFunctions.addEdge.length == 2) {
if (this.options.handlerFunctions.addEdge.length === 2) {
this.options.handlerFunctions.addEdge(defaultData, (finalizedData) => { this.options.handlerFunctions.addEdge(defaultData, (finalizedData) => {
this.body.data.edges.add(finalizedData); this.body.data.edges.add(finalizedData);
this.selectionHandler.unselectAll(); this.selectionHandler.unselectAll();
@ -995,7 +995,7 @@ class ManipulationSystem {
_performEditEdge(sourceNodeId, targetNodeId) { _performEditEdge(sourceNodeId, targetNodeId) {
let defaultData = {id: this.edgeBeingEditedId, from: sourceNodeId, to: targetNodeId}; let defaultData = {id: this.edgeBeingEditedId, from: sourceNodeId, to: targetNodeId};
if (this.options.handlerFunctions.editEdge) { if (this.options.handlerFunctions.editEdge) {
if (this.options.handlerFunctions.editEdge.length == 2) {
if (this.options.handlerFunctions.editEdge.length === 2) {
this.options.handlerFunctions.editEdge(defaultData, (finalizedData) => { this.options.handlerFunctions.editEdge(defaultData, (finalizedData) => {
this.body.data.edges.update(finalizedData); this.body.data.edges.update(finalizedData);
this.selectionHandler.unselectAll(); this.selectionHandler.unselectAll();

+ 1
- 1
lib/network/modules/NodesHandler.js View File

@ -78,7 +78,7 @@ class NodesHandler {
drawThreshold: 3 drawThreshold: 3
}, },
customScalingFunction: function (min,max,total,value) { customScalingFunction: function (min,max,total,value) {
if (max == min) {
if (max === min) {
return 0.5; return 0.5;
} }
else { else {

+ 10
- 10
lib/network/modules/PhysicsEngine.js View File

@ -104,12 +104,12 @@ class PhysicsEngine {
init() { init() {
var options; var options;
if (this.options.solver == "repulsion") {
if (this.options.solver === "repulsion") {
options = this.options.repulsion; options = this.options.repulsion;
this.nodesSolver = new Repulsion(this.body, this.physicsBody, options); this.nodesSolver = new Repulsion(this.body, this.physicsBody, options);
this.edgesSolver = new SpringSolver(this.body, this.physicsBody, options); this.edgesSolver = new SpringSolver(this.body, this.physicsBody, options);
} }
else if (this.options.solver == "hierarchicalRepulsion") {
else if (this.options.solver === "hierarchicalRepulsion") {
options = this.options.hierarchicalRepulsion; options = this.options.hierarchicalRepulsion;
this.nodesSolver = new HierarchicalRepulsion(this.body, this.physicsBody, options); this.nodesSolver = new HierarchicalRepulsion(this.body, this.physicsBody, options);
this.edgesSolver = new HierarchicalSpringSolver(this.body, this.physicsBody, options); this.edgesSolver = new HierarchicalSpringSolver(this.body, this.physicsBody, options);
@ -171,7 +171,7 @@ class PhysicsEngine {
var physicsTime = Date.now() - startTime; var physicsTime = Date.now() - startTime;
// run double speed if it is a little graph // run double speed if it is a little graph
if ((physicsTime < 0.4 * this.simulationInterval || this.runDoubleSpeed == true) && this.stabilized === false) {
if ((physicsTime < 0.4 * this.simulationInterval || this.runDoubleSpeed === true) && this.stabilized === false) {
this.physicsTick(); this.physicsTick();
// this makes sure there is no jitter. The decision is taken once to run it at double speed. // this makes sure there is no jitter. The decision is taken once to run it at double speed.
@ -217,7 +217,7 @@ class PhysicsEngine {
} }
else { else {
// this is here to ensure that there is no start event when the network is already stable. // this is here to ensure that there is no start event when the network is already stable.
if (this.startedStabilization == false) {
if (this.startedStabilization === false) {
this.body.emitter.emit("startStabilizing"); this.body.emitter.emit("startStabilizing");
this.startedStabilization = true; this.startedStabilization = true;
} }
@ -317,7 +317,7 @@ class PhysicsEngine {
} }
if (nodesPresent == true) {
if (nodesPresent === true) {
if (vminCorrected > 0.5*this.options.maxVelocity) { if (vminCorrected > 0.5*this.options.maxVelocity) {
return false; return false;
} }
@ -415,7 +415,7 @@ class PhysicsEngine {
* @private * @private
*/ */
stabilize() { stabilize() {
if (this.options.stabilization.onlyDynamicEdges == true) {
if (this.options.stabilization.onlyDynamicEdges === true) {
this._freezeNodes(); this._freezeNodes();
} }
this.stabilizationSteps = 0; this.stabilizationSteps = 0;
@ -425,13 +425,13 @@ class PhysicsEngine {
_stabilizationBatch() { _stabilizationBatch() {
var count = 0; var count = 0;
while (this.stabilized == false && count < this.options.stabilization.updateInterval && this.stabilizationSteps < this.options.stabilization.iterations) {
while (this.stabilized === false && count < this.options.stabilization.updateInterval && this.stabilizationSteps < this.options.stabilization.iterations) {
this.physicsTick(); this.physicsTick();
this.stabilizationSteps++; this.stabilizationSteps++;
count++; count++;
} }
if (this.stabilized == false && this.stabilizationSteps < this.options.stabilization.iterations) {
if (this.stabilized === false && this.stabilizationSteps < this.options.stabilization.iterations) {
this.body.emitter.emit("stabilizationProgress", {steps: this.stabilizationSteps, total: this.options.stabilization.iterations}); this.body.emitter.emit("stabilizationProgress", {steps: this.stabilizationSteps, total: this.options.stabilization.iterations});
setTimeout(this._stabilizationBatch.bind(this),0); setTimeout(this._stabilizationBatch.bind(this),0);
} }
@ -441,11 +441,11 @@ class PhysicsEngine {
} }
_finalizeStabilization() { _finalizeStabilization() {
if (this.options.stabilization.zoomExtent == true) {
if (this.options.stabilization.zoomExtent === true) {
this.body.emitter.emit("zoomExtent", {duration:0}); this.body.emitter.emit("zoomExtent", {duration:0});
} }
if (this.options.stabilization.onlyDynamicEdges == true) {
if (this.options.stabilization.onlyDynamicEdges === true) {
this._restoreFrozenNodes(); this._restoreFrozenNodes();
} }

+ 6
- 6
lib/network/modules/SelectionHandler.js View File

@ -460,7 +460,7 @@ class SelectionHandler {
* @private * @private
*/ */
blurObject(object) { blurObject(object) {
if (object.hover == true) {
if (object.hover === true) {
object.hover = false; object.hover = false;
this.body.emitter.emit("blurNode",{node:object.id}); this.body.emitter.emit("blurNode",{node:object.id});
} }
@ -474,7 +474,7 @@ class SelectionHandler {
* @private * @private
*/ */
hoverObject(object) { hoverObject(object) {
if (object.hover == false) {
if (object.hover === false) {
object.hover = true; object.hover = true;
this._addToHover(object); this._addToHover(object);
if (object instanceof Node) { if (object instanceof Node) {
@ -508,7 +508,7 @@ class SelectionHandler {
*/ */
getSelectedNodes() { getSelectedNodes() {
var idArray = []; var idArray = [];
if (this.options.select == true) {
if (this.options.select === true) {
for (var nodeId in this.selectionObj.nodes) { for (var nodeId in this.selectionObj.nodes) {
if (this.selectionObj.nodes.hasOwnProperty(nodeId)) { if (this.selectionObj.nodes.hasOwnProperty(nodeId)) {
idArray.push(nodeId); idArray.push(nodeId);
@ -526,7 +526,7 @@ class SelectionHandler {
*/ */
getSelectedEdges() { getSelectedEdges() {
var idArray = []; var idArray = [];
if (this.options.select == true) {
if (this.options.select === true) {
for (var edgeId in this.selectionObj.edges) { for (var edgeId in this.selectionObj.edges) {
if (this.selectionObj.edges.hasOwnProperty(edgeId)) { if (this.selectionObj.edges.hasOwnProperty(edgeId)) {
idArray.push(edgeId); idArray.push(edgeId);
@ -546,7 +546,7 @@ class SelectionHandler {
selectNodes(selection, highlightEdges) { selectNodes(selection, highlightEdges) {
var i, iMax, id; var i, iMax, id;
if (!selection || (selection.length == undefined))
if (!selection || (selection.length === undefined))
throw 'Selection must be an array with ids'; throw 'Selection must be an array with ids';
// first unselect any selected node // first unselect any selected node
@ -573,7 +573,7 @@ class SelectionHandler {
selectEdges(selection) { selectEdges(selection) {
var i, iMax, id; var i, iMax, id;
if (!selection || (selection.length == undefined))
if (!selection || (selection.length === undefined))
throw 'Selection must be an array with ids'; throw 'Selection must be an array with ids';
// first unselect any selected node // first unselect any selected node

+ 4
- 4
lib/network/modules/View.js View File

@ -77,7 +77,7 @@ class View {
} }
} }
if (minX == 1e9 && maxX == -1e9 && minY == 1e9 && maxY == -1e9) {
if (minX === 1e9 && maxX === -1e9 && minY === 1e9 && maxY === -1e9) {
minY = 0, maxY = 0, minX = 0, maxX = 0; minY = 0, maxY = 0, minX = 0, maxX = 0;
} }
return {minX: minX, maxX: maxX, minY: minY, maxY: maxY}; return {minX: minX, maxX: maxX, minY: minY, maxY: maxY};
@ -111,7 +111,7 @@ class View {
for (var nodeId in this.body.nodes) { for (var nodeId in this.body.nodes) {
if (this.body.nodes.hasOwnProperty(nodeId)) { if (this.body.nodes.hasOwnProperty(nodeId)) {
var node = this.body.nodes[nodeId]; var node = this.body.nodes[nodeId];
if (node.predefinedPosition == true) {
if (node.predefinedPosition === true) {
positionDefined += 1; positionDefined += 1;
} }
} }
@ -219,7 +219,7 @@ class View {
this.animationEasingFunction = options.animation.easingFunction; this.animationEasingFunction = options.animation.easingFunction;
// release if something focussed on the node // release if something focussed on the node
this.releaseNode(); this.releaseNode();
if (options.locked == true) {
if (options.locked === true) {
this.lockedOnNodeId = options.lockedOnNode; this.lockedOnNodeId = options.lockedOnNode;
this.lockedOnNodeOffset = options.offset; this.lockedOnNodeOffset = options.offset;
} }
@ -247,7 +247,7 @@ class View {
}; };
// if the time is set to 0, don't do an animation // if the time is set to 0, don't do an animation
if (options.animation.duration == 0) {
if (options.animation.duration === 0) {
if (this.lockedOnNodeId != undefined) { if (this.lockedOnNodeId != undefined) {
this.viewFunction = this._lockedRedraw.bind(this); this.viewFunction = this._lockedRedraw.bind(this);
this.body.emitter.on("initRedraw", this.viewFunction); this.body.emitter.on("initRedraw", this.viewFunction);

+ 6
- 6
lib/network/modules/components/Edge.js View File

@ -157,11 +157,11 @@ class Edge {
let dataChanged = false; let dataChanged = false;
let changeInType = true; let changeInType = true;
if (this.edgeType !== undefined) { if (this.edgeType !== undefined) {
if (this.edgeType instanceof BezierEdgeDynamic && this.options.smooth.enabled == true && this.options.smooth.dynamic == true) {changeInType = false;}
if (this.edgeType instanceof BezierEdgeStatic && this.options.smooth.enabled == true && this.options.smooth.dynamic == false){changeInType = false;}
if (this.edgeType instanceof StraightEdge && this.options.smooth.enabled == false) {changeInType = false;}
if (this.edgeType instanceof BezierEdgeDynamic && this.options.smooth.enabled === true && this.options.smooth.dynamic === true) {changeInType = false;}
if (this.edgeType instanceof BezierEdgeStatic && this.options.smooth.enabled === true && this.options.smooth.dynamic === false){changeInType = false;}
if (this.edgeType instanceof StraightEdge && this.options.smooth.enabled === false) {changeInType = false;}
if (changeInType == true) {
if (changeInType === true) {
dataChanged = this.edgeType.cleanup(); dataChanged = this.edgeType.cleanup();
} }
} }
@ -194,7 +194,7 @@ class Edge {
* @param status * @param status
*/ */
togglePhysics(status) { togglePhysics(status) {
if (this.options.smooth.enabled == true && this.options.smooth.dynamic == true) {
if (this.options.smooth.enabled === true && this.options.smooth.dynamic === true) {
if (this.via === undefined) { if (this.via === undefined) {
this.via.pptions.physics = status; this.via.pptions.physics = status;
} }
@ -284,7 +284,7 @@ class Edge {
if (this.value !== undefined) { if (this.value !== undefined) {
var scale = this.options.scaling.customScalingFunction(min, max, total, this.value); var scale = this.options.scaling.customScalingFunction(min, max, total, this.value);
var widthDiff = this.options.scaling.max - this.options.scaling.min; var widthDiff = this.options.scaling.max - this.options.scaling.min;
if (this.options.scaling.label.enabled == true) {
if (this.options.scaling.label.enabled === true) {
var fontDiff = this.options.scaling.label.max - this.options.scaling.label.min; var fontDiff = this.options.scaling.label.max - this.options.scaling.label.min;
this.options.font.size = this.options.scaling.label.min + scale * fontDiff; this.options.font.size = this.options.scaling.label.min + scale * fontDiff;
} }

+ 1
- 1
lib/network/modules/components/NavigationHandler.js View File

@ -86,7 +86,7 @@ class NavigationHandler {
this.navigationDOM['wrapper'].appendChild(this.navigationDOM[navigationDivs[i]]); this.navigationDOM['wrapper'].appendChild(this.navigationDOM[navigationDivs[i]]);
var hammer = new Hammer(this.navigationDOM[navigationDivs[i]]); var hammer = new Hammer(this.navigationDOM[navigationDivs[i]]);
if (navigationDivActions[i] == "_zoomExtent") {
if (navigationDivActions[i] === "_zoomExtent") {
hammerUtil.onTouch(hammer, this._zoomExtent.bind(this)); hammerUtil.onTouch(hammer, this._zoomExtent.bind(this));
} }
else { else {

+ 5
- 5
lib/network/modules/components/Node.js View File

@ -71,7 +71,7 @@ class Node {
* @param {Edge} edge * @param {Edge} edge
*/ */
attachEdge(edge) { attachEdge(edge) {
if (this.edges.indexOf(edge) == -1) {
if (this.edges.indexOf(edge) === -1) {
this.edges.push(edge); this.edges.push(edge);
} }
} }
@ -162,15 +162,15 @@ class Node {
} }
if (options.fixed !== undefined) { if (options.fixed !== undefined) {
if (typeof options.fixed == 'boolean') {
if (typeof options.fixed === 'boolean') {
this.options.fixed.x = true; this.options.fixed.x = true;
this.options.fixed.y = true; this.options.fixed.y = true;
} }
else { else {
if (options.fixed.x !== undefined && typeof options.fixed.x == 'boolean') {
if (options.fixed.x !== undefined && typeof options.fixed.x === 'boolean') {
this.options.fixed.x = options.fixed.x; this.options.fixed.x = options.fixed.x;
} }
if (options.fixed.y !== undefined && typeof options.fixed.y == 'boolean') {
if (options.fixed.y !== undefined && typeof options.fixed.y === 'boolean') {
this.options.fixed.y = options.fixed.y; this.options.fixed.y = options.fixed.y;
} }
} }
@ -328,7 +328,7 @@ class Node {
if (this.value !== undefined) { if (this.value !== undefined) {
var scale = this.options.scaling.customScalingFunction(min, max, total, this.value); var scale = this.options.scaling.customScalingFunction(min, max, total, this.value);
var sizeDiff = this.options.scaling.max - this.options.scaling.min; var sizeDiff = this.options.scaling.max - this.options.scaling.min;
if (this.options.scaling.label.enabled == true) {
if (this.options.scaling.label.enabled === true) {
var fontDiff = this.options.scaling.label.max - this.options.scaling.label.min; var fontDiff = this.options.scaling.label.max - this.options.scaling.label.min;
this.options.font.size = this.options.scaling.label.min + scale * fontDiff; this.options.font.size = this.options.scaling.label.min + scale * fontDiff;
} }

+ 8
- 8
lib/network/modules/components/edges/bezierEdgeStatic.js View File

@ -43,7 +43,7 @@ class BezierEdgeStatic extends BezierEdgeBase {
let type = this.options.smooth.type; let type = this.options.smooth.type;
let dx = Math.abs(this.from.x - this.to.x); let dx = Math.abs(this.from.x - this.to.x);
let dy = Math.abs(this.from.y - this.to.y); let dy = Math.abs(this.from.y - this.to.y);
if (type == 'discrete' || type == 'diagonalCross') {
if (type === 'discrete' || type === 'diagonalCross') {
if (Math.abs(this.from.x - this.to.x) < Math.abs(this.from.y - this.to.y)) { if (Math.abs(this.from.x - this.to.x) < Math.abs(this.from.y - this.to.y)) {
if (this.from.y > this.to.y) { if (this.from.y > this.to.y) {
if (this.from.x < this.to.x) { if (this.from.x < this.to.x) {
@ -65,7 +65,7 @@ class BezierEdgeStatic extends BezierEdgeBase {
yVia = this.from.y + factor * dy; yVia = this.from.y + factor * dy;
} }
} }
if (type == "discrete") {
if (type === "discrete") {
xVia = dx < factor * dy ? this.from.x : xVia; xVia = dx < factor * dy ? this.from.x : xVia;
} }
} }
@ -90,12 +90,12 @@ class BezierEdgeStatic extends BezierEdgeBase {
yVia = this.from.y + factor * dx; yVia = this.from.y + factor * dx;
} }
} }
if (type == "discrete") {
if (type === "discrete") {
yVia = dy < factor * dx ? this.from.y : yVia; yVia = dy < factor * dx ? this.from.y : yVia;
} }
} }
} }
else if (type == "straightCross") {
else if (type === "straightCross") {
if (Math.abs(this.from.x - this.to.x) < Math.abs(this.from.y - this.to.y)) { // up - down if (Math.abs(this.from.x - this.to.x) < Math.abs(this.from.y - this.to.y)) { // up - down
xVia = this.from.x; xVia = this.from.x;
if (this.from.y < this.to.y) { if (this.from.y < this.to.y) {
@ -115,7 +115,7 @@ class BezierEdgeStatic extends BezierEdgeBase {
yVia = this.from.y; yVia = this.from.y;
} }
} }
else if (type == 'horizontal') {
else if (type === 'horizontal') {
if (this.from.x < this.to.x) { if (this.from.x < this.to.x) {
xVia = this.to.x - (1 - factor) * dx; xVia = this.to.x - (1 - factor) * dx;
} }
@ -124,7 +124,7 @@ class BezierEdgeStatic extends BezierEdgeBase {
} }
yVia = this.from.y; yVia = this.from.y;
} }
else if (type == 'vertical') {
else if (type === 'vertical') {
xVia = this.from.x; xVia = this.from.x;
if (this.from.y < this.to.y) { if (this.from.y < this.to.y) {
yVia = this.to.y - (1 - factor) * dy; yVia = this.to.y - (1 - factor) * dy;
@ -133,7 +133,7 @@ class BezierEdgeStatic extends BezierEdgeBase {
yVia = this.to.y + (1 - factor) * dy; yVia = this.to.y + (1 - factor) * dy;
} }
} }
else if (type == 'curvedCW') {
else if (type === 'curvedCW') {
dx = this.to.x - this.from.x; dx = this.to.x - this.from.x;
dy = this.from.y - this.to.y; dy = this.from.y - this.to.y;
let radius = Math.sqrt(dx * dx + dy * dy); let radius = Math.sqrt(dx * dx + dy * dy);
@ -145,7 +145,7 @@ class BezierEdgeStatic extends BezierEdgeBase {
xVia = this.from.x + (factor * 0.5 + 0.5) * radius * Math.sin(myAngle); xVia = this.from.x + (factor * 0.5 + 0.5) * radius * Math.sin(myAngle);
yVia = this.from.y + (factor * 0.5 + 0.5) * radius * Math.cos(myAngle); yVia = this.from.y + (factor * 0.5 + 0.5) * radius * Math.cos(myAngle);
} }
else if (type == 'curvedCCW') {
else if (type === 'curvedCCW') {
dx = this.to.x - this.from.x; dx = this.to.x - this.from.x;
dy = this.from.y - this.to.y; dy = this.from.y - this.to.y;
let radius = Math.sqrt(dx * dx + dy * dy); let radius = Math.sqrt(dx * dx + dy * dy);

+ 2
- 2
lib/network/modules/components/edges/util/BezierEdgeBase.js View File

@ -48,7 +48,7 @@ class BezierEdgeBase extends EdgeBase {
break; // found break; // found
} }
else if (difference < 0) { // distance to nodes is larger than distance to border --> t needs to be bigger if we're looking at the to node. else if (difference < 0) { // distance to nodes is larger than distance to border --> t needs to be bigger if we're looking at the to node.
if (from == false) {
if (from === false) {
low = middle; low = middle;
} }
else { else {
@ -56,7 +56,7 @@ class BezierEdgeBase extends EdgeBase {
} }
} }
else { else {
if (from == false) {
if (from === false) {
high = middle; high = middle;
} }
else { else {

+ 17
- 17
lib/network/modules/components/edges/util/EdgeBase.js View File

@ -33,7 +33,7 @@ class EdgeBase {
let via = undefined; let via = undefined;
if (this.from != this.to) { if (this.from != this.to) {
// draw line // draw line
if (this.options.dashes.enabled == true) {
if (this.options.dashes.enabled === true) {
via = this._drawDashedLine(ctx); via = this._drawDashedLine(ctx);
} }
else { else {
@ -229,11 +229,11 @@ class EdgeBase {
* @private * @private
*/ */
getLineWidth(selected, hover) { getLineWidth(selected, hover) {
if (selected == true) {
if (selected === true) {
return Math.max(Math.min(this.options.widthSelectionMultiplier * this.options.width, this.options.scaling.max), 0.3 / this.body.view.scale); return Math.max(Math.min(this.options.widthSelectionMultiplier * this.options.width, this.options.scaling.max), 0.3 / this.body.view.scale);
} }
else { else {
if (hover == true) {
if (hover === true) {
return Math.max(Math.min(this.options.hoverWidth, this.options.scaling.max), 0.3 / this.body.view.scale); return Math.max(Math.min(this.options.hoverWidth, this.options.scaling.max), 0.3 / this.body.view.scale);
} }
else { else {
@ -247,20 +247,20 @@ class EdgeBase {
let colorOptions = this.options.color; let colorOptions = this.options.color;
if (colorOptions.inherit.enabled === true) { if (colorOptions.inherit.enabled === true) {
if (colorOptions.inherit.useGradients == true) {
if (colorOptions.inherit.useGradients === true) {
let grd = ctx.createLinearGradient(this.from.x, this.from.y, this.to.x, this.to.y); let grd = ctx.createLinearGradient(this.from.x, this.from.y, this.to.x, this.to.y);
let fromColor, toColor; let fromColor, toColor;
fromColor = this.from.options.color.highlight.border; fromColor = this.from.options.color.highlight.border;
toColor = this.to.options.color.highlight.border; toColor = this.to.options.color.highlight.border;
if (this.from.selected == false && this.to.selected == false) {
if (this.from.selected === false && this.to.selected === false) {
fromColor = util.overrideOpacity(this.from.options.color.border, this.options.color.opacity); fromColor = util.overrideOpacity(this.from.options.color.border, this.options.color.opacity);
toColor = util.overrideOpacity(this.to.options.color.border, this.options.color.opacity); toColor = util.overrideOpacity(this.to.options.color.border, this.options.color.opacity);
} }
else if (this.from.selected == true && this.to.selected == false) {
else if (this.from.selected === true && this.to.selected === false) {
toColor = this.to.options.color.border; toColor = this.to.options.color.border;
} }
else if (this.from.selected == false && this.to.selected == true) {
else if (this.from.selected === false && this.to.selected === true) {
fromColor = this.from.options.color.border; fromColor = this.from.options.color.border;
} }
grd.addColorStop(0, fromColor); grd.addColorStop(0, fromColor);
@ -271,12 +271,12 @@ class EdgeBase {
} }
if (this.colorDirty === true) { if (this.colorDirty === true) {
if (colorOptions.inherit.source == "to") {
if (colorOptions.inherit.source === "to") {
this.color.highlight = this.to.options.color.highlight.border; this.color.highlight = this.to.options.color.highlight.border;
this.color.hover = this.to.options.color.hover.border; this.color.hover = this.to.options.color.hover.border;
this.color.color = util.overrideOpacity(this.to.options.color.border, colorOptions.opacity); this.color.color = util.overrideOpacity(this.to.options.color.border, colorOptions.opacity);
} }
else { // (this.options.color.inherit.source == "from") {
else { // (this.options.color.inherit.source === "from") {
this.color.highlight = this.from.options.color.highlight.border; this.color.highlight = this.from.options.color.highlight.border;
this.color.hover = this.from.options.color.hover.border; this.color.hover = this.from.options.color.hover.border;
this.color.color = util.overrideOpacity(this.from.options.color.border, colorOptions.opacity); this.color.color = util.overrideOpacity(this.from.options.color.border, colorOptions.opacity);
@ -293,10 +293,10 @@ class EdgeBase {
this.colorDirty = false; this.colorDirty = false;
if (this.selected == true) {
if (this.selected === true) {
return this.color.highlight; return this.color.highlight;
} }
else if (this.hover == true) {
else if (this.hover === true) {
return this.color.hover; return this.color.hover;
} }
else { else {
@ -403,13 +403,13 @@ class EdgeBase {
let guideOffset; let guideOffset;
let scaleFactor; let scaleFactor;
if (position == 'from') {
if (position === 'from') {
node1 = this.from; node1 = this.from;
node2 = this.to; node2 = this.to;
guideOffset = 0.1; guideOffset = 0.1;
scaleFactor = this.options.arrows.from.scaleFactor; scaleFactor = this.options.arrows.from.scaleFactor;
} }
else if (position == 'to') {
else if (position === 'to') {
node1 = this.to; node1 = this.to;
node2 = this.from; node2 = this.from;
guideOffset = -0.1; guideOffset = -0.1;
@ -425,7 +425,7 @@ class EdgeBase {
if (node1 != node2) { if (node1 != node2) {
if (position !== 'middle') { if (position !== 'middle') {
// draw arrow head // draw arrow head
if (this.options.smooth.enabled == true) {
if (this.options.smooth.enabled === true) {
arrowPos = this.findBorderPosition(node1, ctx, {via: viaNode}); arrowPos = this.findBorderPosition(node1, ctx, {via: viaNode});
let guidePos = this.getPoint(Math.max(0.0, Math.min(1.0, arrowPos.t + guideOffset)), viaNode); let guidePos = this.getPoint(Math.max(0.0, Math.min(1.0, arrowPos.t + guideOffset)), viaNode);
angle = Math.atan2((arrowPos.y - guidePos.y), (arrowPos.x - guidePos.x)); angle = Math.atan2((arrowPos.y - guidePos.y), (arrowPos.x - guidePos.x));
@ -450,17 +450,17 @@ class EdgeBase {
let angle, point; let angle, point;
let [x,y,radius] = this._getCircleData(ctx); let [x,y,radius] = this._getCircleData(ctx);
if (position == 'from') {
if (position === 'from') {
point = this.findBorderPosition(this.from, ctx, {x, y, low:0.25, high:0.6, direction:-1}); point = this.findBorderPosition(this.from, ctx, {x, y, low:0.25, high:0.6, direction:-1});
angle = point.t * -2 * Math.PI + 1.5 * Math.PI + 0.1 * Math.PI; angle = point.t * -2 * Math.PI + 1.5 * Math.PI + 0.1 * Math.PI;
} }
else if (position == 'to') {
else if (position === 'to') {
point = this.findBorderPosition(this.from, ctx, {x, y, low:0.6, high:1.0, direction:1}); point = this.findBorderPosition(this.from, ctx, {x, y, low:0.6, high:1.0, direction:1});
angle = point.t * -2 * Math.PI + 1.5 * Math.PI - 1.1 * Math.PI; angle = point.t * -2 * Math.PI + 1.5 * Math.PI - 1.1 * Math.PI;
} }
else { else {
point = this._pointOnCircle(x, y, radius, 0.175); point = this._pointOnCircle(x, y, radius, 0.175);
angle = 3.9269908169872414; // == 0.175 * -2 * Math.PI + 1.5 * Math.PI + 0.1 * Math.PI;
angle = 3.9269908169872414; // === 0.175 * -2 * Math.PI + 1.5 * Math.PI + 0.1 * Math.PI;
} }
// draw the arrowhead // draw the arrowhead

+ 1
- 1
lib/network/modules/components/physics/CentralGravitySolver.js View File

@ -30,7 +30,7 @@ class CentralGravitySolver {
dy = -node.y; dy = -node.y;
distance = Math.sqrt(dx * dx + dy * dy); distance = Math.sqrt(dx * dx + dy * dy);
gravityForce = (distance == 0) ? 0 : (gravity / distance);
gravityForce = (distance === 0) ? 0 : (gravity / distance);
forces[nodeId].x = dx * gravityForce; forces[nodeId].x = dx * gravityForce;
forces[nodeId].y = dy * gravityForce; forces[nodeId].y = dy * gravityForce;
} }

+ 3
- 3
lib/network/modules/components/physics/HierarchicalRepulsionSolver.js View File

@ -30,14 +30,14 @@ class HierarchicalRepulsionSolver {
var nodeDistance = this.options.nodeDistance; var nodeDistance = this.options.nodeDistance;
// we loop from i over all but the last entree in the array // we loop from i over all but the last entree in the array
// j loops from i+1 to the last. This way we do not double count any of the indices, nor i == j
// j loops from i+1 to the last. This way we do not double count any of the indices, nor i === j
for (i = 0; i < nodeIndices.length - 1; i++) { for (i = 0; i < nodeIndices.length - 1; i++) {
node1 = nodes[nodeIndices[i]]; node1 = nodes[nodeIndices[i]];
for (j = i + 1; j < nodeIndices.length; j++) { for (j = i + 1; j < nodeIndices.length; j++) {
node2 = nodes[nodeIndices[j]]; node2 = nodes[nodeIndices[j]];
// nodes only affect nodes on their level // nodes only affect nodes on their level
if (node1.level == node2.level) {
if (node1.level === node2.level) {
dx = node2.x - node1.x; dx = node2.x - node1.x;
dy = node2.y - node1.y; dy = node2.y - node1.y;
distance = Math.sqrt(dx * dx + dy * dy); distance = Math.sqrt(dx * dx + dy * dy);
@ -50,7 +50,7 @@ class HierarchicalRepulsionSolver {
repulsingForce = 0; repulsingForce = 0;
} }
// normalize force with // normalize force with
if (distance == 0) {
if (distance === 0) {
distance = 0.01; distance = 0.01;
} }
else { else {

+ 1
- 1
lib/network/modules/components/physics/HierarchicalSpringSolver.js View File

@ -45,7 +45,7 @@ class HierarchicalSpringSolver {
dx = (edge.from.x - edge.to.x); dx = (edge.from.x - edge.to.x);
dy = (edge.from.y - edge.to.y); dy = (edge.from.y - edge.to.y);
distance = Math.sqrt(dx * dx + dy * dy); distance = Math.sqrt(dx * dx + dy * dy);
distance = distance == 0 ? 0.01 : distance;
distance = distance === 0 ? 0.01 : distance;
// the 1/distance is so the fx and fy can be calculated without sine or cosine. // the 1/distance is so the fx and fy can be calculated without sine or cosine.
springForce = this.options.springConstant * (edgeLength - distance) / distance; springForce = this.options.springConstant * (edgeLength - distance) / distance;

+ 2
- 2
lib/network/modules/components/physics/RepulsionSolver.js View File

@ -33,7 +33,7 @@ class RepulsionSolver {
var b = 4 / 3; var b = 4 / 3;
// we loop from i over all but the last entree in the array // we loop from i over all but the last entree in the array
// j loops from i+1 to the last. This way we do not double count any of the indices, nor i == j
// j loops from i+1 to the last. This way we do not double count any of the indices, nor i === j
for (let i = 0; i < nodeIndices.length - 1; i++) { for (let i = 0; i < nodeIndices.length - 1; i++) {
node1 = nodes[nodeIndices[i]]; node1 = nodes[nodeIndices[i]];
for (let j = i + 1; j < nodeIndices.length; j++) { for (let j = i + 1; j < nodeIndices.length; j++) {
@ -44,7 +44,7 @@ class RepulsionSolver {
distance = Math.sqrt(dx * dx + dy * dy); distance = Math.sqrt(dx * dx + dy * dy);
// same condition as BarnesHutSolver, making sure nodes are never 100% overlapping. // same condition as BarnesHutSolver, making sure nodes are never 100% overlapping.
if (distance == 0) {
if (distance === 0) {
distance = 0.1*Math.random(); distance = 0.1*Math.random();
dx = distance; dx = distance;
} }

+ 1
- 1
lib/network/modules/components/physics/SpringSolver.js View File

@ -65,7 +65,7 @@ class SpringSolver {
dx = (node1.x - node2.x); dx = (node1.x - node2.x);
dy = (node1.y - node2.y); dy = (node1.y - node2.y);
distance = Math.sqrt(dx * dx + dy * dy); distance = Math.sqrt(dx * dx + dy * dy);
distance = distance == 0 ? 0.01 : distance;
distance = distance === 0 ? 0.01 : distance;
// the 1/distance is so the fx and fy can be calculated without sine or cosine. // the 1/distance is so the fx and fy can be calculated without sine or cosine.
springForce = this.options.springConstant * (edgeLength - distance) / distance; springForce = this.options.springConstant * (edgeLength - distance) / distance;

+ 2
- 2
lib/network/modules/components/unified/label.js View File

@ -36,7 +36,7 @@ class Label {
this.fontOptions.face = optionsArray[1]; this.fontOptions.face = optionsArray[1];
this.fontOptions.color = optionsArray[2]; this.fontOptions.color = optionsArray[2];
} }
else if (typeof options.font == 'object') {
else if (typeof options.font === 'object') {
this.fontOptions = util.bridgeObject(options.font); this.fontOptions = util.bridgeObject(options.font);
} }
this.fontOptions.size = Number(this.fontOptions.size); this.fontOptions.size = Number(this.fontOptions.size);
@ -219,7 +219,7 @@ class Label {
this.size.left = x - this.size.width * 0.5; this.size.left = x - this.size.width * 0.5;
this.size.top = y - this.size.height * 0.5; this.size.top = y - this.size.height * 0.5;
this.size.yLine = y + (1 - this.lineCount) * 0.5 * this.fontOptions.size; this.size.yLine = y + (1 - this.lineCount) * 0.5 * this.fontOptions.size;
if (baseline == "hanging") {
if (baseline === "hanging") {
this.size.top += 0.5 * this.fontOptions.size; this.size.top += 0.5 * this.fontOptions.size;
this.size.top += 4; // distance from node, required because we use hanging. Hanging has less difference between browsers this.size.top += 4; // distance from node, required because we use hanging. Hanging has less difference between browsers
this.size.yLine += 4; // distance from node this.size.yLine += 4; // distance from node

+ 1
- 1
lib/network/shapes.js View File

@ -238,7 +238,7 @@ if (typeof CanvasRenderingContext2D !== 'undefined') {
*/ */
CanvasRenderingContext2D.prototype.dashedLine = function (x, y, x2, y2, dashArray) { CanvasRenderingContext2D.prototype.dashedLine = function (x, y, x2, y2, dashArray) {
if (!dashArray) dashArray = [10, 5]; if (!dashArray) dashArray = [10, 5];
if (dashLength == 0) dashLength = 0.001; // Hack for Safari
if (dashLength === 0) dashLength = 0.001; // Hack for Safari
var dashCount = dashArray.length; var dashCount = dashArray.length;
this.moveTo(x, y); this.moveTo(x, y);
var dx = (x2 - x), dy = (y2 - y); var dx = (x2 - x), dy = (y2 - y);

Loading…
Cancel
Save