Four Js Development Tools Forum

Discussions by product => Genero BDL => Topic started by: Phil R. on November 10, 2020, 12:50:32 pm



Title: Double click, and right click, on an SVG element
Post by: Phil R. 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


Title: Re: Double click, and right click, on an SVG element
Post by: Sebastien F. 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


Title: Re: Double click, and right click, on an SVG element
Post by: Phil R. 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


Title: Re: Double click, and right click, on an SVG element
Post by: Sebastien F. 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


Title: Re: Double click, and right click, on an SVG element
Post by: Sebastien F. 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


Title: Re: Double click, and right click, on an SVG element
Post by: Sebastien F. 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


Title: Re: Double click, and right click, on an SVG element
Post by: Phil R. 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!


Title: Re: Double click, and right click, on an SVG element
Post by: Sebastien F. 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


Title: Re: Double click, and right click, on an SVG element
Post by: Phil R. on November 11, 2020, 03:59:07 pm
Coincidentally I'm working on it right now!