animint
animint copied to clipboard
Attempt at multiple clickSelects
Interesting observation. I thought that it should be easy to update the showSelected geoms, but you are right it is more complicated for updating geoms with multiple clickSelects. The correct behavior should be: highlight only the geoms that have all their clickSelects values selected.
So I think it will require changing ifSelectedElse
https://github.com/tdhock/animint/blob/multiple-clickSelects/inst/htmljs/animint.js#L1148-L1149
https://github.com/tdhock/animint/blob/multiple-clickSelects/inst/htmljs/animint.js#L1157-L1158
https://github.com/tdhock/animint/blob/multiple-clickSelects/inst/htmljs/animint.js#L1292-L1306
I guess inside of ifSelectedElse we will need to loop over all the clickSelects variables.
another way to implement ifSelectedElse for geoms with multiple clickSelects would be to keep track of an integer which counts the number of selectors which are activated for each geom, and then we could write something like
d.is_selected = d.count_selected_clickSelects_variables == g_info.number_of_clickSelects_variables
and then we would updated d.is_selected whenever the selection is updated (instead of checking every time we call ifSelectedElse).
That might be simpler to implement than attempting to check the intersection. So long as we're only using the multiple clickSelects statements to select points at the intersection of the variables, we should be fine with that approach. Otherwise, it could get hairy.
On Mon, Nov 24, 2014 at 10:55 AM, Toby Dylan Hocking < [email protected]> wrote:
another way to implement ifSelectedElse for geoms with multiple clickSelects would be to keep track of an integer which counts the number of selectors which are activated for each geom, and then we could write something like
d.is_selected = d.count_selected_clickSelects_variables == g_info.number_of_clickSelects_variables
and then we would updated d.is_selected whenever the selection is updated (instead of checking every time we call ifSelectedElse).
— Reply to this email directly or view it on GitHub https://github.com/tdhock/animint/pull/31#issuecomment-64224876.