]> _ Git - fluidbook-html5.git/commitdiff
wait #5420
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 1 Sep 2022 18:16:28 +0000 (20:16 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 1 Sep 2022 18:16:28 +0000 (20:16 +0200)
js/libs/fluidbook/fluidbook.links.js

index 429f899350fc43f129564c13d4623a8e61e4a278..abefe144ac9664577b1e0e40162a3145fab0e57e 100644 (file)
@@ -664,7 +664,15 @@ FluidbookLinks.prototype = {
             animation.type = 'none';
         }
         var defaultParams = {};
-        var globalDefault = {x: 0, y: 0, yoyo: 0, repeatdelay: 0, repeat: 0, transformorigin: '50% 50%'};
+        var globalDefault = {
+            x: 0,
+            y: 0,
+            yoyo: 0,
+            repeatdelay: 0,
+            repeat: 0,
+            transformorigin: '50% 50%',
+            preventflickering: 0
+        };
 
         if ($(linkElement).hasClass('textLink')) {
             globalDefault.transformorigin = '0 100%';
@@ -697,8 +705,13 @@ FluidbookLinks.prototype = {
             css.textAlign = animation.align;
         }
         if (animation.scale && ['scale', 'scalefrom', 'zoomin', 'zoomout'].indexOf(animation.type) === -1) {
-            css.transform = 'scale(' + animation.scale + ')';
-            css.transformOrigin = animation.transformorigin;
+            if (animation.preventflickering) {
+                css.backgroundSize = '100% 100%';
+                css.backgroundPosition = animation.transformorigin;
+            } else {
+                css.transform = 'scale(' + animation.scale + ')';
+                css.transformOrigin = animation.transformorigin;
+            }
         }
 
         if (animation.letterspacing) {
@@ -753,11 +766,17 @@ FluidbookLinks.prototype = {
         } else if (animation.type === 'zoomin' || animation.type === 'zoomout') {
             to.display = 'block';
             to.visibility = 'visible';
-
+            animatedElement = $(linkElement).find('img,div.img');
             from.scale = animation.type === 'zoomin' ? 1 : animation.scale;
             to.scale = animation.type === 'zoomout' ? 1 : animation.scale;
-            animatedElement = $(linkElement).find('img,div.img');
             from.transformOrigin = to.transformOrigin = animation.transformorigin;
+            if (animation.preventflickering == 1) {
+                from.backgroundSize = from.scale * 100 + '% ' + from.scale * 100 + '%';
+                to.backgroundSize = to.scale * 100 + '% ' + to.scale * 100 + '%';
+                from.backgroundPosition = animation.transformorigin;
+                to.transformOrigin = from.transformOrigin = '50% 50%';
+                to.scale = from.scale = 1;
+            }
         } else if (animation.type === 'fadein') {
             from.display = 'none';
             to.display = 'block';