From 70a29089cdb05df27cf50b50fcbc2e53d8975571 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Tue, 2 Jun 2020 22:21:36 +0200 Subject: updating after dragging --- frontend/views/graph/components/graph.editor.js | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'frontend/views/graph/components/graph.editor.js') 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) -- cgit v1.2.3-70-g09d2