diff --git a/src/PSVNavBarButton.js b/src/PSVNavBarButton.js index f82544f12..1a6260696 100644 --- a/src/PSVNavBarButton.js +++ b/src/PSVNavBarButton.js @@ -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 "+" @@ -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; diff --git a/src/PhotoSphereViewer.js b/src/PhotoSphereViewer.js index 2503f31e8..a0caedd83 100644 --- a/src/PhotoSphereViewer.js +++ b/src/PhotoSphereViewer.js @@ -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