1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/web/ synced 2025-03-09 00:00:01 +01:00

fix: calculate length of line correctly, #206

This commit is contained in:
irismarie 2020-10-22 10:35:56 +02:00
parent ea524f677f
commit c5724e4195

View file

@ -51,19 +51,15 @@ class WidgetLine extends Component {
// calculate the length of the line
let length = 0;
if (width <= height) {
if (rotation > 0) {
length = width / Math.abs(Math.cos(rad));
if (rotation > 0) {
if (width <= height) {
length = width / Math.abs(Math.cos(rad));
}
else {
length = width
}
} else { // height < width
if (rotation > 0) {
length = height / Math.abs(Math.sin(rad));
} else {
length = height;
}
} else {
length = width;
}
// calculate line coordinates (in percent)