From: Vincent Vanwaelscappel Date: Thu, 8 Feb 2024 18:41:51 +0000 (+0100) Subject: wip #6200 @1.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=f8d85a167a67a9219bc9a13d2a8c13b1b8e85455;p=fluidbook_tools.git wip #6200 @1.5 --- diff --git a/src/Links/ContentLink.php b/src/Links/ContentLink.php index a0f1a8a..871bc6f 100644 --- a/src/Links/ContentLink.php +++ b/src/Links/ContentLink.php @@ -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;