]> _ Git - cubeextranet.git/commitdiff
wait #5147 @1
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Mon, 7 Mar 2022 16:07:02 +0000 (16:07 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Mon, 7 Mar 2022 16:07:02 +0000 (16:07 +0000)
inc/ws/Util/html5/master/class.ws.html5.links.php

index 3394519da959dc37e19eaf244c9c4a699dd304c2..486f9365f81a0fd9551b2a7da55cd0649fe9b40c 100644 (file)
@@ -55,6 +55,7 @@ class wsHTML5Link
     public $attachLeft = false;
     public $allowsAnimation = true;
     public $forceTexture = false;
+    public $letterspacing = 0;
 
     protected $role = 'button';
 
@@ -621,6 +622,9 @@ class wsHTML5Link
                         $this->blendmode = $animation['blendmode'];
                         unset($animation['blendmode']);
                     }
+                    if (isset($animation['letterspacing'])) {
+                        $this->letterspacing = $animation['letterspacing'];
+                    }
                     if (isset($animation['zindex'])) {
                         if ($animation['zindex'] >= 10) {
                             $this->zindex = $animation['zindex'];
@@ -1794,10 +1798,23 @@ class textLink extends contentLink
         $fz = $this->height * $this->getCssScale();
         $fz = round($fz / $font['capHeight'], 2);
         $res = parent::getCSS();
-        $res .= 'line-height:' . $font['capHeight'] . ';font-size:' . $fz . 'px;font-family:' . $font['family'] . ';color:' . wsHTML5::colorToCSS($this->extra, 1) . ';';
+        $res .= 'letter-spacing:' . $this->_css($this->letterspacing) . ';line-height:' . $font['capHeight'] . ';font-size:' . $fz . 'px;font-family:' . $font['family'] . ';color:' . wsHTML5::colorToCSS($this->extra, 1) . ';';
         return $res;
     }
 
+    protected function _css($v, $unit = "px")
+    {
+        if (!$v) {
+            return 0;
+        }
+        if (preg_match('/^([0-9\.\-]+)([a-z]*)$/', $v, $matches)) {
+            $v = $matches[1];
+            $unit = isset($matches[2]) && $matches[2] ? $matches[2] : $unit;
+        }
+        return $v . $unit;
+
+    }
+
     public function getHTMLContainerClass()
     {
         return parent::getHTMLContainerClass() . ' textLink';