question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Is there a way to identify the double click or single click on the Connectors?

See original GitHub issue

First of all great library that I found after trying various libraries such as Syncfusion, Konva, jsPlumb, etc.. I am using the Drawflow within my Vuejs/Nuxtjs application for creating few Nodes and Connectors dynamically.

For each Connector I want to provide some information associated with it, since we do not have the Label option for Connectors, I am using the connectionSelected event to trigger a Bootstrap-modal for the Connector where I can provide some information associated with respective Connector.

Since, I am using the connectionSelected event for triggering the modal, I am unable to delete the Connector because for every click on Connector the modal is opened. Hence, I am looking for an option where I can detect the Double click on Connector so for Double click I can open the Modal and for single click on the Connector I can select and delete it if required.

Is there any way I can achieve the Double and Single click on the Connector? or is there any other work-around that I can try to over come this issue? Really looking for some suggestion or workaround. I could not find any relevant post here on the same so thought of posting.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
jerosolercommented, Nov 15, 2021

Codesanbox is slow but it works.

image

1reaction
jerosolercommented, Nov 14, 2021

Hi! @Aravinda93

You have two ways to do it.

Method 1: One with the events. You can do this with the “click” or “clickEnd” events. The difference is that in clickEnd the changes are already assigned.

Example:

    editor.on('clickEnd', function(e) {
      if (e.detail === 2 && e.target.classList[0] === "main-path") {
        console.log(editor.connection_selected);
      }
    });

Method 2: Overwriting the dblclick function before editor.start() Example:

   editor.dblclick = function(e) {
      if(this.connection_selected != null && this.reroute) {
        this.createReroutePoint(this.connection_selected);
      }
      if(e.target.classList[0] === 'point') {
          this.removeReroutePoint(e.target);
      }
      if (e.detail === 2 && e.target.classList[0] === "main-path") {
        console.log(editor.connection_selected);
      }

    } 

I recommend method 1. Since this way nothing is overwritten.

All of this works as long as you have the value of editor.reroute = false; (For default is false).

Jero

Read more comments on GitHub >

github_iconTop Results From Across the Web

NSEvent; how to distinguish between a single and double click?
So this is a poser. I have an event handling method (mouseUp) that checks the event's click count: switch event.clickCount{ case 1: //...
Read more >
How to differentiate single click event and double click event?
The single click will always have to fire, it's impossible to know if a double click is going to occur unless it actually...
Read more >
Fixing Mouse Click Problems (Left, Right and Double Click)
1. 1. Small screw driver 2. Soldering Iron with some solder 3. Desoldering pump or 9 in 1 DIY Electric Soldering Iron Starter Tool Kit Set...
Read more >
How-to get double-click events in PowerApps
One click should be one-click and double-click should be two clicks. Makes sense right But what when someone keeps clicking?
Read more >
What is the use of a single click and double click of the mouse ...
Open RUN (win+R) · type main.cpl command in run and press enter or click to “ok” · after go to the button tab...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found