Skip to content
Snippets Groups Projects
Commit a3f1d968 authored by Maximilian Giller's avatar Maximilian Giller
Browse files

Merge branch 'master' of gitlab.ibr.cs.tu-bs.de:alg/knowledge-space-wp-plugin

parents 69da702d 514b38a3
No related branches found
No related tags found
No related merge requests found
...@@ -50,11 +50,12 @@ class Graph { ...@@ -50,11 +50,12 @@ class Graph {
this.updateNodeMap(); this.updateNodeMap();
this.addBackground(); this.addBackground();
loadComponents();
// Catch resize events // Catch resize events
getCanvasDivNode().addEventListener("fullscreenchange", this.resize()); document.addEventListener("fullscreenchange", () => this.resize());
window.onresize = G.resize(); window.addEventListener("resize", () => this.resize());
loadComponents();
this.firstTick = false; this.firstTick = false;
} }
} }
...@@ -159,10 +160,13 @@ class Graph { ...@@ -159,10 +160,13 @@ class Graph {
} }
resize() { resize() {
console.log(document.fullscreenElement);
if(document.fullscreenElement == getCanvasDivNode()) { if(document.fullscreenElement == getCanvasDivNode()) {
console.log("Resizing to fullscreen");
this.graph.height(screen.height); this.graph.height(screen.height);
this.graph.width(screen.width); this.graph.width(screen.width);
} else { } else {
console.log("Resizing to column");
this.graph.height(window.innerHeight - 200); this.graph.height(window.innerHeight - 200);
this.graph.width(getWidth()); this.graph.width(getWidth());
} }
...@@ -188,12 +192,6 @@ class Graph { ...@@ -188,12 +192,6 @@ class Graph {
} }
} }
resize() {
this.graph.width(getWidth());
this.graph.height(getHeight());
}
drawNode(node) { drawNode(node) {
// Draw node as label + image // Draw node as label + image
const nodeDiv = document.createElement('div'); const nodeDiv = document.createElement('div');
...@@ -252,8 +250,12 @@ function createFullScreenButton() { ...@@ -252,8 +250,12 @@ function createFullScreenButton() {
overlayNode.className = 'fullscreen_button'; overlayNode.className = 'fullscreen_button';
overlayNode.innerText = 'fullscreen'; overlayNode.innerText = 'fullscreen';
overlayNode.addEventListener("click", function () { overlayNode.addEventListener("click", function () {
console.log("Catched event");
if(getCanvasDivNode().requestFullscreen) { if(getCanvasDivNode().requestFullscreen) {
getCanvasDivNode().requestFullscreen().catch(); getCanvasDivNode().requestFullscreen().then(
() => G.resize()
);
} }
}); });
sceneNode.appendChild(overlayNode); sceneNode.appendChild(overlayNode);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment