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 function getHTMLContainerClass()
- {
+ public function getHTMLContainerClass() {
return parent::getHTMLContainerClass() . ' contentLink';
}
- public function getAdditionnalContent()
- {
+ public function getAdditionnalContent() {
$res = parent::getAdditionnalContent();
- $animations = self::parseAnimations($this->image_rollover);
- foreach ($animations as $animation) {
- if (isset($animation['blendmode'])) {
- $this->blendmode = $animation['blendmode'];
- unset($animation['blendmode']);
+ if ($this->allowsAnimation) {
+ $animations = self::parseAnimations($this->image_rollover);
+ foreach ($animations as $animation) {
+ if (isset($animation['blendmode'])) {
+ $this->blendmode = $animation['blendmode'];
+ unset($animation['blendmode']);
+ }
+ if (isset($animation['zindex'])) {
+ $this->zindex = $animation['zindex'];
+ }
+ if (isset($animation['addzindex'])) {
+ $this->addzindex = $animation['addzindex'];
+ }
}
- if (isset($animation['zindex'])) {
- $this->zindex = $animation['zindex'];
+ $res .= ' data-animations="' . htmlspecialchars(json_encode($animations), ENT_QUOTES) . '" ';
+ if ($this->_isHiddenFirst($animations)) {
+ $res .= ' data-animation-hide ';
}
- if (isset($animation['addzindex'])) {
- $this->addzindex = $animation['addzindex'];
+ if ($this->_isFinallyHidden($animations)) {
+ $res .= ' data-animation-hide-on-leave ';
}
}
- $res .= ' data-animations="' . htmlspecialchars(json_encode($animations), ENT_QUOTES) . '" ';
- if ($this->_isHiddenFirst($animations)) {
- $res .= ' data-animation-hide ';
- }
- if ($this->_isFinallyHidden($animations)) {
- $res .= ' data-animation-hide-on-leave ';
+ 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)) {
--- /dev/null
+<?php
+
+namespace Fluidbook\Tools\Links;
+
+class FlipcardLink extends ImageLink {
+ public $interactive = true;
+ public $defaultZIndex = 70;
+ public $forceTexture = true;
+
+ public function getHTMLContent() {
+ $this->copyExternalFile($this->to);
+ $this->copyExternalFile($this->alternative);
+ $res = '<a href="#" ' . $this->getTooltipAttribute() . '></a>';
+ $res .= '<div class="flipcard">';
+ $res .= '<div class="front"><img src="' . self::getUniversalLocation($this->to) . '"></div>';
+ $res .= '<div class="back"><img src="' . self::getUniversalLocation($this->alternative) . '"></div>';
+ $res .= '</div>';
+ return $res;
+ }
+
+ public function getDefaultTooltip() {
+ return 'click to flip';
+ }
+
+ public function getAdditionnalContent() {
+ $res = parent::getAdditionnalContent();
+ $res .= ' data-flipcard="' . ($this->width > $this->height ? 'axis-x' : 'axis-y') . '" ';
+ return $res;
+ }
+}