react-diagrams icon indicating copy to clipboard operation
react-diagrams copied to clipboard

Bug: link is deleted when double click on link or Shift+Click?

Open TranVanKung opened this issue 7 years ago • 6 comments

How to disable Shift+click or any key event to delete a link, because I do not want this function on my app. And another weird thing happen, when I double click on a link, this link will be deleted, how to fix that issue

TranVanKung avatar Dec 04 '19 04:12 TranVanKung

Is there any update how we can override this behaviour??

agarwalishan avatar Sep 08 '20 04:09 agarwalishan

Is there any example on storybook that we're able to reproduce this? I wasn't able to find one, and on my project (logossim) this doesn't seem to happen aswell.

Maybe it's something OS/Browser specific aswell, I don't know.

renato-bohler avatar Sep 08 '20 12:09 renato-bohler

@renato-bohler If you do double right click on right-angle link then you will find it. Also DefaultLink is also having the same behaviour, it's just on clicking/right-clicking a Defaultlink Point is created if you set eng.maxNumberPointsPerLink = 0 then you will find the same behaviour.

agarwalishan avatar Sep 08 '20 15:09 agarwalishan

Right click removing seems to be intentional behavior, it is defined here:

https://github.com/projectstorm/react-diagrams/blob/0deaec246d7fae9d3fc3e8acfaafe3576660f2f8/packages/react-diagrams-defaults/src/link/DefaultLinkSegmentWidget.tsx#L44-L49

To override this behavior, you'll need to implement your custom link widget.

I couldn't delete any link by SHIFT + left clicking :thinking:

renato-bohler avatar Sep 09 '20 12:09 renato-bohler

Okay Thanks and on shift + left Clicking there is no problem

agarwalishan avatar Sep 09 '20 12:09 agarwalishan

thank @renato-bohler . I don't know the reason why the owner of this repo want to delete a link with right click this.props.link.remove();

TranVanKung avatar Sep 09 '20 18:09 TranVanKung