From ce402018570d058d8ef62d2b92c3fdd075578d9a Mon Sep 17 00:00:00 2001 From: Ricardo Hernandez-Montoya Date: Mon, 27 Mar 2017 18:05:19 +0200 Subject: [PATCH] widgets minimum widths and heights --- src/containers/visualization.js | 13 ++++++++++++- src/containers/widget.js | 4 +++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/containers/visualization.js b/src/containers/visualization.js index cd3bc67..fbc1589 100644 --- a/src/containers/visualization.js +++ b/src/containers/visualization.js @@ -140,24 +140,35 @@ class Visualization extends Component { if (item.name === 'Value') { widget.simulator = this.state.simulation.models[0].simulator; widget.signal = 0; + widget.minWidth = 70; + widget.minHeight = 20; } else if (item.name === 'Plot') { widget.simulator = this.state.simulation.models[0].simulator; widget.signals = [ 0 ]; widget.time = 60; + widget.minWidth = 400; + widget.minHeight = 200; widget.width = 400; widget.height = 200; } else if (item.name === 'Table') { widget.simulator = this.state.simulation.models[0].simulator; + widget.minWidth = 300; + widget.minHeight = 200; widget.width = 400; widget.height = 200; } else if (item.name === 'Label') { - + widget.minWidth = 70; + widget.minHeight = 20; } else if (item.name === 'PlotTable') { widget.simulator = this.state.simulation.models[0].simulator; + widget.minWidth = 400; + widget.minHeight = 200; widget.width = 500; widget.height = 400; widget.time = 60 } else if (item.name === 'Image') { + widget.minWidth = 100; + widget.minHeight = 100; widget.width = 200; widget.height = 200; } diff --git a/src/containers/widget.js b/src/containers/widget.js index f145d28..3e914d5 100644 --- a/src/containers/widget.js +++ b/src/containers/widget.js @@ -109,12 +109,14 @@ class Widget extends Component { } else if (widget.type === 'Image') { element = } - + if (this.props.editing) { return ( { this.rnd = c; }} initial={{ x: Number(widget.x), y: Number(widget.y), width: widget.width, height: widget.height }} + minWidth={ widget.minWidth } + minHeight={ widget.minHeight } bounds={'parent'} className="widget" onResizeStop={(direction, styleSize, clientSize, delta) => this.resizeStop(direction, styleSize, clientSize, delta)}