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

Time Offset Widget: dimensions now fit widget width / height

This commit is contained in:
Laura Fuentes Grau 2020-12-04 15:54:25 +01:00
parent cf402c7ca7
commit e52fdd99a2
3 changed files with 9 additions and 3 deletions

View file

@ -141,6 +141,11 @@ class EditWidgetDialog extends React.Component {
customProperty ? changeObject[parts[0]][parts[1]]= 'default' : changeObject[e.target.id] = 'default';
}
changeObject = this.setMaxWidth(changeObject);
} else if (parts[1]= 'horizontal'){
customProperty ? changeObject[parts[0]][parts[1]] = e.target.value : changeObject[e.target.id] = e.target.value ;
let tempWidth = changeObject.width;
changeObject.width = changeObject.height;
changeObject.height = tempWidth;
} else {
customProperty ? changeObject[parts[0]][parts[1]] = e.target.value : changeObject[e.target.id] = e.target.value ;
}

View file

@ -198,8 +198,8 @@ class WidgetFactory {
case 'TimeOffset':
widget.minWidth = 20;
widget.minHeight = 20;
widget.width = 60;
widget.height = 60;
widget.width = 100;
widget.height = 100;
widget.customProperties.threshold_yellow = 1;
widget.customProperties.threshold_red = 2;
widget.customProperties.icID = 1;

View file

@ -52,7 +52,8 @@ class WidgetTimeOffset extends Component {
return (
<div className="time-offset">
<TrafficLight Horizontal={this.props.widget.customProperties.horizontal}
<span>IC: {this.state.icID}</span>
<TrafficLight Horizontal={this.props.widget.customProperties.horizontal} width={this.props.widget.width} height={this.props.widget.height}
RedOn={this.props.widget.customProperties.threshold_red <= this.state.timeOffset}
YellowOn={(this.props.widget.customProperties.threshold_yellow <= this.state.timeOffset) && (this.state.timeOffset < this.props.widget.customProperties.threshold_red)}
GreenOn={this.state.timeOffset < this.props.widget.customProperties.threshold_yellow}