Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onNodePositionChange doesn't always trigger #264

Closed
Kav91 opened this issue Nov 14, 2019 · 2 comments
Closed

onNodePositionChange doesn't always trigger #264

Kav91 opened this issue Nov 14, 2019 · 2 comments

Comments

@Kav91
Copy link
Contributor

Kav91 commented Nov 14, 2019

Describe the bug
As title

To Reproduce
Had staticGraphWithDragAndDrop set to true
Moved node back and forth a few times, then eventually under some weird dragging condition it does not trigger.

Expected behavior
Always trigger when node position changed

Environment:
"dependencies": {
"d3": "^5.12.0",
"prop-types": "^15.6.2",
"react": "^16.6.3",
"react-contexify": "^4.1.1",
"react-d3-graph": "^2.3.0",
"react-dom": "^16.6.3",
"react-select": "^3.0.8",
"semantic-ui-react": "^0.88.1"
},

As I was shuffling my way through the code, I noticed this part that the deltas somehow can be 0
image

To verify things were changing and moving, I console logged "draggedNode" during "_onDragMove" and could definitely confirm the coordinates being updated as it was being dragged.

Logging the drag move coordinates out:
Situation where it does NOT work:
image

Situation where it does work:
image

From repeating multiple times, the one observation I see is that when it doesn't work is that the last 3 coordinates during a drag move are the same.
Whereas when it does work it is just the last two coordinates that are the same, and does work.

Is there an underlying purpose on checking this delta, or could we safely remove that validation?

@danielcaldas
Copy link
Owner

Looking into it now, I really don't see a problem to remove the delta validation. It will be way more transparent to the client; even if the coordinates don't change it is still cleaner to execute the callback onNodePositionChange 🙂 Feel free to submit a PR

@danielcaldas
Copy link
Owner

Fixed with #266

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants