]> _ Git - fluidbook-html5.git/commitdiff
wait #4491 @1.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 25 May 2021 14:07:09 +0000 (16:07 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 25 May 2021 14:07:09 +0000 (16:07 +0200)
js/libs/fluidbook/fluidbook.links.js

index 99edd62a97e88606620ccd19b8a7a8a57bd2d159..446358eca6a8c0eeabded6ccde0b1c0626c359a8 100644 (file)
@@ -519,7 +519,7 @@ FluidbookLinks.prototype = {
             animation.type = 'none';
         }
         var defaultParams = {};
-        var globalDefault = {x: 0, y: 0, yoyo: 0, repeat: 0};
+        var globalDefault = {x: 0, y: 0, yoyo: 0, repeat: 0, transformorigin: '50% 50%'};
         var w = parseFloat(link.css('width'));
         var cx = w / 2;
         var h = parseFloat(link.css('height'));
@@ -546,10 +546,24 @@ FluidbookLinks.prototype = {
         if (animation.delay !== undefined) {
             to.delay = parseFloat(animation.delay);
         }
-        if (animation.type === 'translatefrom') {
+        if (animation.type === 'scalefrom') {
+            to.display = 'block';
+            to.visibility = 'visible';
+
+            from.scale = animation.scale;
+            to.scale = 1;
+            from.transformOrigin = to.transformOrigin = animation.transformorigin;
+        } else if (animation.type === 'scale') {
+            to.display = 'block';
+            to.visibility = 'visible';
+
+            from.scale = 1;
+            to.scale = animation.scale;
+            from.transformOrigin = to.transformOrigin = animation.transformorigin;
+        } else if (animation.type === 'translatefrom') {
             from.display = 'none';
             to.display = 'block';
-            to.visibility='visible';
+            to.visibility = 'visible';
 
             from.x = animation.x;
             from.y = animation.y;
@@ -559,7 +573,7 @@ FluidbookLinks.prototype = {
         } else if (animation.type === 'translate') {
             from.display = 'none';
             to.display = 'block';
-            to.visibility='visible';
+            to.visibility = 'visible';
             from.x = 0;
             from.y = 0;
             to.x = animation.x;
@@ -567,10 +581,10 @@ FluidbookLinks.prototype = {
 
         } else if (animation.type === 'zoomin' || animation.type === 'zoomout') {
             var s = (100 * animation.scale) + "%";
-            from.backgroundPosition = to.backgroudPosition = '50% 50%';
+            from.backgroundPosition = to.backgroudPosition = animation.transformorigin;
             from.backgroundSize = animation.type === 'zoomin' ? '100% 100%' : s + ' ' + s;
             to.backgroundSize = animation.type === 'zoomout' ? '100% 100%' : s + ' ' + s;
-            to.visibility='visible';
+            to.visibility = 'visible';
             if (Modernizr.firefox) {
                 to.force3D = true;
                 to.rotation = 0.01;
@@ -579,7 +593,7 @@ FluidbookLinks.prototype = {
         } else if (animation.type === 'fadein') {
             from.display = 'none';
             to.display = 'block';
-            to.visibility='visible';
+            to.visibility = 'visible';
             from.opacity = 0;
             to.opacity = 1;
         } else if (animation.type === 'fadeout') {
@@ -589,7 +603,7 @@ FluidbookLinks.prototype = {
             if (animation.type === 'reveal') {
                 from.display = 'none';
                 to.display = 'block';
-                to.visibility='visible';
+                to.visibility = 'visible';
             }
 
             var top = 0;