Any way to catch a drag event on PointDrawTool before the drop?


I am trying to use the PointDrawTool of Bokeh in a Panel application. I use it to display “robots” moving across a square space. My problem is that I have a periodic callback that updates the ColumnDataSource used for the plot every 10ms or so, so when I try to drag & drop a robot, this updates causes it to stay in place.

Is there any way to register a robot being dragged so that I can deactivate the periodic callback for the duration of the event? Or is there a better plotting tool for what I am trying to achieve?

I can provide more details if there isn’t enough.

Thanks for the help!

There are events for PanStart, Pan, and PanEnd that you can respond to[1], but be aware that they are generic UI events, and will fire all the time, regardless of whether PointDrawTool is active or not, and regardless of whether an active PointDrawTool currently has any selected renderer elements that it is operating on. I’m not sure if there is a simple or robust way to filter things down to just the subset of pan events you care about.

It’s potentially possible that more fine-grained events could be added, e.g. EditPanStart, that edit tools could use to report when they specifically are starting to handle a pan start. These events could report more information (what tool is doing the handling, what the computed basepoint is, what the renderer selection was, etc.) But this would all be potential future development. so a GitHub Issue to start a discussion would be the first step.

  1. despite the name, they correspond to all “drag” events, these are in fact the same events that the PointDrawTool uses to implement itself. ↩︎

Thanks for the answer!

I’ll look into the Pan events that you mentionned and if it is not sufficient, i’ll consider creating a github issue.