Browse Source

Fixed page scroll event not being blocked when moving around in Network using arrow keys

v3_develop
jos 9 years ago
parent
commit
5d4044f988
2 changed files with 15 additions and 5 deletions
  1. +2
    -0
      HISTORY.md
  2. +13
    -5
      lib/network/mixins/NavigationMixin.js

+ 2
- 0
HISTORY.md View File

@ -18,6 +18,8 @@ http://visjs.org
- Fixed physics solving stopping when a support node was not moving.
- Added localization support.
- Implemented option `activatable`.
- Fixed page scroll event not being blocked when moving around in Network
using arrow keys.
### Graph2D

+ 13
- 5
lib/network/mixins/NavigationMixin.js View File

@ -65,6 +65,7 @@ exports._stopMovement = function() {
exports._moveUp = function(event) {
this.yIncrement = this.constants.keyboard.speed.y;
this.start(); // if there is no node movement, the calculation wont be done
event.preventDefault();
};
@ -75,6 +76,7 @@ exports._moveUp = function(event) {
exports._moveDown = function(event) {
this.yIncrement = -this.constants.keyboard.speed.y;
this.start(); // if there is no node movement, the calculation wont be done
event.preventDefault();
};
@ -85,6 +87,7 @@ exports._moveDown = function(event) {
exports._moveLeft = function(event) {
this.xIncrement = this.constants.keyboard.speed.x;
this.start(); // if there is no node movement, the calculation wont be done
event.preventDefault();
};
@ -95,6 +98,7 @@ exports._moveLeft = function(event) {
exports._moveRight = function(event) {
this.xIncrement = -this.constants.keyboard.speed.y;
this.start(); // if there is no node movement, the calculation wont be done
event.preventDefault();
};
@ -105,6 +109,7 @@ exports._moveRight = function(event) {
exports._zoomIn = function(event) {
this.zoomIncrement = this.constants.keyboard.speed.zoom;
this.start(); // if there is no node movement, the calculation wont be done
event.preventDefault();
};
@ -112,10 +117,10 @@ exports._zoomIn = function(event) {
* Zoom out
* @private
*/
exports._zoomOut = function() {
exports._zoomOut = function(event) {
this.zoomIncrement = -this.constants.keyboard.speed.zoom;
this.start(); // if there is no node movement, the calculation wont be done
util.preventDefault(event);
event.preventDefault();
};
@ -123,8 +128,9 @@ exports._zoomOut = function() {
* Stop zooming and unhighlight the zoom controls
* @private
*/
exports._stopZoom = function() {
exports._stopZoom = function(event) {
this.zoomIncrement = 0;
event && event.preventDefault();
};
@ -132,8 +138,9 @@ exports._stopZoom = function() {
* Stop moving in the Y direction and unHighlight the up and down
* @private
*/
exports._yStopMoving = function() {
exports._yStopMoving = function(event) {
this.yIncrement = 0;
event && event.preventDefault();
};
@ -141,6 +148,7 @@ exports._yStopMoving = function() {
* Stop moving in the X direction and unHighlight left and right.
* @private
*/
exports._xStopMoving = function() {
exports._xStopMoving = function(event) {
this.xIncrement = 0;
event && event.preventDefault();
};

Loading…
Cancel
Save