Skip to content

Commit

Permalink
Merge pull request #382 from revilossor/master
Browse files Browse the repository at this point in the history
fix for 'nested transactions nod supported' issue on drag node
  • Loading branch information
jonnor authored Nov 12, 2018
2 parents bdf9f80 + 5fa9b2f commit 16dff49
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lts/*
2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
language: node_js
node_js:
- node
before_script:
- npm install -g grunt-cli
deploy:
Expand Down
13 changes: 9 additions & 4 deletions the-graph/the-graph-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ module.exports.register = function (context) {
},
componentDidMount: function () {
var domNode = ReactDOM.findDOMNode(this);

// Dragging
domNode.addEventListener("panstart", this.onTrackStart);

Expand Down Expand Up @@ -141,6 +141,11 @@ module.exports.register = function (context) {
if (this.props.export) {
this.props.graph.startTransaction('moveexport');
} else {
if (this.state.moving === true) {
this.setState({ moving: false });
this.setState({ lastTrackX: null, lastTrackY: null });
this.props.graph.endTransaction("movenode");
}
this.props.graph.startTransaction('movenode');
}
this.setState({ moving: true });
Expand Down Expand Up @@ -230,7 +235,7 @@ module.exports.register = function (context) {

// Get mouse position
if (event.gesture) {
event = event.gesture.srcEvent; // unpack hammer.js gesture event
event = event.gesture.srcEvent; // unpack hammer.js gesture event
}
var x = event.x || event.clientX || 0;
var y = event.y || event.clientY || 0;
Expand Down Expand Up @@ -343,7 +348,7 @@ module.exports.register = function (context) {
shouldComponentUpdate: function (nextProps, nextState) {
// Only rerender if changed
return (
nextProps.x !== this.props.x ||
nextProps.x !== this.props.x ||
nextProps.y !== this.props.y ||
nextProps.icon !== this.props.icon ||
nextProps.label !== this.props.label ||
Expand Down Expand Up @@ -471,7 +476,7 @@ module.exports.register = function (context) {

var borderRectOptions = TheGraph.merge(TheGraph.config.node.border, { width: this.props.width, height: this.props.height });
var borderRect = TheGraph.factories.node.createNodeBorderRect.call(this, borderRectOptions);

var innerRectOptions = TheGraph.merge(TheGraph.config.node.innerRect, { width: this.props.width - 6, height: this.props.height - 6 });
var innerRect = TheGraph.factories.node.createNodeInnerRect.call(this, innerRectOptions);

Expand Down

0 comments on commit 16dff49

Please sign in to comment.