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

Move node of the graph #7

Open
watermellon2018 opened this issue Mar 12, 2021 · 5 comments
Open

Move node of the graph #7

watermellon2018 opened this issue Mar 12, 2021 · 5 comments

Comments

@watermellon2018
Copy link

Hello. I want to ask how i can to control move the graph. I mean i want the graph not went beyond the borders. I want to know coordinates the moving node. How can i do it? Thank you

@watermellon2018
Copy link
Author

I wanted to use the event onMouseDown but it not worded
<Graph onMouseDown={test} .... />

@watermellon2018
Copy link
Author

Also I try set event listener on node, but mouseDown / mouseUp not worked for me
Node:
<circle onMouseDown={mouseDownHandle} onMouseMove={moveNode} onMouseUp={mouseUpHandle} fillOpacity={brightness/100} fill={colorNode} stroke={colorNode} r={sizes.radius} onMouseOver={handleMouseOverNode} onMouseLeave={handleMouseLeaveNode} />

@watermellon2018
Copy link
Author

Я не знаю, мой английский понятен или нет, но Вы, вроде, как знаете русский, поэтому проблема в том, что компонент графа находится в некоторой рамке. И при перемещении графа, ему нужно запретить вылезать за его границу. Есть ли способы получать информацию о координатах перемещаемого узла графа? Сам узел определен как некий компонент , в этом компоненте я пытаюсь установить обработчики событий. Но они не срабатывают почему-то (mouseDown/mouseup/mouseMove)

@AlyonaShadrina
Copy link
Owner

Hi! Could you clarify, you need to prevent going out of borders when
a) dragging whole graph area or
b) dragging single node?

For now component can accept only props stated in Readme, so you can't pass any mouse events to it.
And I will have a look if there is something can be done with custom Node events, but I can't promise it will be soon.

@watermellon2018
Copy link
Author

when dragging whole graph area

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

No branches or pull requests

2 participants