glue-viz / bqplot-image-gl

Jupyter widget for displaying images with a focus on astronomy
MIT License
19 stars 13 forks source link

Issues with drag events #52

Closed astrofrog closed 3 years ago

astrofrog commented 3 years ago

I am starting from the mouse.ipynb notebook. If I define the interaction as:

interaction = MouseInteraction(x_scale=scales_image['x'], y_scale=scales_image['y'], move_throttle=70,
                               events=['dragmove'])
figure.interaction = interaction
def on_mouse_msg(interaction, data, buffers):
    print(data)

interaction.on_msg(on_mouse_msg)

then dragmove events don't cause the callback to be called. Instead I need to specify all drag events, i.e.

events = ['dragstart', 'dragmove', 'dragend']

for dragmove events to work. That's the first issue.

The second issue is that if I originally set events=['mousemove'], then hover over the image, triggering the callback, and then set:

interaction.events = ['dragend', 'dragmove', 'dragstart']

the callback is not called. This took me a few hours to reproduce as it requires a very specific sequence of events!