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

draw line between nodes. #68

Open
hotpeperoncino opened this issue May 10, 2017 · 7 comments
Open

draw line between nodes. #68

hotpeperoncino opened this issue May 10, 2017 · 7 comments

Comments

@hotpeperoncino
Copy link

I want to draw lines between two nodes randomly in order to represent meaningful relation.
Can I have an idea where to be modified in the source?

@hotpeperoncino
Copy link
Author

hotpeperoncino commented May 10, 2017

http://romiz.altervista.org/custom/images/romiz_conversion_mind.jpg
It is called "arrow link"? it means the red line in the image.

@hotpeperoncino
Copy link
Author

In https://github.com/hotpeperoncino/my-mind, I can specify two nodes with arrowlink attributes.
But I cannot draw line between them (layout.tree.js). Can I have a suggestion?

@ondras
Copy link
Owner

ondras commented May 11, 2017

Hi @hotpeperoncino,

I want to draw lines between two nodes randomly in order to represent meaningful relation.
Can I have an idea where to be modified in the source?

I would start with the update function in https://github.com/ondras/my-mind/blob/master/src/layout.tree.js#L20, which is called when an item needs to be redrawn. This is probably the right time and place to draw your arrow links.

Unfortunately, there is no suitable <canvas> node available for arrow links. Every map node has its own canvas for its lines, but these canvases are too small and to local for your needs. I suggest creating a separate canvas for every arrow link, or drawing arrowlinks using a different technology (SVG <path> ?).

@hotpeperoncino
Copy link
Author

Thank you for your information.
I noticed the small canvas problem. It seems too difficult for me to implement..
I'd like to think about another solution.

@ZiadJ
Copy link

ZiadJ commented Mar 21, 2019

I'm thinking of creating a fullscreen canvas in the background where arrow links from all the node canvases would be drawn. I'm going to have to be able to access the absolute positions for each related nodes though to begin with and I'm not sure how to do that. PS I'm new to canvas coding and my-mind itself.

@ZiadJ
Copy link

ZiadJ commented Mar 22, 2019

Turns out the nodes themselves are not canvas based, as I had imagined, so their positions can be obtained directly from the DOM.

Now I'm trying to figure out how to draw a line(preferably curved & arrowed) between two points on main canvas from the existing api. Any ideas anyone on the functions available for that?

@ondras
Copy link
Owner

ondras commented Mar 27, 2019

Curved lines are ideally drawn via the beginPath() API, preferrably using the bezierCurveTo() commands.

Arrows are typically implemented as small triangles; these are trivially done using a filled (polygonal) path.

ondras added a commit that referenced this issue Oct 4, 2022
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

3 participants