BoxSelectTool callback for end of selection event

I am trying to figure out event to assign callback for BoxSelectTool. I want to press the tool, then after selection is done, the callback is executed. I do not want to assign callback to source, as I have a tap tool which will be affected. In other words:
box_selection_tool = p1.select(dict(type=BoxSelectTool))[0]
box_selection_tool.js_on_event(PressUp, callback_for_box_selection)

The help is quite confusing:

The end of the drag event indicates the selection region is ready.

Are you after the selection geometry, i.e. the bounds of the box the use made? Or are you after the selection indices, i.e. a list of which points the box “hit”?

I am after the event “end of selection” or anything close to it. SelectionGeometry event affects my TapTool.

The “end of the selection” means when the the user completes a selection, at which point two things are available (via different means):

  • the selections indices of which points were inside the selection region
  • the geometry of the completed selection region

You’ll have to tell me which one you want for me to point you in the right direction.

I fixed it, using selection indices and then checking for length of the array in callback - so i can use both tap and selection box tools. thank you for your time.

1 Like