Skip to content
Snippets Groups Projects
Commit b227a1d5 authored by Justin van der Krieken's avatar Justin van der Krieken
Browse files

Implement ability to select widgets

parent 5e2cb98a
No related branches found
No related tags found
No related merge requests found
......@@ -18,7 +18,8 @@ class PDFEditor extends React.Component {
examID: null,
page: null,
numPages: null,
widgets: null
widgets: null,
selectedWidget: null,
}
static getDerivedStateFromProps = (newProps, prevState) => {
......@@ -84,6 +85,7 @@ class PDFEditor extends React.Component {
if (selectionBox) {
if (selectionBox.width >= this.props.widgetMinWidth && selectionBox.height >= this.props.widgetMinHeight) {
this.setState({
selectedWidget: this.state.widgets[this.state.page - 1].length,
widgets: update(this.state.widgets, {
[this.state.page - 1]: {
$push: [{
......@@ -217,6 +219,11 @@ class PDFEditor extends React.Component {
})
})
}}
onDragStart={() => {
this.setState({
selectedWidget: index,
})
}}
onDragStop={(e, d) => {
this.setState({
widgets: update(this.state.widgets,{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment