# Node-red-contrib-ui-svg click and dblclick in same element

**URL:** <https://discourse.nodered.org/t/node-red-contrib-ui-svg-click-and-dblclick-in-same-element/50203>\
**Category:** General\
**Created:** [26 August 2021 10:30 UTC](https://discourse.nodered.org/t/node-red-contrib-ui-svg-click-and-dblclick-in-same-element/50203 "2021-08-26T10:30:22Z")\
**Posts on this page:** 7\
**Page:** 2

<div class="post-metadata">

**Author:** ![samuelbras](https://avatars.discourse-cdn.com/v4/letter/s/74df32/32.png) [@samuelbras](https://discourse.nodered.org/u/samuelbras)\
**Post date:** [30 August 2021 11:29 UTC](https://discourse.nodered.org/t/node-red-contrib-ui-svg-click-and-dblclick-in-same-element/50203/21 "2021-08-30T11:29:30Z")

</div>

Hi @BartButenaers

I have already do some test and the funcionality work fine.  
Of course you notice the delay on the button but this is normal.  
But I found a bug. When this option is enabled, if another button has only the click event, it will not perform its action. as workaround all buttons must have both events (click and doubleclick).

I have modified your example and add a blue circle whith aonly click event, and the event will not fier.

```auto
[{"id":"ab3a4e6a9e4dbcbe","type":"ui_svg_graphics","z":"3a7eabc8.9fb564","group":"28cdac6db4804909","order":3,"width":"10","height":"6","svgString":"<svg x=\"0\" y=\"0\" height=\"100\" viewBox=\"0 0 100 100\" width=\"200\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:svg=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n <circle id=\"red_circle\" cx=\"25\" cy=\"30\" r=\"20\" stroke=\"none\" stroke-width=\"3\" fill=\"red\">\n </circle>\n <circle id=\"green_circle\" cx=\"75\" cy=\"30\" r=\"20\" stroke=\"none\" stroke-width=\"3\" fill=\"green\">\n </circle>\n <circle id=\"blue_circle\" cx=\"125\" cy=\"30\" r=\"20\" stroke=\"none\" stroke-width=\"3\" fill=\"blue\">\n </circle>\n</svg>","clickableShapes":[{"targetId":"#red_circle","action":"dblclick","payload":"#red_circle","payloadType":"str","topic":"DOUBLE_CLICK"},{"targetId":"#red_circle","action":"click","payload":"#red_circle","payloadType":"str","topic":"SINGLE_CLICK"}],"javascriptHandlers":[{"selector":"#green_circle","action":"click","sourceCode":"$scope.send({topic:\"JS_SINGLE_CLICK\"})"},{"selector":"#green_circle","action":"dblclick","sourceCode":"$scope.send({topic:\"JS_DOUBLE_CLICK\"})"},{"selector":"#blue_circle","action":"click","sourceCode":"$scope.send({topic:\"JS_SINGLE_CLICK_BLUE\"})"}],"smilAnimations":[],"bindings":[],"showCoordinates":false,"autoFormatAfterEdit":false,"showBrowserErrors":false,"showBrowserEvents":false,"enableJsDebugging":false,"sendMsgWhenLoaded":false,"noClickWhenDblClick":true,"outputField":"payload","editorUrl":"//drawsvg.org/drawsvg.html","directory":"","panning":"disabled","zooming":"disabled","panOnlyWhenZoomed":false,"doubleClickZoomEnabled":false,"mouseWheelZoomEnabled":false,"dblClickZoomPercentage":150,"name":"","x":1820,"y":980,"wires":[["b56c29126796965e"]]},{"id":"b56c29126796965e","type":"debug","z":"3a7eabc8.9fb564","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"topic","targetType":"msg","statusVal":"","statusType":"auto","x":2010,"y":980,"wires":[]},{"id":"28cdac6db4804909","type":"ui_group","name":"External SVG file demo","tab":"3667e211.c08f0e","order":1,"disp":true,"width":"10","collapse":false},{"id":"3667e211.c08f0e","type":"ui_tab","name":"Showcase","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

```

But if you add the double click event, it will work.

---

<div class="post-metadata">

**Author:** ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)\
**Post date:** [30 August 2021 11:42 UTC](https://discourse.nodered.org/t/node-red-contrib-ui-svg-click-and-dblclick-in-same-element/50203/22 "2021-08-30T11:42:54Z")

</div>

@samuelbras,  
You were lucky that I was at this very moment shortly on my computer at home 😉  
I have pushed a fix to Github.  
Can you please reinstall and try again?

---

<div class="post-metadata">

**Author:** ![samuelbras](https://avatars.discourse-cdn.com/v4/letter/s/74df32/32.png) [@samuelbras](https://discourse.nodered.org/u/samuelbras)\
**Post date:** [30 August 2021 11:45 UTC](https://discourse.nodered.org/t/node-red-contrib-ui-svg-click-and-dblclick-in-same-element/50203/23 "2021-08-30T11:45:54Z")

</div>

@BartButenaers,

your GuitHub?  
npm install bartbutenaers/node-red-contrib-ui-svg?

---

<div class="post-metadata">

**Author:** ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)\
**Post date:** [30 August 2021 11:47 UTC](https://discourse.nodered.org/t/node-red-contrib-ui-svg-click-and-dblclick-in-same-element/50203/24 "2021-08-30T11:47:28Z")

</div>

Yes that is correct.

---

<div class="post-metadata">

**Author:** ![samuelbras](https://avatars.discourse-cdn.com/v4/letter/s/74df32/32.png) [@samuelbras](https://discourse.nodered.org/u/samuelbras)\
**Post date:** [30 August 2021 12:22 UTC](https://discourse.nodered.org/t/node-red-contrib-ui-svg-click-and-dblclick-in-same-element/50203/25 "2021-08-30T12:22:59Z")

</div>

@BartButenaers,

By my test it work fine, thanks

---

<div class="post-metadata">

**Author:** ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)\
**Post date:** [30 August 2021 21:04 UTC](https://discourse.nodered.org/t/node-red-contrib-ui-svg-click-and-dblclick-in-same-element/50203/26 "2021-08-30T21:04:13Z")

</div>

@samuelbras,

Version _ **2.2.4** _ is now available in the Node-RED palette:

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/9/e953be4c89df5f01e0e2eb070a656aef750ad733.png)

P.S. I have now also started using Github [releases](https://github.com/bartbutenaers/node-red-contrib-ui-svg/releases), to make it easier for users to follow up what has changed.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [29 October 2021 21:04 UTC](https://discourse.nodered.org/t/node-red-contrib-ui-svg-click-and-dblclick-in-same-element/50203/27 "2021-10-29T21:04:54Z")

</div>

Closed on 29 October 2021 21:04 UTC

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.

[Previous page](https://discourse.nodered.org/t/node-red-contrib-ui-svg-click-and-dblclick-in-same-element/50203.md?page=1)
