From 00fc3cc4e3d0e83c171f28cefec590660cd6920b Mon Sep 17 00:00:00 2001
From: Matthias Konitzny <konitzny@ibr.cs.tu-bs.de>
Date: Wed, 6 Oct 2021 15:33:54 +0200
Subject: [PATCH] Images can now be loaded from external resources.

---
 display/graph.js | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/display/graph.js b/display/graph.js
index 32ba3da..cd791e5 100644
--- a/display/graph.js
+++ b/display/graph.js
@@ -452,15 +452,20 @@ class Graph {
 
         // Draw node circle image
         const textureLoader = new THREE.TextureLoader();
+        textureLoader.setCrossOrigin("anonymous");
         const imageAlpha = textureLoader.load(
             Config.PLUGIN_PATH + "datasets/images/alpha.png"
         );
         let imageTexture = null;
 
         if ("image" in node) {
-            imageTexture = textureLoader.load(
-                Config.PLUGIN_PATH + "datasets/images/" + node.image
-            );
+            if (node.image.startsWith("http")) {
+                imageTexture = textureLoader.load(node.image);
+            } else {
+                imageTexture = textureLoader.load(
+                    Config.PLUGIN_PATH + "datasets/images/" + node.image
+                );
+            }
         } else {
             imageTexture = textureLoader.load(
                 Config.PLUGIN_PATH + "datasets/images/default.jpg"
-- 
GitLab