Skip to content

Commit

Permalink
Zoom can be changed by scrolling on the navigation bar range
Browse files Browse the repository at this point in the history
  • Loading branch information
JeremyHeleine committed Sep 9, 2017
1 parent ff3be82 commit 75d4afe
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/PSVNavBarButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ var PSVNavBarButton = function(psv, type, style) {
addEvent(document, 'touchmove', changeZoomByTouch);
addEvent(document, 'mouseup', stopZoomChange);
addEvent(document, 'touchend', stopZoomChange);
addEvent(zoom_range_bg, 'mousewheel', changeZoomOnMouseWheel);
addEvent(zoom_range_bg, 'DOMMouseScroll', changeZoomOnMouseWheel);
zoom_range.appendChild(zoom_value);

// Zoom "+"
Expand Down Expand Up @@ -478,6 +480,17 @@ var PSVNavBarButton = function(psv, type, style) {
}
};

/**
* Change zoom by scrolling.
* @private
* @param {Event} evt - The event
* @return {void}
**/

var changeZoomOnMouseWheel = function(evt) {
psv.mouseWheel(evt);
};

// Some useful attributes
var zoom_range_bg, zoom_range, zoom_value;
var mousedown = false;
Expand Down
11 changes: 11 additions & 0 deletions src/PhotoSphereViewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1272,6 +1272,17 @@ var PhotoSphereViewer = function(args) {
}
};

/**
* Use a mousewheel event.
* @public
* @param {Event} evt - The event
* @return {void}
**/

this.mouseWheel = function(evt) {
onMouseWheel(evt);
};

/**
* Sets the new zoom level.
* @private
Expand Down

0 comments on commit 75d4afe

Please sign in to comment.