]> _ Git - cubeextranet.git/commitdiff
wait #4536 @0.75
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 15 Jun 2021 16:05:45 +0000 (16:05 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 15 Jun 2021 16:05:45 +0000 (16:05 +0000)
inc/ws/Util/html5/blendmode/class.ws.html5.links.php

index 7d33354bc66940b8caa458e3d6e4c545ea850886..865878c438c9c42526bdf987923be51221fc8df8 100644 (file)
@@ -1533,7 +1533,7 @@ class layerLink extends imageLink
         if (!$this->rightClone) {
             zoomLink::generateImage($attributes, $this->compiler, 'layerlink', 'layer');
         }
-        return 'background-image:url(' . $this->getImageUrl() . ');background-size:100% 100%;background-repeat:no-repeat;';
+        return 'background-image:url(' . $this->getImageUrl() . ');background-size:' . $this->getBackgroundSize() . ';background-position:' . $this->getBackgroundPosition() . ';background-repeat:no-repeat;';
     }
 
     public function getImageUrl()
@@ -1561,7 +1561,9 @@ class colorLink extends contentLink
 
     public function getCSS()
     {
-        return 'background-color:' . wsHTML5::colorToCSS($this->to, 1) . ';';
+        $res = parent::getCSS();
+        $res .= 'background-color:' . wsHTML5::colorToCSS($this->to, 1) . ';';
+        return $res;
     }
 
     public function getAdditionnalContent()
@@ -1582,7 +1584,9 @@ class textLink extends contentLink
         }
         $fz = $this->height * $this->getCssScale();
         $fz = round($fz / $font['capHeight'], 2);
-        return 'line-height:' . $font['capHeight'] . ';font-size:' . $fz . 'px;font-family:' . $font['family'] . ';color:' . wsHTML5::colorToCSS($this->extra, 1) . ';';
+        $res = parent::getCSS();
+        $res .= 'line-height:' . $font['capHeight'] . ';font-size:' . $fz . 'px;font-family:' . $font['family'] . ';color:' . wsHTML5::colorToCSS($this->extra, 1) . ';';
+        return $res;
     }
 
     public function getHTMLContainerClass()
@@ -1614,8 +1618,34 @@ class imageLink extends contentLink
 
     public function getCSS()
     {
+        $res = parent::getCSS();
         $this->copyExternalFile($this->to);
-        return 'background-image:url(' . $this->getImageUrl() . ');background-size:100% 100%;background-repeat:no-repeat;';
+        $res .= 'background-image:url(' . $this->getImageUrl() . ');background-size:' . $this->getBackgroundSize() . ';background-position:' . $this->getBackgroundPosition() . ';background-repeat:no-repeat;';
+        return $res;
+    }
+
+    public function getBackgroundPosition()
+    {
+        $animations = self::parseAnimations($this->image_rollover);
+        foreach ($animations as $animation) {
+            if (($animation['type'] === 'zoomout' || $animation['type'] === 'zoomin') && isset($animation['transformorigin'])) {
+                return $animation['transformorigin'];
+            }
+        }
+        return '50% 50%';
+    }
+
+    public function getBackgroundSize()
+    {
+
+        $size = '100%';
+        $animations = self::parseAnimations($this->image_rollover);
+        foreach ($animations as $animation) {
+            if ($animation['type'] === 'zoomout') {
+                $size = round($animation['scale'] * 100) . '%';
+            }
+        }
+        return $size . ' ' . $size;
     }
 
     public function getAdditionnalContent()