-
Notifications
You must be signed in to change notification settings - Fork 1.5k
fix #2613 with if statement, and null for pointer value rather than r… #2615
Conversation
… than referencing it when undefined
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please also update the documentation according to the pointer value?
@@ -160,7 +160,12 @@ 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 }); | |||
if (typeof(pointer) != 'undefined') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need this conditional expression here? There is no pointer
in the scope, so this expression always evaluates to false
, right?
@@ -172,7 +177,11 @@ 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 }); | |||
if (typeof(pointer) != 'undefined') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
Ill remove the if, i just threw it together hastily and thought the previous person who added this pointer reference, actually had a scenario were it might not be null. Ill just pass null, found the spot in the documentation (docs/network/index.html) and added the note about it, is there any other spots that needed updating? |
…note the null pointer property in certain conditions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me now. Thank you :)
with if statement, and passing null for pointer value rather than referencing it when undefined