glue-viz / bqplot-image-gl

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

How to stack MouseInteraction with other interactions? #43

Closed pllim closed 3 years ago

pllim commented 3 years ago

I tried this but it doesn't work. I must have misunderstood how they supposed to stack. My goal is for the following to happen:

Code that does not work:

image = figure.marks[0]  # figure is some bqplot-image-gl object

# This part is taken from example in #37
interaction = MouseInteraction(
    x_scale=image.scales['x'], y_scale=image.scales['y'],
    move_throttle=70)
figure.interaction = interaction
interaction.on_msg(some_callback_function)

# My feeble attempt to stack pan/zoom onto it
from bqplot.interacts import panzoom
interaction.observe(panzoom(figure.marks))
maartenbreddels commented 3 years ago

Yes, it does not compose, which is something I wrote at https://github.com/bqplot/bqplot/pull/1066#issuecomment-781199254 Ideally, we don't want the messages from the frontend to go through the kernel and back again, so I think we want a solution that allows composing these, or have the mouse interactions not be an Interact object, but have support for this at the Figure.