]> _ Git - fluidbook_tools.git/commitdiff
wip #6200 @1.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 8 Feb 2024 18:41:51 +0000 (19:41 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 8 Feb 2024 18:41:51 +0000 (19:41 +0100)
src/Links/ContentLink.php

index a0f1a8ac7e71d254a0374daa3eedddae30aa1e45..871bc6fa04ab4739967fe9ebf381d5755cc3abfe 100644 (file)
@@ -51,6 +51,13 @@ class ContentLink extends Link
                 if ($this->_isFinallyHidden($animations)) {
                     $res .= ' data-animation-hide-on-leave ';
                 }
+                if ($s = $this->_isZoomedIn($animations)) {
+                    $res .= ' data-animation-zoomed-in="' . $s . '" ';
+                }
+
+                if ($s = $this->_isZoomedOut($animations)) {
+                    $res .= ' data-animation-zoomed-out="' . $s . '" ';
+                }
             }
 
             if ($this->parallax != 0) {
@@ -71,12 +78,29 @@ class ContentLink extends Link
         return 0;
     }
 
+    protected function _isZoomedIn($animations)
+    {
+        return $this->_hasAnimation($animations, ['zoomin', 'scaleto'], 'scale');
+    }
+
+    protected function _isZoomedOut($animations)
+    {
+        return $this->_hasAnimation($animations, ['zoomout', 'scalefrom'], 'scale');
+    }
+
     protected function _isFinallyHidden($animations)
     {
-        $hiddenAnimations = ['fadeout', 'unmask'];
+        return $this->_hasAnimation($animations, ['fadeout', 'unmask']);
+    }
+
+    protected function _hasAnimation($animations, $types, $return = null)
+    {
         foreach ($animations as $animation) {
-            if (isset($animation['type']) && in_array($animation['type'], $hiddenAnimations)) {
-                return true;
+            if (isset($animation['type']) && in_array($animation['type'], $types)) {
+                if ($return === null) {
+                    return true;
+                }
+                return $animation[$return];
             }
         }
         return false;