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

Handle scaling correctly during Node movement and dropping #152

Merged
merged 1 commit into from
Jun 28, 2020

Conversation

ajuhos
Copy link

@ajuhos ajuhos commented May 30, 2020

First of all, Storybook has it's on zoom controls and these do not change the scale property of the chart. So using these will break almost everything. This PR do not fix this issue.

This PR fixes the following issue: after changing the scale property of the chart, movement and drop of nodes won't properly reflect the position of the cursor as these do not calculate with the scale property.

What this PR does?

  1. Sets the scale for the Draggable component used by nodes, to allow the react-draggable library to calculate with the scale property. Also uses delta for node movements, instead offset.
  2. On drop, calculates using the scale property. I've also changed the order of operations a bit, as offset and position are totally different things and cannot be calculated in a single step.

@ielijose
Copy link

ielijose commented Jun 4, 2020

I tried it and it works. 👍

@ajuhos ajuhos changed the title Fix #139 Handle scaling correctly during Node movement and dropping Jun 9, 2020
@MrBlenny MrBlenny merged commit 011bd14 into MrBlenny:master Jun 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants