diff --git a/src/containers/visualization.js b/src/containers/visualization.js index 76edf5e..bedb458 100644 --- a/src/containers/visualization.js +++ b/src/containers/visualization.js @@ -23,6 +23,7 @@ import React, { Component } from 'react'; import { Container } from 'flux/utils'; import { Button } from 'react-bootstrap'; import { ContextMenu, MenuItem } from 'react-contextmenu'; +import Slider from 'rc-slider'; import WidgetFactory from '../components/widget-factory'; import ToolboxItem from '../components/toolbox-item'; @@ -60,7 +61,7 @@ class Visualization extends Component { project: prevState.project || null, simulation: prevState.simulation || null, editing: prevState.editing || false, - grid: prevState.grid || false, + grid: prevState.grid || [1, 1], editModal: prevState.editModal || false, modalData: prevState.modalData || null, @@ -332,6 +333,15 @@ class Visualization extends Component { return widget; } + setGrid(value) { + // value 0 would block all widgets, set 1 as 'grid disabled' + if (value === 0) { + value = 1; + } + + this.setState({ grid: [value, value] }); + } + render() { var current_widgets = this.state.visualization.widgets; @@ -344,13 +354,15 @@ class Visualization extends Component { {this.state.editing ? ( -
- - +
+
+ + +
) : (
@@ -359,6 +371,14 @@ class Visualization extends Component {
)} + + {this.state.editing && +
+ Grid: {this.state.grid[0] > 1 ? this.state.grid[0] : 'Disabled'} + + this.setGrid(value)} /> +
+ }
e.preventDefault() }> diff --git a/src/containers/widget.js b/src/containers/widget.js index 18e3d12..2442dc6 100644 --- a/src/containers/widget.js +++ b/src/containers/widget.js @@ -128,11 +128,6 @@ class Widget extends Component { } render() { - - - - //console.log('render widget ' + this.props.data.z + this.props.data.type); - // configure grid var grid = this.props.grid; if (!grid) { @@ -144,6 +139,8 @@ class Widget extends Component { var borderedWidget = false; var element = null; + //console.log(widget.type + ': ' + widget.z); + // dummy is passed to widgets to keep updating them while in edit mode if (widget.type === 'Value') { element = diff --git a/src/styles/app.css b/src/styles/app.css index 33b3280..6ff738f 100644 --- a/src/styles/app.css +++ b/src/styles/app.css @@ -245,7 +245,7 @@ body { .section-header div { display: inline-block; vertical-align: middle; - height: 100%; + /* height: 100%; */ } .section-title { @@ -269,3 +269,13 @@ body { .section-header .glyphicon { font-size: 0.8em; } + +.section-grid-slider { + height: auto !important; + + float: right; +} + +.section-grid-slider .rc-slider { + margin-left: 12px; +}