Skip to content
Snippets Groups Projects
Commit ec42c830 authored by Matthias Konitzny's avatar Matthias Konitzny :fire:
Browse files

Improved fullscreen handling

parent 4b1a16dd
No related branches found
No related tags found
No related merge requests found
......@@ -62,7 +62,7 @@ export default class Graph {
//.nodeAutoColorBy("group")
//.nodeColor((node) => this.getNodeColor(node))
//.linkWidth((link) => this.getLinkWidth(link))
.onNodeClick((node) => this.onNodeClick(node))
.onNodeClick((node) => this.onNodeClick(node))
.onNodeHover((node) => {
this.onNodeHover(node);
this.updateHighlight();
......@@ -70,7 +70,9 @@ export default class Graph {
.onLinkHover((link, previousLink) =>
this.onLinkHover(link, previousLink)
)
.onNodeDragEnd((node, translate) => this.onNodeDragEnd(node, translate))
.onNodeDragEnd((node, translate) =>
this.onNodeDragEnd(node, translate)
)
//.linkColor((link) => this.getLinkColor(link))
.linkPositionUpdate((line, { start, end }) =>
this.updateLinkPosition(line, start, end)
......@@ -211,7 +213,13 @@ export default class Graph {
onNodeDragEnd(node, translate) {
// NodeDrag is handled like NodeClick if distance is very short
if(Math.sqrt(Math.pow(translate.x, 2)+ Math.pow(translate.y, 2)+ Math.pow(translate.z, 2)) < DRAG_THRESHOLD_3D) {
if (
Math.sqrt(
Math.pow(translate.x, 2) +
Math.pow(translate.y, 2) +
Math.pow(translate.z, 2)
) < DRAG_THRESHOLD_3D
) {
this.onNodeClick(node);
}
}
......@@ -363,7 +371,7 @@ export default class Graph {
}
resize() {
if (screenfull.isEnabled) {
if (screenfull.isFullscreen) {
this.graph.height(screen.height);
this.graph.width(screen.width);
} else {
......
......@@ -5,7 +5,7 @@ export { getWidth, getHeight, getCanvasDivNode, createDiv, createHTMLElement };
* @returns {number}
*/
function getWidth() {
return document.getElementById("3d-graph").offsetWidth;
return document.getElementById("3d-graph").clientWidth;
}
/**
......
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