diff --git a/src/components/widget-factory.js b/src/components/widget-factory.js index c6173bb..ee54fa1 100644 --- a/src/components/widget-factory.js +++ b/src/components/widget-factory.js @@ -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': diff --git a/src/components/widget-plot.js b/src/components/widget-plot.js index 725e2b7..8333e37 100644 --- a/src/components/widget-plot.js +++ b/src/components/widget-plot.js @@ -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; }, []); } diff --git a/src/containers/widget.js b/src/containers/widget.js index 8b7f094..02b70d2 100644 --- a/src/containers/widget.js +++ b/src/containers/widget.js @@ -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 ( { 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} > this.contextMenuTriggerViaDraggable = c} >