mirror of
https://git.rwth-aachen.de/acs/public/villas/web/
synced 2025-03-09 00:00:01 +01:00
Fix widget resizing
This commit is contained in:
parent
4d396cb218
commit
f011a5962d
3 changed files with 10 additions and 9 deletions
|
@ -33,8 +33,9 @@ class WidgetFactory {
|
|||
widget.minWidth = 70;
|
||||
widget.minHeight = 20;
|
||||
widget.width = 120;
|
||||
widget.height = 70;
|
||||
widget.height = 30;
|
||||
widget.textSize = 16;
|
||||
widget.name = 'Value';
|
||||
break;
|
||||
case 'Plot':
|
||||
widget.simulator = defaultSimulator;
|
||||
|
@ -48,9 +49,8 @@ class WidgetFactory {
|
|||
break;
|
||||
case 'Table':
|
||||
widget.simulator = defaultSimulator;
|
||||
widget.minWidth = 300;
|
||||
widget.minHeight = 200;
|
||||
widget.width = 400;
|
||||
widget.minWidth = 200;
|
||||
widget.width = 300;
|
||||
widget.height = 200;
|
||||
break;
|
||||
case 'Label':
|
||||
|
|
|
@ -32,9 +32,8 @@ class WidgetPlot extends React.Component {
|
|||
let simulatorData = [];
|
||||
|
||||
// Proceed if a simulation with models and a simulator are available
|
||||
if (simulator && simulation && simulation.models.length > 0) {
|
||||
|
||||
const model = simulation.models.find( model => model.simulator.node === simulator.node && model.simulator.simulator === simulator.simulator );
|
||||
if (simulator && this.props.data[simulator.node] != null && this.props.data[simulator.node][simulator.simulator] != null && simulation && simulation.models.length > 0) {
|
||||
const model = simulation.models.find(model => model.simulator.node === simulator.node && model.simulator.simulator === simulator.simulator);
|
||||
const chosenSignals = this.props.widget.signals;
|
||||
|
||||
simulatorData = this.props.data[simulator.node][simulator.simulator].values.filter((values, index) => (
|
||||
|
@ -46,6 +45,7 @@ class WidgetPlot extends React.Component {
|
|||
if (chosenSignals.includes(signal_index)) {
|
||||
accum.push({ index: signal_index, name: model_signal.name });
|
||||
}
|
||||
|
||||
return accum;
|
||||
}, []);
|
||||
}
|
||||
|
|
|
@ -101,7 +101,6 @@ class Widget extends Component {
|
|||
|
||||
if (x !== data.x || y !== data.y) {
|
||||
this.rnd.updatePosition({ x, y });
|
||||
console.log(this.rnd);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -186,6 +185,8 @@ class Widget extends Component {
|
|||
});
|
||||
|
||||
if (this.props.editing) {
|
||||
const resizing = { bottom: !widget.locked, bottomLeft: !widget.locked, bottomRight: !widget.locked, left: !widget.locked, right: !widget.locked, top: !widget.locked, topLeft: !widget.locked, topRight: !widget.locked};
|
||||
|
||||
return (
|
||||
<Rnd
|
||||
ref={c => { this.rnd = c; }}
|
||||
|
@ -202,7 +203,7 @@ class Widget extends Component {
|
|||
dragGrid={grid}
|
||||
resizeGrid={grid}
|
||||
zIndex={widget.z}
|
||||
enableResizing={!widget.locked}
|
||||
enableResizing={resizing}
|
||||
disableDragging={widget.locked}
|
||||
>
|
||||
<ContextMenuTrigger id={'widgetMenu' + this.props.index} ref={c => this.contextMenuTriggerViaDraggable = c} >
|
||||
|
|
Loading…
Add table
Reference in a new issue