From: Vincent Vanwaelscappel Date: Fri, 21 Apr 2017 12:30:31 +0000 (+0200) Subject: wip #1344 @1 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=94e54c3fe0e6c7fed8a46c8e50c662bbae6591ea;p=fluidbook-html5.git wip #1344 @1 --- diff --git a/js/libs/fluidbook/fluidbook.touch.js b/js/libs/fluidbook/fluidbook.touch.js index 1bb9341d..2d34921f 100644 --- a/js/libs/fluidbook/fluidbook.touch.js +++ b/js/libs/fluidbook/fluidbook.touch.js @@ -106,7 +106,6 @@ FluidbookTouch.prototype = { y + '%', true); - if (this.fluidbook.zoom.zoom == 1) { if (this.startX == -1) { diff --git a/js/libs/fluidbook/fluidbook.zoom.js b/js/libs/fluidbook/fluidbook.zoom.js index 53bf0c53..98d15057 100644 --- a/js/libs/fluidbook/fluidbook.zoom.js +++ b/js/libs/fluidbook/fluidbook.zoom.js @@ -9,7 +9,23 @@ function FluidbookZoom(fluidbook) { FluidbookZoom.prototype = { init: function () { + var $this=this; this.setTransition(true); + + $(this.fluidbook).on('fluidbook.zoom.out.end', function () { + $("#z").addClass('nozoom'); + }); + + // Detect when we have finished zooming out and raise an event + $("#z").on('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', function () { + $this.triggerEvent((($this.zoom == 1) ? 'out' : 'in') + '.end'); + }); + + }, + + triggerEvent: function (event) { + console.log('trigger ' + e); + $(this.fluidbook).trigger(e); }, /** @@ -106,13 +122,11 @@ FluidbookZoom.prototype = { } else { $("header,footer,#interface").removeClass('hidden'); } - $("#z").addClass('animate').transform(animation); - setTimeout(function () { - $("#z").removeClass('animate'); - if (this.zoom == 1) { - $("#z").addClass('nozoom'); - } - }, 600); + $("#z").transform(animation); + $this.triggerEvent(((this.zoom == 1) ? 'out' : 'in') + '.start'); + if (!this.transition) { + $this.triggerEvent(((this.zoom == 1) ? 'out' : 'in') + '.end'); + } if (this.desktopScale > 1) { $("body").addClass('zoomed');