}
});
$(document).on('click', '#links', function (e) {
- if ($this.fluidbook.zoom.enabled && $this.fluidbook.input.isUsingMouse() && !$this.fluidbook.hasDraggableOnPage()) {
+ if (
+ $this.fluidbook.settings.clickZoom &&
+ $this.fluidbook.zoom.enabled &&
+ $this.fluidbook.input.isUsingMouse() &&
+ !$this.fluidbook.hasDraggableOnPage()
+ ) {
$this.clickZoom(e);
return false;
}
$(document).on('mousemove', 'body', function (e) {
- if ($this.fluidbook.zoom.enabled) {
+ if ($this.fluidbook.zoom.enabled && $this.fluidbook.settings.zoomMouseMoveMode === 'move') {
$this.moveZoom(e);
}
});
} else if (way == -1) {
newScale = 1;
}
- this.moveZoom(e, true)
+ this.moveZoom(e, true);
this.fluidbook.zoom.setZoom(newScale);
return false;
},
// __('zoom out')
link = this.addLink(navType, 'nav-zoomin', '#', 'zoomin', 'zoom in', 'zoom in');
link = this.addLink(navType, 'nav-zoomout', '#', 'zoomout', 'zoom out', 'zoom out');
+
} else if (icon === 'fullscreen' && this.fluidbook.settings.fullscreen && this.fluidbook.support.fullscreen && !this.fluidbook.settings.phonegap) {
// __('switch between fullscreen and normal')
link = this.addLink(navType, 'nav-' + icon, '#', icon, 'full screen', 'switch between fullscreen and normal', 'F11');
}
});
- // Zoom In icon
- $(document).on(this.fluidbook.input.clickEvent, '.icon-zoomin', function (e) {
- $this.fluidbook.desktop.clickZoom(e, 'in');
- return false;
- });
-
- // Zoom Out icon
- $(document).on(this.fluidbook.input.clickEvent, '.icon-zoomout', function (e) {
- $this.fluidbook.desktop.clickZoom(e, 'out');
- return false;
- });
if (this.fluidbook.support.fullscreen) {
this.initFullScreen();
this.fluidbook = fluidbook;
this.zoom = 0;
this.originpct = [0.5, 0.5];
+ this.zoomStep = 0.7;
this.originpx = ['0px', '0px'];
this.initial = this.fluidbook.settings.zoom / 100;
this.max = this.fluidbook.settings.zoomw / 100;
FluidbookZoom.prototype = {
init: function () {
- if (this.fluidbook.mobilefirst.enabled) {
+ if (this.fluidbook.mobilefirst.enabled || (this.fluidbook.settings.zoom <= 100 && this.fluidbook.settings.zoomw <= 100)) {
this.disable();
return;
}
+ if (!this.fluidbook.settings.clickZoom) {
+ this.disableZoomCursor();
+ }
var $this = this;
this.setTransition(true);
this.initMouseWheel();
+ // Zoom icon
+ $(document).on(this.fluidbook.input.clickEvent, '.icon-zoomin', function (e) {
+ if ($this.fluidbook.settings.zoomMouseMoveMode !== 'dragndrop') {
+ $this.fluidbook.desktop.moveZoom(e, true);
+ } else {
+ $this.fluidbook.zoom.setOriginPct(0.5, 0.5, true);
+ }
+ $this.fluidbook.zoom.zoomInFromMenu();
+
+ return false;
+ });
+ $(document).on(this.fluidbook.input.clickEvent, '.icon-zoomout', function (e) {
+ $this.fluidbook.zoom.zoomOutFromMenu();
+ return false;
+ });
+
$(this.fluidbook).on('fluidbook.zoom.out.end', function () {
$("#z").addClass('nozoom');
});
wheelZoom: function (delta) {
var dir;
if (delta > 0) {
- delta = 0.7;
+ delta = this.zoomStep;
dir = 1;
} else {
- delta = -0.7;
+ delta = -1 * this.zoomStep;
dir = -1;
}
this.setZoom(this.zoom + delta, dir);
},
disable: function () {
+ this.disableZoomCursor();
this.enabled = false;
+ },
+
+ disableZoomCursor: function () {
$('body').addClass('zoom-disabled');
},
setZoom: function (zoom, direction, end) {
+ console.log('set zoom ', zoom);
var origZoom = this.zoom;
if (end === undefined) {
}
},
+ zoomInFromMenu: function () {
+ if (this.zoom === 1) {
+ this.setZoom(this.fluidbook.settings.zoom / 100);
+ } else {
+ this.setZoom(this.zoom + this.zoomStep);
+ }
+ },
+
+ zoomOutFromMenu: function () {
+ var z = this.zoom - this.zoomStep;
+ if (z < 1 + this.zoomStep) {
+ z = 1;
+ }
+ this.setZoom(z);
+ },
+
setTransition: function (transition) {
if (transition == undefined) {
transition = true;
// When the search results nav is active, don't reveal interface elements when zooming out...
if (!this.fluidbook.search.resultsNavActive()) {
- var hiddenElements = $("header,footer,#interface,#links a.bookmark");
+ var selector = 'footer,#interface,#links a.bookmark';
+ if (this.fluidbook.settings.hideHeaderOnZoom) {
+ selector += ',header';
+ }
+ var hiddenElements = $(selector);
+
if (this.zoom !== 1) {
if (this.fluidbook.help !== undefined) {
}
try {
this.fluidbook.loader.renderTextsCanvas();
- }catch (e){
+ } catch (e) {
}