[tw5] Re: How to click on a D3 (svg) object to open a tiddler ?

2018-05-13 Thread Silverfox
Yesss ! I'm so happy it works Thank you so much for giving the solution and also for all the details that contribute to leverage my coding skill. I can go on improving my plugin now... Nicolas -- You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.

[tw5] Re: How to click on a D3 (svg) object to open a tiddler ?

2018-05-13 Thread BurningTreeC
Silverfox, I've tested both variants and they both work. This is your widget with my changes: /*\ title: $:/plugins/tiddlywiki/d3/CirclePackWidget.js D3.js version: V5 plugin type: application/javascript module-type: widget A widget for displaying Zoomable Circle Packing. Derived from

[tw5] Re: How to click on a D3 (svg) object to open a tiddler ?

2018-05-13 Thread BurningTreeC
... I use "invokeActionString" if I pass actions to the widget from within a tiddler like <$mywidget actions="<$action-dosomething/>"/> ... and dispatchEvent() if I want to do what you're trying to accomplish. just look at the widget.js tiddler. all the prototype functions are accessible from

[tw5] Re: How to click on a D3 (svg) object to open a tiddler ?

2018-05-13 Thread BurningTreeC
alternativelly, as I've looked at d3circlepackclick.js now where you have: monAction = "<$action-navigate $to='" +d.data.name +"'/>"; you can use: self.invokeActionString(monAction,self,d,null); instead of dispatchEvent() if you have an action string like your "monAction" -- You received

[tw5] Re: How to click on a D3 (svg) object to open a tiddler ?

2018-05-13 Thread BurningTreeC
I don't know if this works out-of-the-box but I'd try: //this on top: var self = this; //here your code //more code //then this .on("dblclick",function(d){ var targetTiddler = d.data.name; self.dispatchEvent({type: "tm-navigate", navigateTo: targetTiddler)}); }); dispatchEvent() is defined

[tw5] Re: How to click on a D3 (svg) object to open a tiddler ?

2018-05-13 Thread BurningTreeC
... From within your clicclic function you can also: self.dispatchEvent({type: "tm-navigate", navigateTo: targetTiddler)}); -- You received this message because you are subscribed to the Google Groups "TiddlyWiki" group. To unsubscribe from this group and stop receiving emails from it, send an

[tw5] Re: How to click on a D3 (svg) object to open a tiddler ?

2018-05-13 Thread BurningTreeC
Hi Silverfox, I think there are different ways one can accomplish what you want to do. First, I think "this.invokeActions(...)" in your code should be "self.invokeActions(...)" and you should define a variable: var self = this on top of the scope: YourWidget.prototype.render =

[tw5] Re: How to click on a D3 (svg) object to open a tiddler ?

2018-05-13 Thread Silverfox
Wahoo... thank you but honestly I'm a bit lost... On Sunday, May 13, 2018 at 2:01:44 PM UTC+2, Jed Carty wrote: > > Now that I am looking at what I did with SnapSVG it isn't as simple as I > had remembered. > > The simplest way would be to make a widget based on the button widget, for > the

[tw5] Re: How to click on a D3 (svg) object to open a tiddler ?

2018-05-13 Thread Jed Carty
Now that I am looking at what I did with SnapSVG it isn't as simple as I had remembered. The simplest way would be to make a widget based on the button widget, for the snapsvg plugin I made I created a new widget for it that was more general. Unfortunately neither of those is quick and both

[tw5] Re: How to click on a D3 (svg) object to open a tiddler ?

2018-05-13 Thread Silverfox
My skills are definitely too limited... Here is what I've done : D3 double click entent activates a "cliclic" function in this function I wrote : > function cliclic(targetTiddler) { // alert("node " + targetTiddler + " was double clicked");

[tw5] Re: How to click on a D3 (svg) object to open a tiddler ?

2018-05-12 Thread Jed Carty
Look at the handler inside the button widget for an example. https://github.com/Jermolene/TiddlyWiki5/blob/master/core/modules/widgets/button.js or you can look at the invokeActions and invokeActionString in widget.js starting on line 513

[tw5] Re: How to click on a D3 (svg) object to open a tiddler ?

2018-05-12 Thread Silverfox
I'm still looking at a solution to make it work... but I'm stuck for many days with it There are actually 2 different actions systems I don't know how to connect. D3 has it own event detector with instruction like this one: > .on("dblclick",function(d){ cliclic(d.data.name); }); and