Skip to content
Snippets Groups Projects
Commit e49802d9 authored by Joachim Reif's avatar Joachim Reif
Browse files

Improve position-calculations of connections.

parent 91fc3e1f
No related branches found
No related tags found
No related merge requests found
No preview for this file type
...@@ -127,13 +127,8 @@ function createConnection(firstBoardX, firstBoardY, secondBoardX, secondBoardY, ...@@ -127,13 +127,8 @@ function createConnection(firstBoardX, firstBoardY, secondBoardX, secondBoardY,
let lenLine = Math.sqrt(Math.pow(lenX, 2) + Math.pow(lenY, 2)); let lenLine = Math.sqrt(Math.pow(lenX, 2) + Math.pow(lenY, 2));
let degree = (lenX != 0) ? Math.atan(lenY / lenX) * 180 / Math.PI : 90; let degree = (lenX != 0) ? Math.atan(lenY / lenX) * 180 / Math.PI : 90;
let headerHeight = 100 / window.innerHeight * (document.querySelector("header").clientHeight) let linePositionX = (Math.abs(firstBoardX - secondBoardX) + 0.5) * rowSize + (Math.min(firstBoardX, secondBoardX) * 2 + 1) * rowSize - lenLine / 2;
let halfWidthVH = (100 / window.innerHeight) * (window.innerWidth / 2 + 2) let linePositionY = (Math.abs(firstBoardY - secondBoardY) + 0.5) * rowSize + (Math.min(firstBoardY, secondBoardY) * 2 + 1) * rowSize;
let linePositionX = (Math.abs(firstBoardX - secondBoardX) + 0.5) * rowSize + (Math.min(firstBoardX, secondBoardX) * 2 + 1) * rowSize - lenLine / 2 + halfWidthVH;
let linePositionY = (Math.abs(firstBoardY - secondBoardY) + 0.5) * rowSize + (Math.min(firstBoardY, secondBoardY) * 2 + 1) * rowSize + headerHeight;
// console.log("PositionX: " + linePositionX);
// console.log("PositionY: " + linePositionY);
let line = document.createElement("hr") let line = document.createElement("hr")
let className = "connections c-" + firstBoardX + "-" + firstBoardY + " c-" + secondBoardX + "-" + secondBoardY; let className = "connections c-" + firstBoardX + "-" + firstBoardY + " c-" + secondBoardX + "-" + secondBoardY;
......
...@@ -45,6 +45,7 @@ label { ...@@ -45,6 +45,7 @@ label {
height: 42vh; height: 42vh;
width: 50vw; width: 50vw;
position: relative;
} }
#graph { #graph {
...@@ -113,6 +114,10 @@ footer { ...@@ -113,6 +114,10 @@ footer {
border-radius: 4px; border-radius: 4px;
} }
#matrix hr{
position: absolute;
}
/* ######################### /* #########################
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment