]> _ Git - fluidbook_tools.git/commitdiff
wait #5745 @0.25
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 21 Feb 2023 11:34:54 +0000 (12:34 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 21 Feb 2023 11:34:54 +0000 (12:34 +0100)
src/Links/Link.php

index acb5f1e89f0760b69a7a93b54dfa6810166fd59e..b7ea8274a37434dfd0d1fcd7bc72b21ff0ec173c 100644 (file)
@@ -88,6 +88,8 @@ class Link {
     public static function getInstance($id, $init, &$compiler) {
         $init = ArrayUtil::asArray($init);
 
+        static::normalizeAttributes($init);
+
         $init['scorm'] = self::isScorm($init);
         $init['to'] = self::replaceCustomURL($init['to']);
 
@@ -206,6 +208,15 @@ class Link {
 
     }
 
+    public static function normalizeAttributes(&$a) {
+        $numbers = ['left', 'top', 'rot', 'width', 'height'];
+        foreach ($a as $k => $v) {
+            if (in_array($k, $numbers)) {
+                $a[$k] = floatval($v);
+            }
+        }
+    }
+
     public function getSurface() {
         return $this->width * $this->height;
     }