]> _ Git - fluidbook_tools.git/commitdiff
wip #7347 @2
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 28 Feb 2025 16:32:27 +0000 (17:32 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 28 Feb 2025 16:32:27 +0000 (17:32 +0100)
src/Compiler/Compiler.php
src/Compiler/CompilerInterface.php
src/Compiler/DummyCompiler.php
src/Links/Link.php
src/Links/Object3DLink.php [new file with mode: 0644]
src/Links/Object3DPopupLink.php [new file with mode: 0644]

index 17db5a1cdee1335d3625eb3cb968c0c2cc76b6ab..3da2c89f3df034a8453f1e83ddc63ed0160d5f93 100644 (file)
@@ -394,13 +394,18 @@ class Compiler implements ShouldQueue, ShouldBeUnique, CompilerInterface {
         // TODO: Implement addIssue() method.
     }
 
-    public function addPageBackgroundColor($page, $color, $arrowsColor)
+    public function getExternalMultimediaContents($to)
     {
-        // TODO: Implement addPageBackgroundColor() method.
+        // TODO: Implement getExternalContents() method.
     }
 
-    public function getExternalMultimediaContents($to)
+    public function add3DViewer()
     {
-        // TODO: Implement getExternalContents() method.
+        // TODO: Implement add3DViewer() method.
+    }
+
+    public function addPageBackground($page, $color, $arrowsColor, $image)
+    {
+        // TODO: Implement addPageBackground() method.
     }
 }
index 5fe93786b4785836aef2259ba7036c2bf24b4a90..7f69ab042c25b1bc496fb29d7cd86d1e1518d64d 100644 (file)
@@ -65,6 +65,8 @@ interface CompilerInterface
 
     public function addPDFJS($force = false);
 
+    public function add3DViewer();
+
     public function addSEOArticle($page, $title, $intro, $image, $id = null, $url = null, $content = '');
 
     public function getPageNumber(): int;
index 644e7c3b57781a529f726960aa07ab3de3aabc05..3f70533900221d929f68b12ac2cba4b163f13d55 100644 (file)
@@ -159,4 +159,9 @@ class DummyCompiler implements CompilerInterface {
     {
         // TODO: Implement getExternalContents() method.
     }
+
+    public function add3DViewer()
+    {
+        // TODO: Implement add3DViewer() method.
+    }
 }
index 83568fe0fbc6e7cd7b8bf5450e3308f1dec24b15..6fb169b72568119b5ea92b1351fd50ad0706011b 100644 (file)
@@ -218,6 +218,13 @@ class Link
                     return new WebLink($id, $init, $compiler);
                 }
                 return new WebVideoLink($id, $init, $compiler);
+            case static::OBJECT3D:
+                $init['inline'] = self::normalizeInlineIntegration($init['inline'] ?? '');
+                if ($init['inline'] === 'popup') {
+                    return new Object3DPopupLink($id, $init, $compiler);
+                }else{
+                    return new Object3DLink($id, $init, $compiler);
+                }
             case static::ACTION:
                 return new ActionLink($id, $init, $compiler);
             case static::CART: // Basket / Cart links
diff --git a/src/Links/Object3DLink.php b/src/Links/Object3DLink.php
new file mode 100644 (file)
index 0000000..b303440
--- /dev/null
@@ -0,0 +1,12 @@
+<?php
+
+namespace Fluidbook\Tools\Links;
+
+class Object3DLink extends NormalLink
+{
+    public function __construct($id, $init, &$compiler)
+    {
+        parent::__construct($id, $init, $compiler);
+        $this->compiler->add3DViewer();
+    }
+}
diff --git a/src/Links/Object3DPopupLink.php b/src/Links/Object3DPopupLink.php
new file mode 100644 (file)
index 0000000..26acf58
--- /dev/null
@@ -0,0 +1,28 @@
+<?php
+
+namespace Fluidbook\Tools\Links;
+
+class Object3DPopupLink extends NormalLink
+{
+    public function __construct($id, $init, &$compiler)
+    {
+        parent::__construct($id, $init, $compiler);
+    }
+
+    public function getURL()
+    {
+        $this->compiler->add3DViewer();
+        $this->copyExternalFile($this->to);
+        return '#/o3d/' . md5($this->to . '/' . $this->extra . '/' . $this->id);
+    }
+
+    public function getAdditionnalContent()
+    {
+        return ' data-stats-type="popup_o3d" data-stats-name="' . $this->to . '" data-model="' . $this->to . '" ';
+    }
+
+    public function getDefaultTooltip()
+    {
+        return 'click to view the 3D object';
+    }
+}