FluidbookDesktop.prototype = {
init: function () {
var $this = this;
+ $(document).on('touchend', '#links', function (e) {
+ // If we are touching the #links, we prevent mouse event emulation in order to prevent zoom on single tap event
+ if ($(e.target).is('#links')) {
+ e.preventDefault();
+ }
+ });
$(document).on('click', '#links', function (e) {
$this.clickZoom(e);
return false;
this.waiters = [];
this.viewport = new FluidbookViewport(this);
this.viewport.updateViewport();
- if (/*Modernizr.ftouch &&*/ this.support.transitions2d && this.datas.mobileTransitions != 'none') {
+ this.desktop = new FluidbookDesktop(this);
+ if (Modernizr.ftouch && this.support.transitions2d && this.datas.mobileTransitions != 'none') {
this.touch = new FluidbookTouch(this);
}
this.background = new FluidbookBackground(this);
this.coquillette = new FluidbookCoquillette(this);
this.stats = new FluidbookStats(this);
this.stats.track(10);
- this.desktop = new FluidbookDesktop(this);
+
this.initTheme();
this.initKeyboardShortcuts();
initInteract: function () {
var $this = this;
- // Double tap
- var hm = new Hammer.Manager(document.getElementById('fluidbook'), {domEvents: false});
+ var hm = new Hammer.Manager(document.getElementById('main'), {domEvents: false});
hm.add(new Hammer.Tap({event: 'doubletap', taps: 2, interval: 500}));
hm.add(new Hammer.Pinch({threshold: 0}));
- hm.add(new Hammer.Pan({threshold: 0}));
hm.get('pinch').set({enable: true});
+
+ // Double tap
hm.on('doubletap', function (event) {
- console.log(event);
if ($this.fluidbook.zoom.zoom > 1) {
$this.fluidbook.zoom.setTransition(true);
$this.fluidbook.zoom.resetZoom();
event.preventDefault();
});
// Pinch
+
hm.on('pinchstart', function (event) {
$this.setZoomOriginFromEvent({'pageX': event.center.x, 'pageY': event.center.y});
$this.zoomAtPinchStart = $this.fluidbook.zoom.zoom;
$this.pinchZoom(event.scale, false);
event.preventDefault();
});
+
hm.on('pinch', function (event) {
if ($this.zoomAtPinchStart != 0) {
$this.pinchZoom(event.scale, false);
$this.zoomAtPinchStart = $this.fluidbook.zoom.zoom;
event.preventDefault();
});
- hm.on('panmove', function (event) {
+
+ var hmf = new Hammer.Manager(document.getElementById('fluidbook'), {domEvents: false});
+ hmf.add(new Hammer.Pan({threshold: 0}));
+ hmf.on('panmove', function (event) {
$this.drag(event);
event.preventDefault();
});
- hm.on('panend', function (event) {
+ hmf.on('panend', function (event) {
$this.drag(event, true);
$this.startX = $this.startY = -1;
$this.panX = $this.panY = 0;
}
if (transition == false) {
- $("#z").addClass('notransition').removeClass('transition');
+ $("#z").addClass('notransition').removeClass('transition').removeClass('transition-inertia');
} else {
- $("#z").removeClass('notransition');
+ $("#z").removeClass('notransition').removeClass('transition-inertia');
}
this.transition = transition;
},
}
$("#z").transform(animation);
$this.triggerEvent(((this.zoom == 1) ? 'out' : 'in') + '.start');
+
if (!this.transition) {
$this.triggerEvent(((this.zoom == 1) ? 'out' : 'in') + '.end');
}