public $forceTexture = false;
public $parallax = 0;
+ protected $contentInlineStyles='';
+
public function getHTMLContainerClass()
{
$res = parent::getHTMLContainerClass() . ' contentLink';
$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 . ';';
}
}
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)
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;
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)) {
return $res;
}
- public function getHTMLContent() {
+ public function getHTMLContent()
+ {
// For zoomin & zoomout animations
if (isset($this->image_rollover) && stristr($this->image_rollover, 'type=zoom')) {
- return '<div class="img" style="background-image:url(' . $this->getImageUrl() . ');"></div>';
+ return '<div class="img" style="background-image:url(' . $this->getImageUrl() . ');' . $this->contentInlineStyles . '"></div>';
} else {
- return '<img src="' . $this->getImageUrl() . '" />';
+ return '<img src="' . $this->getImageUrl() . '" style="' . $this->contentInlineStyles . '" />';
}
}