PolyDraw and PolyEdit broken (as of 3.4?)

Posting here before making a github issue to make sure I’m not taking crazy pills… I am using 3.4, so may be fixed in more recent versions but I haven’t seen a relevant issue so I’m a bit doubtful… but it appears both the PolyDraw and PolyEdit tools no longer work. See Plot tools — Bokeh 3.4.0 Documentation and try using the embedded PolyDraw/PolyEdit figures, or use the following MRE, taken from the examples:

from bokeh.plotting import figure, output_file, show
from bokeh.models import PolyDrawTool

output_file("tools_poly_draw.html")

p = figure(x_range=(0, 10), y_range=(0, 10), width=400, height=400,
           title='Poly Draw Tool')

p1 = p.patches([[2, 5, 8]], [[2, 8, 2]], line_width=0, alpha=0.4)
l1 = p.multi_line([[1, 9]], [[5, 5]], line_width=5, alpha=0.4, color='red')

draw_tool_p1 = PolyDrawTool(renderers=[p1])
draw_tool_l1 = PolyDrawTool(renderers=[l1])
p.add_tools(draw_tool_p1, draw_tool_l1)
p.toolbar.active_drag = draw_tool_p1

show(p)

Tapping/Doubletapping seems to have no effect. Am I missing something obvious?

Thanks…

The examples in the latest docs seem to be working for me in safari, though I will agree the interaction is not very intuitive. In particular, for the edit tool, there is no visual indication that anything is happening at all until there are three vertices, which requires a long press, a move, a tap, and another move. I don’t use these tools often myself, so I am not sure if there used to be some better visual indications and this is a recent regression, or if the operations have always been so opaque. Please feel free to open an issue around improving their discoverability (or if they are legitimately not working on some other browser).

Oh man, it’s the “click and hold” to initiate drawing a polygon that changed at some point? It used to be DoubleTap?

This messes up a few things on my end (see Draw/edit tools inconsistent with CDS stream/patch [BUG] · Issue #12780 · bokeh/bokeh · GitHub from a while back), where I kinda backdoor my way into detecting “start-draw” and “end-draw” events to trigger some CustomJS.

Any suggestions on how to detect (and trigger CustomJS) under this change?

Thanks…

I guess this was changed in Add support for zero-latency tap by mattpap · Pull Request #12831 · bokeh/bokeh · GitHub because issues related to tap event latency had become untenable.

Since this change has affected you directly, I’d actually suggest opening a new Github Development Discussion and we can ping the other core devs. I don’t have any offhand suggestions for the events but they might. Also this can be a reminder to update the 3.4 migration guide with information about this change, which apparently never happened.

Ok, I will raise a GH discussion when I have bandwidth. It looks like Press and PressUp events are detectable now so in theory I should be able to modify my workaround based on those events (e.g. instead of detecting double tap, detect Press/Pressup instead)…

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.