]> _ Git - fluidbook_tools.git/commitdiff
wip #7647 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 17 Jul 2025 15:35:28 +0000 (17:35 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 17 Jul 2025 15:35:28 +0000 (17:35 +0200)
src/Links/Link.php
src/Links/NormalLink.php

index 9b96248c4329df99e5b1c450cb79c0b6f48d21a5..5045bff3511f2790ef8857a9fd326b2a31306a52 100644 (file)
@@ -102,6 +102,7 @@ class Link
     public $inline;
     public $in_popup = false;
     public $display_area;
+    public $animation_type;
     public $read_mode;
     public $background_color;
     public $group;
@@ -1129,4 +1130,9 @@ class Link
         $compiler->addIssue(2, ['page' => $link['page'], 'uid' => $link['uid']]);
         return '';
     }
+
+    public function getAnimationType()
+    {
+        return (!$this->animation_type || $this->animation_type === 'default') ? $this->compiler->getSetting('linksAnimation', 'fade') : $this->animation_type;
+    }
 }
index ab670a12a704728e0981bb7afaab2298b4937d97..ca5f4025e4e0a6812cd5fbac5c82533239518430 100644 (file)
@@ -18,7 +18,7 @@ class NormalLink extends Link
         if ($this->display_area) {
             if ($this->compiler->getSetting('linksAnimationLayer', 'top') === 'top' || $this->compiler->getSetting('linksAnimation', 'fade') === 'fade') {
                 $class[] = 'displayArea';
-                $attrs .= ' data-animation="' . $this->compiler->getSetting('linksAnimation', 'fade') . '"';
+                $attrs .= ' data-animation="' . $this->getAnimationType() . '"';
             } else {
                 $attrs .= ' data-display-area=""';
             }
@@ -30,6 +30,7 @@ class NormalLink extends Link
         if ($this->blinkdelay > 0) {
             $attrs .= ' data-blinkdelay="' . intval($this->blinkdelay) . '"';
         }
+
         return '<a href="' . $this->getURL() . '" data-type="' . $this->type . '" target="' . $this->getTarget() . '"' . $attrs . $this->getAdditionnalContent() . $this->getTrack() . '>' . $this->getInnerContent() . '</a>';
     }
 
@@ -62,7 +63,8 @@ class NormalLink extends Link
         $init['zindex'] = 29;
         $init['uid'] .= '_da';
         $init['id'] .= '_da';
-        $init['image_rollover'] = 'type=reveal
+        if ($this->getAnimationType() === 'highlight') {
+            $init['image_rollover'] = 'type=reveal
 direction=right
 ease=power1.easeOut
 opacity=' . $opacity . '
@@ -74,6 +76,25 @@ type=fadeout
 ease=power1.easeOut
 duration=' . $animDuration . '
 delay=' . ($delay - 0.5 + $animDuration + $duration);
+        } else if ($this->getAnimationType() === 'fade') {
+            $init['image_rollover'] = 'type=fadein
+ease=power1.easeOut
+duration=' . $animDuration . '
+delay=' . $delay . '
+borderradius=' . ($this->compiler->getSetting('linksRoundedCorners', 0) * 2) . '
+---------------
+type=fadeout
+ease=power1.easeOut
+duration=' . $animDuration . '
+delay=' . ($delay - 0.5 + $animDuration + $duration);
+        } else if ($this->getAnimationType() === 'none') {
+            $init['image_rollover'] = 'type=fadeout
+ease=power1.easeOut
+duration=0
+delay=0
+borderradius=' . ($this->compiler->getSetting('linksRoundedCorners', 0) * 2);
+        }
+
         return self::getInstance($init['id'], $init, $this->compiler);
     }