From bf71d7ebe9a0e1d7f9c7afffc9361fbdd7324dd7 Mon Sep 17 00:00:00 2001 From: CapitanMorgan Date: Tue, 24 Jan 2017 10:26:48 -0700 Subject: [PATCH] =?UTF-8?q?fix=20#2613=20with=20if=20statement,=20and=20nu?= =?UTF-8?q?ll=20for=20pointer=20value=20rather=20than=20r=E2=80=A6=20(#261?= =?UTF-8?q?5)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix #2613 with if statement, and null for pointer value rather than referencing it when undefined * removed if statement, since not needed, and updated documentation to note the null pointer property in certain conditions. --- docs/network/index.html | 2 +- lib/network/modules/components/NavigationHandler.js | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/network/index.html b/docs/network/index.html index 2742e3b8..cc86669f 100644 --- a/docs/network/index.html +++ b/docs/network/index.html @@ -1401,7 +1401,7 @@ var options = { zoom 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: + 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(). When fired by clicking the zoom in or zoom out navigation buttons, the pointer property of the object passed will be null. Passes an object with properties structured as:
{
   direction: '+'/'-',
   scale: Number,
diff --git a/lib/network/modules/components/NavigationHandler.js b/lib/network/modules/components/NavigationHandler.js
index befe3063..9d044fdc 100644
--- a/lib/network/modules/components/NavigationHandler.js
+++ b/lib/network/modules/components/NavigationHandler.js
@@ -160,7 +160,8 @@ 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, pointer: pointer });
+    this.body.emitter.emit('zoom', { direction: '+', scale: this.body.view.scale, pointer: null });
+
   }
   _zoomOut()  {
     var scaleOld = this.body.view.scale;
@@ -172,7 +173,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, pointer: pointer });
+    this.body.emitter.emit('zoom', { direction: '-', scale: this.body.view.scale, pointer: null });
   }
 
 
@@ -226,4 +227,4 @@ class NavigationHandler {
 }
 
 
-export default NavigationHandler;
\ No newline at end of file
+export default NavigationHandler;