showed the event fields are not completely implemented.
Is there a timeframe you would like this implemented by? I can probably complete this in 1-2 days, depending on need.
It looks like things would be easy if we gave you access the w3c-standard MouseEvent object that caused the event. Would you prefer this? What works best for you?
On Tuesday, October 30, 2012 4:02:41 AM UTC-4, Aleksi Kallio wrote:
> Hi all,
> I'm trying to add custom tooltips to Cytoscape.js with qTip2. I found an > example in > http://stackoverflow.com/questions/11307914/fetching-svg-element-from... but > in there mouse coordinates are fetched with oEvent.clientX and oEvent.clientY. > I tried this but the coordinates are undefined.
> Is there a way in cytoscape.js to get event coordinates?
Cytoscape.js uses the jQuery event model: It creates an event object, referencing the original event. If an event is triggered -- say in the renderer -- without passing the original event, then there isn't much information in the event you get in your callback.
You don't really need event information for what you're doing anyway. Inside the handler callback, the reference to `this` is the element that triggered the event. You can do `this.renderedPosition()`, `this.width()`, and so on. This will give you enough information to position the qtip.
I will be creating a Cytoscape.js extension that let's you use qtips directly. So if you can wait a couple of weeks, that may be the better option for you.
On Tuesday, 30 October 2012 at 04:02, Aleksi Kallio wrote:
> Hi all,
> I'm trying to add custom tooltips to Cytoscape.js with qTip2. I found an example in http://stackoverflow.com/questions/11307914/fetching-svg-element-from... but in there mouse coordinates are fetched with oEvent.clientX and oEvent.clientY. I tried this but the coordinates are undefined.
> Is there a way in cytoscape.js to get event coordinates?
> Thanks,
> Aleksi
> -- > You received this message because you are subscribed to the Google Groups "cytoscape-discuss" group.
> To view this discussion on the web visit https://groups.google.com/d/msg/cytoscape-discuss/-/DSBS3ynUYuoJ.
> To post to this group, send email to cytoscape-discuss@googlegroups.com (mailto:cytoscape-discuss@googlegroups.com).
> To unsubscribe from this group, send email to cytoscape-discuss+unsubscribe@googlegroups.com (mailto:cytoscape-discuss+unsubscribe@googlegroups.com).
> For more options, visit this group at http://groups.google.com/group/cytoscape-discuss?hl=en.
> Cytoscape.js uses the jQuery event model: It creates an event object, > referencing the original event. If an event is triggered -- say in the > renderer -- without passing the original event, then there isn't much > information in the event you get in your callback.
> You don't really need event information for what you're doing anyway. > Inside the handler callback, the reference to `this` is the element that > triggered the event. You can do `this.renderedPosition()`, `this.width()`, > and so on. This will give you enough information to position the qtip.
> I will be creating a Cytoscape.js extension that let's you use qtips > directly. So if you can wait a couple of weeks, that may be the better > option for you.
> On Tuesday, 30 October 2012 at 04:02, Aleksi Kallio wrote:
> Hi all,
> I'm trying to add custom tooltips to Cytoscape.js with qTip2. I found an > example in > http://stackoverflow.com/questions/11307914/fetching-svg-element-from... but > in there mouse coordinates are fetched with oEvent.clientX and oEvent.clientY. > I tried this but the coordinates are undefined.
> Is there a way in cytoscape.js to get event coordinates?
> Thanks, > Aleksi
> -- > You received this message because you are subscribed to the Google Groups > "cytoscape-discuss" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/cytoscape-discuss/-/DSBS3ynUYuoJ. > To post to this group, send email to cytoscap...@googlegroups.com<javascript:> > . > To unsubscribe from this group, send email to > cytoscape-disc...@googlegroups.com <javascript:>. > For more options, visit this group at > http://groups.google.com/group/cytoscape-discuss?hl=en.
I'm not sure if you still need it, but it has been fixed. I've commited some changes, and a recent bugfix should also appear on the public docu/demo page http://cytoscape.github.com/cytoscape.js/.
You can verify by opening the console (such as on the docu page) and typing:
On Monday, November 5, 2012 1:30:10 AM UTC-5, Aleksi Kallio wrote:
> Thanks Max,
> this.renderedPosition() worked.
> perjantai, 2. marraskuuta 2012 17.48.51 UTC+2 Max Franz kirjoitti:
>> Cytoscape.js uses the jQuery event model: It creates an event object, >> referencing the original event. If an event is triggered -- say in the >> renderer -- without passing the original event, then there isn't much >> information in the event you get in your callback.
>> You don't really need event information for what you're doing anyway. >> Inside the handler callback, the reference to `this` is the element that >> triggered the event. You can do `this.renderedPosition()`, `this.width()`, >> and so on. This will give you enough information to position the qtip.
>> I will be creating a Cytoscape.js extension that let's you use qtips >> directly. So if you can wait a couple of weeks, that may be the better >> option for you.
>> On Tuesday, 30 October 2012 at 04:02, Aleksi Kallio wrote:
>> Hi all,
>> I'm trying to add custom tooltips to Cytoscape.js with qTip2. I found an >> example in >> http://stackoverflow.com/questions/11307914/fetching-svg-element-from... but >> in there mouse coordinates are fetched with oEvent.clientX and oEvent.clientY. >> I tried this but the coordinates are undefined.
>> Is there a way in cytoscape.js to get event coordinates?
>> Thanks, >> Aleksi
>> -- >> You received this message because you are subscribed to the Google Groups >> "cytoscape-discuss" group. >> To view this discussion on the web visit >> https://groups.google.com/d/msg/cytoscape-discuss/-/DSBS3ynUYuoJ. >> To post to this group, send email to cytoscap...@googlegroups.com. >> To unsubscribe from this group, send email to >> cytoscape-disc...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/cytoscape-discuss?hl=en.