projectstorm / react-diagrams

a super simple, no-nonsense diagramming library written in react that just works
https://projectstorm.cloud/react-diagrams
MIT License
8.45k stars 1.16k forks source link

DragNewLinkState bug when pressing down with another mouse button while dragging. #1012

Open rlsvarinskis opened 11 months ago

rlsvarinskis commented 11 months ago

If I start dragging a link from a node using my left mouse button and then press the middle or right mouse button, I get the following error in DragNewLinkState.ts:48: this.port.createLinkModel is not a function. The link then ends up hanging without ever having called canLinkToPort or checking for allowLooseLinks.

This seems to be because the DragNewLinkState is still active, but the MOUSE_DOWN action assumes it has just been created by clicking on a port.

There's also a similar bug where if I drag a link over an HTML element that is not part of react-diagrams or outside of the window and release my mouse button, the link also ends up hanging without ever checking canLinkToPort or allowLooseLinks.