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:
parent
ea524f677f
commit
c5724e4195
1 changed files with 5 additions and 9 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue