diff --git a/docs/network/index.html b/docs/network/index.html index cfd03d64..2742e3b8 100644 --- a/docs/network/index.html +++ b/docs/network/index.html @@ -1400,8 +1400,14 @@ var options = { Fired if the option interaction:{hover:true} is enabled and the mouse moved away from an edge it was hovering over before. zoom - {direction:'+'/'-', scale: Number} - Fired when the user zooms in or out. The properties tell you which direction the zoom is in. The scale is a number greater than 0, which is the same that you get with network.getScale(). + Object + Fired when the user zooms in or out. The properties tell you which direction the zoom is in. The scale is a number greater than 0, which is the same that you get with network.getScale(), Passes an object with properties structured as: +
{
+  direction: '+'/'-',
+  scale: Number,
+  pointer: {x:pointer_x, y:pointer_y}
+}
+
showPopup id of item corresponding to popup diff --git a/lib/network/modules/InteractionHandler.js b/lib/network/modules/InteractionHandler.js index b4e6fec4..14ab3a7e 100644 --- a/lib/network/modules/InteractionHandler.js +++ b/lib/network/modules/InteractionHandler.js @@ -472,10 +472,10 @@ class InteractionHandler { this.body.emitter.emit('_requestRedraw'); if (scaleOld < scale) { - this.body.emitter.emit('zoom', {direction: '+', scale: this.body.view.scale}); + this.body.emitter.emit('zoom', {direction: '+', scale: this.body.view.scale, pointer: pointer}); } else { - this.body.emitter.emit('zoom', {direction: '-', scale: this.body.view.scale}); + this.body.emitter.emit('zoom', {direction: '-', scale: this.body.view.scale, pointer: pointer}); } } } diff --git a/lib/network/modules/components/NavigationHandler.js b/lib/network/modules/components/NavigationHandler.js index 14347814..befe3063 100644 --- a/lib/network/modules/components/NavigationHandler.js +++ b/lib/network/modules/components/NavigationHandler.js @@ -160,7 +160,7 @@ class NavigationHandler { this.body.view.scale = scale; this.body.view.translation = { x: tx, y: ty }; - this.body.emitter.emit('zoom', { direction: '+', scale: this.body.view.scale }); + this.body.emitter.emit('zoom', { direction: '+', scale: this.body.view.scale, pointer: pointer }); } _zoomOut() { var scaleOld = this.body.view.scale; @@ -172,7 +172,7 @@ class NavigationHandler { this.body.view.scale = scale; this.body.view.translation = { x: tx, y: ty }; - this.body.emitter.emit('zoom', { direction: '-', scale: this.body.view.scale }); + this.body.emitter.emit('zoom', { direction: '-', scale: this.body.view.scale, pointer: pointer }); }