From 0ae1443b881638967b704469a64f08abfd26a62b Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Thu, 8 Feb 2024 20:53:43 +0100 Subject: [PATCH] wait #6200 --- src/Links/ContentLink.php | 22 +++++++++++++++++----- src/Links/ImageLink.php | 19 ++++++++++++------- 2 files changed, 29 insertions(+), 12 deletions(-) diff --git a/src/Links/ContentLink.php b/src/Links/ContentLink.php index 871bc6f..35390cc 100644 --- a/src/Links/ContentLink.php +++ b/src/Links/ContentLink.php @@ -10,6 +10,8 @@ class ContentLink extends Link public $forceTexture = false; public $parallax = 0; + protected $contentInlineStyles=''; + public function getHTMLContainerClass() { $res = parent::getHTMLContainerClass() . ' contentLink'; @@ -52,11 +54,14 @@ class ContentLink extends Link $res .= ' data-animation-hide-on-leave '; } if ($s = $this->_isZoomedIn($animations)) { - $res .= ' data-animation-zoomed-in="' . $s . '" '; + $res .= ' data-animation-zoomed-in="' . $s['scale'] . '" '; } if ($s = $this->_isZoomedOut($animations)) { - $res .= ' data-animation-zoomed-out="' . $s . '" '; + $scale = $s['scale'] ?? 1; + $to = $s['transformOrigin'] ?? '50% 50%'; + $res .= ' data-animation-zoomed-out="' . $scale . '" data-animation-zoomed-origin="' . $to . '" '; + $this->contentInlineStyles .= 'transform:scale(' . $scale . ');transform-origin:' . $to . ';'; } } @@ -80,12 +85,12 @@ class ContentLink extends Link protected function _isZoomedIn($animations) { - return $this->_hasAnimation($animations, ['zoomin', 'scaleto'], 'scale'); + return $this->_hasAnimation($animations, ['zoomin', 'scaleto'], ['scale', 'transformOrigin']); } protected function _isZoomedOut($animations) { - return $this->_hasAnimation($animations, ['zoomout', 'scalefrom'], 'scale'); + return $this->_hasAnimation($animations, ['zoomout', 'scalefrom'], ['scale', 'transformOrigin']); } protected function _isFinallyHidden($animations) @@ -100,7 +105,14 @@ class ContentLink extends Link if ($return === null) { return true; } - return $animation[$return]; + $res = []; + foreach ($return as $item) { + if (isset($animation[$item])) { + $res[$item] = $animation[$item]; + } + } + return $res; + } } return false; diff --git a/src/Links/ImageLink.php b/src/Links/ImageLink.php index a75e72d..977f912 100644 --- a/src/Links/ImageLink.php +++ b/src/Links/ImageLink.php @@ -2,19 +2,23 @@ namespace Fluidbook\Tools\Links; -class ImageLink extends ContentLink { +class ImageLink extends ContentLink +{ - public function getImageUrl() { + public function getImageUrl() + { return Link::getUniversalLocation($this->to, false); } - public function getCSS() { + public function getCSS() + { $res = parent::getCSS(); $this->copyExternalFile($this->to); return $res; } - public function getAdditionnalContent() { + public function getAdditionnalContent() + { $res = parent::getAdditionnalContent(); $res .= ' data-image="' . $this->getImageUrl() . '"'; if (isset($this->image_rollover)) { @@ -23,12 +27,13 @@ class ImageLink extends ContentLink { return $res; } - public function getHTMLContent() { + public function getHTMLContent() + { // For zoomin & zoomout animations if (isset($this->image_rollover) && stristr($this->image_rollover, 'type=zoom')) { - return '
'; + return '
'; } else { - return ''; + return ''; } } -- 2.39.5