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

Add support for optional arrow click handler and pointer cursor (#20) #27

Closed
wants to merge 5 commits into from

Conversation

robvenn
Copy link
Contributor

@robvenn robvenn commented Dec 8, 2018

Came up with the minimal required changes to add support for an onClick handler function prop.
This will automatically add the cursor: pointer to the arrow stroke.
For my use case it doesn't need the same on the arrow marker but just for the stroke (because multiple arrows can end in the same point), so not sure if those should be configurable separately for other use cases.
I also passed by default the markerId, from.id, to.id besides the click event to the handler.
Ideally it should also be possible to style a specific arrow when clicking (to set it as "selected").

const clickHandler = this.props.onClick
? (evt) => {
if (this.props.onClick) {
this.props.onClick(evt, markerId, from.id, to.id);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pierpo could also pass an object like arrowData { marker, from, to } or similar ... and perhaps this same event should also apply to the marker

@pierpo
Copy link
Owner

pierpo commented Dec 12, 2018

Thanks for the PR again 🤗 I'll review it asap!

@pierpo
Copy link
Owner

pierpo commented Dec 18, 2018

@robinvenneman Can you do a stupid example using your feature? (it can be really really stupid, look at the other examples hahaha)
It will help me understand exactly what you want and helps me to check if anything went wrong.
(until I set up proper automated tests)

@pierpo
Copy link
Owner

pierpo commented Jan 2, 2019

@robinvenneman Can you provide me an example or a use case? I'd like to know exactly what's needed to help you with this feature 😊

@robvenn
Copy link
Contributor Author

robvenn commented Jan 5, 2019

@pierpo yeah what I did is just delete the relation when the arrow is clicked, most simple solution for what I was working on but ideally it would be able to do more I guess. I will see next week to find some time to add this example in the demo.

@robvenn
Copy link
Contributor Author

robvenn commented Jan 13, 2019

@pierpo I've added a simple demo with clickable arrows, currently only the line is handling those events. The labels seem to intercept the pointer events on the arrow unless set to 'none' so this feature may require some more fine-tuning.

@pierpo
Copy link
Owner

pierpo commented May 22, 2019

@robinvenneman I am so sorry, I completely forgot to work on this. Is this still a feature you need?

@pierpo pierpo added the enhancement New feature or request label May 22, 2019
@robvenn
Copy link
Contributor Author

robvenn commented May 22, 2019

@pierpo Hey, no problem I also kind of forgot about this :) I implemented this on a private fork for this project I was working on and haven't looked at it since, not even sure if it's still in use right now.

If you think this is a good idea to add to the library then I still want to help out though if you'd like.

@pierpo
Copy link
Owner

pierpo commented May 22, 2019

Haha well I don't know, I wonder if having clickable arrows will happen often 🤔
I would suggest to wait for other people to ask for the feature before integrating it officially 😊

@robvenn
Copy link
Contributor Author

robvenn commented May 23, 2019

Ok, good idea 👍

@hashwin
Copy link
Contributor

hashwin commented Jul 6, 2019

@pierpo definitely have a need for this. The use case here would be in the context of a flow chart.
Allowing you to click on an arrow will allow you to add a new node in that particular position.
Ideally, I should be able to add a '+' button with a click handler that sits on the middle of an arrow.

@hashwin
Copy link
Contributor

hashwin commented Jul 6, 2019

@pierpo definitely have a need for this. The use case here would be in the context of a flow chart.
Allowing you to click on an arrow will allow you to add a new node in that particular position.
Ideally, I should be able to add a '+' button with a click handler that sits on the middle of an arrow.

Though, looks like this is already achievable using the 'label' option on a relation.

@pierpo
Copy link
Owner

pierpo commented Jul 8, 2019

@pierpo definitely have a need for this. The use case here would be in the context of a flow chart.
Allowing you to click on an arrow will allow you to add a new node in that particular position.
Ideally, I should be able to add a '+' button with a click handler that sits on the middle of an arrow.

Though, looks like this is already achievable using the 'label' option on a relation.

Yes indeed 😊 Glad that you found out a simple solution.

@bobby
Copy link

bobby commented Oct 25, 2021

We have a use case that needs clickable arrows, similar to the one described in #108. We need to make the arrows click-selectable to enable various interactions, but our arrows do not have a label. Enabling hover interactions on the arrows would be nice, too.

@bobby
Copy link

bobby commented Oct 25, 2021

My team will be happy to contribute to this PR, too, we're not expecting anything for free!

@pierpo
Copy link
Owner

pierpo commented Sep 30, 2022

Noted. I'll add this to my TODO!

I think we should start over, the PR is too old. The codebase has completely changed 😄

@pierpo
Copy link
Owner

pierpo commented Nov 6, 2022

Closed in favor of #183 😊

@pierpo pierpo closed this Nov 6, 2022
@pierpo
Copy link
Owner

pierpo commented Nov 6, 2022

The PR was too old, so I started over. Thank you @robinv85 for your work, and sorry that it took me SO long to handle this 😴

@fahimsweb
Copy link

The PR was too old, so I started over. Thank you @robinv85 for your work, and sorry that it took me SO long to handle this 😴

Hi, wondering if this feature is still at works?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants