Custom JS for BoxEditTool

I have a BoxEditTool (tied to a ColumnDataSource), and I would like to register a callback that triggers whenever a rectangle is added/deleted by that BoxEditTool. Specifically, whenever a rectangle is created by the BoxEditTool, I would like to console.log the start and end coordinates of that rectangle. How can I do this?

Edit: I just figured out how to register the callback of the ColumnDataSource, but unfortunately, BoxEditTool does not distinguish between which corner the mouse started on vs which corner the mouse ended on. How can I get this information?

Hi, there,
maybe this will help you move forward.

You add a callback

callb = CustomJS(
    args = {'source': source}, code ="""
        var data = source.data;
        var xP = cb_obj.x;
        var yP = cb_obj.y;
        console.log('mouse coordinates on press:(',xP,',',yP,')')
    """
)

and this line.

p.js_on_event(events.Press, callb)

As the rectangle is constructed by 2 mouse presses, the callback displays in the console the coordinates of the first point on the first press and those of the second point on the second press.