namespace Fluidbook\Tools\Links;
-class ContentLink extends Link {
+class ContentLink extends Link
+{
public $defaultZIndex = 30;
public $allowsAnimation = true;
public $interactive = false;
public $forceTexture = false;
+ public $parallax = 0;
- public function getHTMLContainerClass() {
+ public function getHTMLContainerClass()
+ {
return parent::getHTMLContainerClass() . ' contentLink';
}
- public function getAdditionnalContent() {
+ public function getAdditionnalContent()
+ {
$res = parent::getAdditionnalContent();
if ($this->allowsAnimation) {
$animations = self::parseAnimations($this->image_rollover ?? 'none');
if (isset($animation['addzindex'])) {
$this->addzindex = $animation['addzindex'];
}
+ if (isset($animation['parallax'])) {
+ $this->parallax = floatval($animation['parallax']);
+ $animation['parallax'] = null;
+ }
}
if ($animations) {
$res .= ' data-animations="' . htmlspecialchars(json_encode($animations), ENT_QUOTES) . '" ';
$res .= ' data-animation-hide-on-leave ';
}
}
+
+ if ($this->parallax != 0) {
+ $this->compiler->addJsLib('parallax', ['js/libs/fluidbook/fluidbook.parallax.js']);
+ $res .= ' data-parallax="' . $this->parallax . '" ';
+ }
}
if ($this->forceTexture && $this->getDepth() >= 40) {
$res .= ' data-force-texture="1" ';
}
+
return $res;
}
- protected function _isFinallyHidden($animations) {
+ protected function _isFinallyHidden($animations)
+ {
$hiddenAnimations = ['fadeout', 'unmask'];
foreach ($animations as $animation) {
if (isset($animation['type']) && in_array($animation['type'], $hiddenAnimations)) {
return false;
}
- protected function _isHiddenFirst($animations) {
+ protected function _isHiddenFirst($animations)
+ {
$hiddenAnimations = ['reveal', 'fadein', 'translatefrom'];
foreach ($animations as $animation) {
if (isset($animation['type']) && in_array($animation['type'], $hiddenAnimations)) {