diff options
Diffstat (limited to 'frontend/views/graph')
| -rw-r--r-- | frontend/views/graph/components/graph.editor.js | 21 | ||||
| -rw-r--r-- | frontend/views/graph/graph.actions.js | 4 |
2 files changed, 18 insertions, 7 deletions
diff --git a/frontend/views/graph/components/graph.editor.js b/frontend/views/graph/components/graph.editor.js index d4da2b6..1b2d446 100644 --- a/frontend/views/graph/components/graph.editor.js +++ b/frontend/views/graph/components/graph.editor.js @@ -4,6 +4,8 @@ import { bindActionCreators } from 'redux' import { connect } from 'react-redux' import { session } from '../../../session' +import actions from '../../../actions' +import * as graphActions from '../graph.actions' import { Loader } from '../../../common' import { clamp } from '../../../util' @@ -114,8 +116,8 @@ class GraphEditor extends Component { } handleMouseUp(e) { - const { actions } = this.props - const { dragging, draggingBox, bounds, box } = this.state + // const { actions } = this.props + const { dragging, draggingBox, bounds, box, page } = this.state if (!dragging && !draggingBox) return e.preventDefault() const { x, y, w, h } = box @@ -127,11 +129,16 @@ class GraphEditor extends Component { dragging: false, draggingBox: false, }) - if (w < 10 / bounds.width || h < 10 / bounds.height) { - // too small... - } else { - // update page, settings.x/y + // console.log(page) + const updatedPage = { + ...page, + settings: { + ...page.settings, + x, y, + } } + this.props.graphActions.updateGraphPage(updatedPage) + actions.page.update(updatedPage) } render(){ @@ -182,7 +189,7 @@ const mapStateToProps = state => ({ }) const mapDispatchToProps = dispatch => ({ - // uploadActions: bindActionCreators({ ...uploadActions }, dispatch), + graphActions: bindActionCreators({ ...graphActions }, dispatch), }) export default connect(mapStateToProps, mapDispatchToProps)(GraphEditor) diff --git a/frontend/views/graph/graph.actions.js b/frontend/views/graph/graph.actions.js index 2e6ca54..90d0f96 100644 --- a/frontend/views/graph/graph.actions.js +++ b/frontend/views/graph/graph.actions.js @@ -7,3 +7,7 @@ export const showAddPageForm = () => dispatch => { export const hideAddPageForm = () => dispatch => { dispatch({ type: types.graph.hide_add_page_form }) } + +export const updateGraphPage = page => dispatch => { + dispatch({ type: types.graph.update_graph_page, page }) +} |
