Subscribe for automatic updates: RSS icon RSS

Login icon Sign in for full access | Help icon Help
Advanced search

Pages: [1]
  Reply  |  Print  
Author Topic: Double click, and right click, on an SVG element  (Read 4066 times)
Phil R.
Posts: 4


« on: November 10, 2020, 12:50:32 pm »

Hi,

Can we configure an SVG element so that when we right click on it the menu that is displayed is the same as for a normal form element i.e. the actions with contextMenu="yes".

Also, how do we detect double click on an SVG element, to allow us to trigger an action e.g. edit the element in question.

Thanks,

Phil
Sebastien F.
Four Js
Posts: 465


« Reply #1 on: November 10, 2020, 02:16:35 pm »

Hello,

Are you implementing your own WEBCOMPONENT with SVG inside HTML, or do you use the FGLSVGCANVAS solution?

Seems that double-click events can be detected with SVG onclick event, by check the evt.detail content for number of clicks.
As basis, see FGLDIR/webcomponents/fglsvgcanvas/fglsvgcanvas.html (it implements simple mouse clicks).

For right-mouse clicks, I cant tell.

All of this needs further investigation.

=> Please open a support case.

Seb
Phil R.
Posts: 4


« Reply #2 on: November 10, 2020, 03:33:45 pm »

Hi Seb,

We're using FGLSVGCANVAS, with that webcomponent in an existing form.

Thanks for the tip re the double-click.

Regards,

Phil
Sebastien F.
Four Js
Posts: 465


« Reply #3 on: November 10, 2020, 04:36:38 pm »

Ok if you are using FGLSVGCANVAS then it could be enhanced to support double clicks...
As I wrote please contact your support for the request.
Seb
Sebastien F.
Four Js
Posts: 465


« Reply #4 on: November 10, 2020, 06:48:12 pm »

Phil,

I have started to look at this in our FGLSVGCANVAS solution...

It appears that SVG onclick reacts on double click, and that seems to work with the current FGLSVGCANVAS code.

What is missing is some additional information in the field value, to distinguish simple clicks from double-clicks (event.detail)

We will work on this.

But if you only want to react on double-click, just give it a try (same ON ACTION will be fired) => click or double-click is the same for now.

Reacting on right-click is another story, this depends on the web content viewer / browser...

Seb
Sebastien F.
Four Js
Posts: 465


« Reply #5 on: November 10, 2020, 08:37:13 pm »

In fact, with FGLSVGCANVAS:

Each click will fire an action without any timeout/delay, so when user double-clicks on an SVG element, you get twice the action in the dialog code.

In the FGLDIR/demo/webcomponents/svgbasics demo, add a display below ON ACTION item_selection to see how it reacts...

So you can't make a diff between a regular click or double-click.

=> Must review FGLSVGCANVAS to properly support double clicks => WCG-152

Seb
Phil R.
Posts: 4


« Reply #6 on: November 11, 2020, 10:56:31 am »

Coincidentally, we do already check in ON ACTION item_selection to see when that action was last triggered, and which element it was. If it is the same element, and less than a second ago, we assume a double click. but it's all our own code, and it doesn't do the trick 100%.

So yes, an enhancement to FGLSVGCANVAS would be wonderful.

Thanks Seb!
Sebastien F.
Four Js
Posts: 465


« Reply #7 on: November 11, 2020, 03:56:38 pm »

Hello Phil,
Please if not done yet open a support request so we can properly track this.
Seb
Phil R.
Posts: 4


« Reply #8 on: November 11, 2020, 03:59:07 pm »

Coincidentally I'm working on it right now!
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines