]> _ Git - fluidbook-html5.git/commitdiff
wip #1344 @1
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 21 Apr 2017 12:30:31 +0000 (14:30 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 21 Apr 2017 12:30:31 +0000 (14:30 +0200)
js/libs/fluidbook/fluidbook.touch.js
js/libs/fluidbook/fluidbook.zoom.js

index 1bb9341d186c39aa759784f30ee075458080f136..2d34921fd9f6137bc254dea915f1dccdbae04904 100644 (file)
@@ -106,7 +106,6 @@ FluidbookTouch.prototype = {
             y + '%',
             true);
 
-
         if (this.fluidbook.zoom.zoom == 1) {
 
             if (this.startX == -1) {
index 53bf0c53b7258ecbb757cf55efe491498c300667..98d150577dcff0316e6a74b3ee177a49fbf0b3cf 100644 (file)
@@ -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');