})
- $(document).on('mousewheel', function (e) {
- if ($this.fluidbook.zoom.enabled) {
- $this.wheelZoom(e.deltaY);
- }
- });
$(document).on('mousemove', 'body', function (e) {
if ($this.fluidbook.zoom.enabled) {
$this.moveZoom(e);
this.fluidbook.zoom.setZoom(newScale);
return false;
},
- wheelZoom: function (delta) {
- // Disable scroll zoom when either a view or the menu is open...
- if ($("body").is('.view, .menu-open')) {
- return;
- }
- this.fluidbook.zoom.setZoom(this.fluidbook.zoom.zoom + delta / 3, delta > 0 ? 1 : -1);
- },
+
};
\ No newline at end of file
if (this.fluidbook.mobilefirst.enabled) {
text = this.fluidbook.l10n.__('scroll down to read the page content');
} else {
- text = this.fluidbook.l10n.__('click once to zoom in, click again to zoom out') + '<br />' + this.fluidbook.l10n.__('roll the mouse wheel to zoom in/out');
+ text = this.fluidbook.l10n.__('click once to zoom in, click again to zoom out');
+ if (this.fluidbook.settings.zoomWheel === 'wheel') {
+ text += '<br />' + this.fluidbook.l10n.__('roll the mouse wheel to zoom in/out');
+ } else if (this.fluidbook.settings.zoomWheel === 'ctrlwheel') {
+ text += '<br />' + this.fluidbook.l10n.__('use Ctrl + scroll to zoom in/out');
+ }
}
help += '<div class="illustration mouse">' + getSpriteIcon('help-mouse', {
var $this = this;
this.setTransition(true);
+ this.initMouseWheel();
+
$(this.fluidbook).on('fluidbook.zoom.out.end', function () {
$("#z").addClass('nozoom');
});
this.fluidbook.keyboard.initZoomShortcuts();
},
+ initMouseWheel: function () {
+ var $this = this;
+ window.addEventListener('wheel', function (e) {
+ var returnValue = true;
+ if (e.ctrlKey) {
+ e.preventDefault();
+ e.stopPropagation();
+ e.stopImmediatePropagation();
+ returnValue = false;
+ }
+ if (!$this.enabled || $this.fluidbook.settings.zoomWheel === 'disabled') {
+ return returnValue;
+ }
+ if ($this.fluidbook.settings.zoomWheel === 'ctrlwheel' && !e.ctrlKey) {
+ return returnValue;
+ }
+ // Disable scroll zoom when either a view or the menu is open...
+ if ($("body").is('.view, .menu-open')) {
+ return returnValue;
+ }
+
+ $this.wheelZoom(e.deltaY * -1);
+ return returnValue;
+ }, {passive: false});
+ },
+
+ wheelZoom: function (delta) {
+ var dir;
+ if (delta > 0) {
+ delta = 0.7;
+ dir = 1;
+ } else {
+ delta = -0.7;
+ dir = -1;
+ }
+ this.setZoom(this.zoom + delta, dir);
+ },
+
increaseZoom: function () {
var z;
if (this.zoom === 1) {