Browse Source

fix #2613 with if statement, and null for pointer value rather than r… (#2615)

* 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.
babelFix
CapitanMorgan 7 years ago
committed by yotamberk
parent
commit
bf71d7ebe9
2 changed files with 5 additions and 4 deletions
  1. +1
    -1
      docs/network/index.html
  2. +4
    -3
      lib/network/modules/components/NavigationHandler.js

+ 1
- 1
docs/network/index.html View File

@ -1401,7 +1401,7 @@ var options = {
</tr>
<tr><td id="event_zoom">zoom</td>
<td>Object</td>
<td>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:
<td>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:
<pre class="prettyprint lang-js">{
direction: '+'/'-',
scale: Number,

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

@ -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;
export default NavigationHandler;

Loading…
Cancel
Save