Making rgl crosstalk-aware

I'm working on making the rgl widget compatible with crosstalk. rgl is somewhat low level, so it is conceivable that a single rgl scene (one instance of the widget) would be displaying several different shared datasets.

I got the event handling working with a single dataset, and now I'm trying to handle more. I've set up several crosstalk.SelectionHandle objects, and now when a change event comes in, I need to figure out which handle sent it.

I've tried comparing event.sender to all of the handles, but comparison using == fails on all of them. The constructor has an optional extraInfo parameter, so I've tried putting an integer value or an object containing an integer value there, but I can't spot it in the event I receive. Does anyone have any example code that uses extraInfo, or more generally, that determines which of several handles triggered a particular event?

Edited to add: I think I've solved this. The extraInfo isn't in the sender, it's in this in the change event handler. On to the next problem...

Edited again: I think I now understand the design. There are two kinds of extraInfo: stuff added when the handle was created, and stuff added when the set() message is sent. Both show up in the message. Both are just Javascript objects, which are basically glued onto the event object received by the onchange event. So if I set the extraInfo to be {foo: "bar"}, then the event e will have an member containing "bar".

1 Like