Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Settable active state of ToolProxys in gridplot #10107

Closed
chrisbarber opened this issue Jun 2, 2020 · 0 comments · Fixed by #10095
Closed

Settable active state of ToolProxys in gridplot #10107

chrisbarber opened this issue Jun 2, 2020 · 0 comments · Fixed by #10095

Comments

@chrisbarber
Copy link
Contributor

chrisbarber commented Jun 2, 2020

Is your feature request related to a problem? Please describe.

No friendly way of setting the state of the (merged) tools in a gridplot. The underlying tool model's .active states can be changed independently, and this "works," but the change is not reflected in the UI. The ToolProxy objects can be navigated to and their .active states set, but one has to look inside them, at their tools list, and the tool_name properties on them, in order to determine which is which.

See original discussion here: #4567

Describe the solution you'd like

Some convenient lookup for the ToolProxy which is associated with a given merged tool type on a gridplot, or maybe some friendlier interface where it would actually sound like the "merged gridplot box select tool" for example.

Describe alternatives you've considered

This is roughly how it looks, manually hunting down the tool proxies and identifying their types:

const gridplot_toolbar = Bokeh.documents[0].get_model_by_name('plots').children[0].children[0].toolbar;
var bokeh_xpan_tool_proxy = null;
var bokeh_box_select_tool_proxy = null;
for (var tool_proxy of gridplot_toolbar.gestures["pan"].tools) {
    switch (tool_proxy.tools[0].tool_name) {
    case "Pan":
        bokeh_xpan_tool_proxy = tool_proxy;
        break;
    case "Box Select":
        bokeh_box_select_tool_proxy = tool_proxy;
        break;
    }
}

I originally just grabbed the DOM button element for things in the toolbar and .click()ed them. Now with hammerjs being used, I can't find a way to just trigger such an event.

Changing the proxied tool states in tandem and just dealing with the fact it is not reflected in the UI, like when you go through the tool proxies.

Additional context

Here is an example that illustrates the need to go through the tool proxies, which are hard to find (and are probably considered internal and should not be relied on)
#4567 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants