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

lock aspect ratio, fixes #206

This commit is contained in:
irismarie 2020-11-04 18:17:28 +01:00
parent c37a8d067f
commit fb2807a98c
2 changed files with 2 additions and 12 deletions

View file

@ -192,6 +192,7 @@ class WidgetFactory {
widget.customProperties.border_color_opacity = 1;
widget.customProperties.border_width = 2;
widget.customProperties.rotation = 0;
widget.customProperties.lockAspect = true;
break;
default:

View file

@ -49,18 +49,7 @@ class WidgetLine extends Component {
height = this.state.height;
}
// calculate the length of the line
let length = 0;
if (rotation > 0) {
if (width <= height) {
length = width / Math.abs(Math.cos(rad));
}
else {
length = height / Math.abs(Math.sin(rad));
}
} else {
length = width;
}
let length = width;
// calculate line coordinates (in percent)
const x1 = width * 0.5 - 0.5 * Math.cos(rad) * length;