Skip to content

centerNodeOnMove not working right when it is False #324

Open

Description

@AhmadYoussef

Thank lots for all the hard work. It really is a great library.

I would like to report a bug here:

After I updated the library to version 7.1.0, I got the bug that when I set centerNodeOnMove= false, the node does not move as it should.

So I switched back to V 7.0.0 to solve the problem ... but now when I select a node and click backspace while writing in input, the selected node is directly deleted ... so is there any way to turn off this event in version 7.0.0 using ref?

Otherwise, it would be nice if someone could solve the problem.

Hint:
I have tried all versions after 7.0.0 and I get the same error that the node is moved incorrectly when centerNodeOnMove= false

Activity

  1. AhmadYoussef commented on Aug 9, 2021

    @AhmadYoussef
    Author

    I did today a debug to the code and I found out that this line is rendering while the node is moving

    position.current = { x: data.x || 0, y: data.y || 0, pointerOffset: null };

    so it will rewrite the pointerOffset. so I decided to remove the assigned value and move it to useRef in this line

    const position = useRef();

    and I made it like this :

      const position = useRef({
        x: data.x || 0,
        y: data.y || 0,
        pointerOffset: null,
      });
    

    but I am not sure if this will not work correctly with another function ... but I test it and it looks fine.

    I hope you will fix the problem in the next version.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions