Browse Source

added updateCalculationNodes to the remove node function to fix bug reported by #68

css_transitions
Alex de Mulder 10 years ago
parent
commit
8218a8e4c7
3 changed files with 32 additions and 22 deletions
  1. +15
    -10
      dist/vis.js
  2. +16
    -12
      src/graph/Edge.js
  3. +1
    -0
      src/graph/Graph.js

+ 15
- 10
dist/vis.js View File

@ -10643,18 +10643,22 @@ Edge.prototype.draw = function(ctx) {
* @return {boolean} True if location is located on the edge * @return {boolean} True if location is located on the edge
*/ */
Edge.prototype.isOverlappingWith = function(obj) { Edge.prototype.isOverlappingWith = function(obj) {
var distMax = 10;
if (this.connected == true) {
var distMax = 10;
var xFrom = this.from.x;
var yFrom = this.from.y;
var xTo = this.to.x;
var yTo = this.to.y;
var xObj = obj.left;
var yObj = obj.top;
var xFrom = this.from.x;
var yFrom = this.from.y;
var xTo = this.to.x;
var yTo = this.to.y;
var xObj = obj.left;
var yObj = obj.top;
var dist = this._getDistanceToEdge(xFrom, yFrom, xTo, yTo, xObj, yObj);
var dist = this._getDistanceToEdge(xFrom, yFrom, xTo, yTo, xObj, yObj);
return (dist < distMax);
return (dist < distMax);
}
else {
return false
}
}; };
@ -17318,6 +17322,7 @@ Graph.prototype._removeNodes = function(ids) {
delete nodes[id]; delete nodes[id];
} }
this._updateNodeIndexList(); this._updateNodeIndexList();
this._updateCalculationNodes();
this._reconnectEdges(); this._reconnectEdges();
this._updateSelection(); this._updateSelection();
this._updateValueRange(nodes); this._updateValueRange(nodes);

+ 16
- 12
src/graph/Edge.js View File

@ -216,18 +216,22 @@ Edge.prototype.draw = function(ctx) {
* @return {boolean} True if location is located on the edge * @return {boolean} True if location is located on the edge
*/ */
Edge.prototype.isOverlappingWith = function(obj) { Edge.prototype.isOverlappingWith = function(obj) {
var distMax = 10;
var xFrom = this.from.x;
var yFrom = this.from.y;
var xTo = this.to.x;
var yTo = this.to.y;
var xObj = obj.left;
var yObj = obj.top;
var dist = this._getDistanceToEdge(xFrom, yFrom, xTo, yTo, xObj, yObj);
return (dist < distMax);
if (this.connected == true) {
var distMax = 10;
var xFrom = this.from.x;
var yFrom = this.from.y;
var xTo = this.to.x;
var yTo = this.to.y;
var xObj = obj.left;
var yObj = obj.top;
var dist = this._getDistanceToEdge(xFrom, yFrom, xTo, yTo, xObj, yObj);
return (dist < distMax);
}
else {
return false
}
}; };

+ 1
- 0
src/graph/Graph.js View File

@ -1322,6 +1322,7 @@ Graph.prototype._removeNodes = function(ids) {
delete nodes[id]; delete nodes[id];
} }
this._updateNodeIndexList(); this._updateNodeIndexList();
this._updateCalculationNodes();
this._reconnectEdges(); this._reconnectEdges();
this._updateSelection(); this._updateSelection();
this._updateValueRange(nodes); this._updateValueRange(nodes);

Loading…
Cancel
Save