diff --git a/HISTORY.md b/HISTORY.md
index f0150461..8c0cbe96 100644
--- a/HISTORY.md
+++ b/HISTORY.md
@@ -22,6 +22,13 @@ http://visjs.org
- Added multiple types of smoothCurve drawing for greatly improved performance.
- Option for inherited edge colors from connected nodes.
- Option to disable the drawing of nodes or edges on drag.
+- Fixed support nodes not being cleaned up if edges are removed.
+- Improved edge selection detection for long smooth curves.
+- Fixed dot radius bug.
+- Updated max velocity of nodes to three times it's original value.
+- Made "stabilized" event fire every time the network stabilizes.
+- Fixed drift in dragging nodes while zooming.
+
## 2014-07-07, version 3.0.0
diff --git a/docs/network.html b/docs/network.html
index ef3866ff..070d902a 100644
--- a/docs/network.html
+++ b/docs/network.html
@@ -2417,7 +2417,8 @@ network.off('select', onSelect);
stabilized |
- Fired when the network has been stabilized after initialization. This event can be used to trigger the .storePosition() function after stabilization. |
+ Fired when the network has been stabilized. This event can be used to trigger the .storePosition() function after stabilization. When the network in initialized, the parameter
+ iterations will be the amount of iterations it took to stabilize. After initialization, this parameter is null. |
iterations : number of iterations used to stabilize
diff --git a/lib/network/Network.js b/lib/network/Network.js
index b7875307..b9ac51ee 100644
--- a/lib/network/Network.js
+++ b/lib/network/Network.js
@@ -1010,13 +1010,13 @@ Network.prototype._handleOnDrag = function(event) {
var pointer = this._getPointer(event.gesture.center);
- var me = this,
- drag = this.drag,
- selection = drag.selection;
+ var me = this;
+ var drag = this.drag;
+ var selection = drag.selection;
if (selection && selection.length && this.constants.dragNodes == true) {
// calculate delta's and new location
- var deltaX = pointer.x - drag.pointer.x,
- deltaY = pointer.y - drag.pointer.y;
+ var deltaX = pointer.x - drag.pointer.x;
+ var deltaY = pointer.y - drag.pointer.y;
// update position of all selected nodes
selection.forEach(function (s) {
@@ -1031,6 +1031,7 @@ Network.prototype._handleOnDrag = function(event) {
}
});
+
// start _animationStep if not yet running
if (!this.moving) {
this.moving = true;
@@ -1147,6 +1148,13 @@ Network.prototype._zoom = function(scale, pointer) {
if (scale > 10) {
scale = 10;
}
+
+ var preScaleDragPointer = null;
+ if (this.drag !== undefined) {
+ if (this.drag.dragging == true) {
+ preScaleDragPointer = this.DOMtoCanvas(this.drag.pointer);
+ }
+ }
// + this.frame.canvas.clientHeight / 2
var translation = this._getTranslation();
@@ -1160,6 +1168,13 @@ Network.prototype._zoom = function(scale, pointer) {
this._setScale(scale);
this._setTranslation(tx, ty);
this.updateClustersDefault();
+
+ if (preScaleDragPointer != null) {
+ var postScaleDragPointer = this.canvasToDOM(preScaleDragPointer);
+ this.drag.pointer.x = postScaleDragPointer.x;
+ this.drag.pointer.y = postScaleDragPointer.y;
+ }
+
this._redraw();
if (scaleOld < scale) {
@@ -1778,7 +1793,7 @@ Network.prototype._redraw = function() {
this._doInAllSectors("_drawControlNodes",ctx);
}
- this._doInSupportSector("_drawNodes",ctx,true);
+// this._doInSupportSector("_drawNodes",ctx,true);
// this._drawTree(ctx,"#F00F0F");
// restore original scaling and translation
@@ -2088,7 +2103,12 @@ Network.prototype._discreteStepNodes = function() {
this.moving = true;
}
else {
- this.moving = this._isMoving(vminCorrected) || this.constants.configurePhysics;
+ this.moving = this._isMoving(vminCorrected);
+ if (this.moving == false) {
+ this.emit("stabilized",{iterations:null});
+ }
+ this.moving = this.moving || this.configurePhysics;
+
}
}
};
|