mirror of
https://git.rwth-aachen.de/acs/public/villas/web/
synced 2025-03-30 00:00:13 +01:00
Merge branch 'develop' into feature_contextmenu_editmode
This commit is contained in:
commit
1b787e8a56
4 changed files with 15 additions and 21 deletions
|
@ -299,6 +299,11 @@ class Dashboard extends Component {
|
|||
return;
|
||||
}
|
||||
|
||||
if(data.type === "Image")
|
||||
{
|
||||
data.customProperties.update = true;
|
||||
}
|
||||
|
||||
AppDispatcher.dispatch({
|
||||
type: 'widgets/start-edit',
|
||||
token: this.state.sessionToken,
|
||||
|
|
|
@ -115,6 +115,7 @@ class WidgetFactory {
|
|||
widget.height = 200;
|
||||
widget.customProperties.lockAspect = true;
|
||||
widget.customProperties.file = -1; // ID of image file, -1 means non selected
|
||||
widget.customProperties.update = false;
|
||||
break;
|
||||
case 'Button':
|
||||
widget.minWidth = 100;
|
||||
|
@ -191,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:
|
||||
|
|
|
@ -26,7 +26,6 @@ class WidgetImage extends React.Component {
|
|||
|
||||
this.state = {
|
||||
file: undefined,
|
||||
fileDate: null
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -44,24 +43,23 @@ class WidgetImage extends React.Component {
|
|||
|
||||
componentDidUpdate(prevProps: Readonly<P>, prevState: Readonly<S>, snapshot: SS) {
|
||||
|
||||
if(this.props.widget.customProperties.file === -1){
|
||||
this.props.widget.customProperties.update = false;
|
||||
if(this.state.file !== undefined) this.setState({ file: undefined })
|
||||
}
|
||||
|
||||
let file = this.props.files.find(file => file.id === parseInt(this.props.widget.customProperties.file, 10));
|
||||
|
||||
|
||||
if (file !== undefined) {
|
||||
if (this.state.file === undefined || (this.state.file.id !== file.id) || this.state.fileDate !== file.date) {
|
||||
|
||||
if (this.props.widget.customProperties.update) {
|
||||
this.props.widget.customProperties.update = false;
|
||||
AppDispatcher.dispatch({
|
||||
type: 'files/start-download',
|
||||
data: file.id,
|
||||
token: this.props.token
|
||||
});
|
||||
|
||||
this.setState({ file: file, fileDate: file.date });
|
||||
this.setState({ file: file })
|
||||
}
|
||||
} else if (this.setState.file !== undefined) {
|
||||
console.log("file undefined", file)
|
||||
this.setState({file:undefined})
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue