How to get correct x,y coordinates when events.PanEnd is called?

Hi, Bokeh team,

Firstly, I have to say bokeh is such a great product. It is amazing and can help to carry out nearly all my ideas.

However, I have got a question when I want to get x,y coordinates after PanEnd called.

Using the demos on website such as:

    p.on_event(events.PanStart, print_event(attributes=point_attributes))
    p.on_event(events.PanEnd,   print_event(attributes=point_attributes))

I can get corret x,y coordinates when PanStart is called, but get wrong x,y when PanEnd is called.

From PanStart(0,100) to real position(100,0), I got PanEnd ~(95.5, 4.5), while from PanStart(0, 0) to (100, 0), I got the correct PanEnd(100, 0). It seams that the result depend on the initial PanStart y.

Can anyone give some hint? Thanks a lot.

@xyuan you will have to be more specific. How exactly do you know that the value is wrong? How are you ensuring that the mouse movements you make (presumably manually, by hand) are so pixel accurate? My first guess is simply that you are not stopping the pan even on the exact pixel you think that you are. Otherwise, what is a precise set of code and procedure that we can try to follow to reproduce? It’s not really possible to say anything else without being able to reproduce or see what you are seeing (so alternatively a video/screen cap might help).

Hi, Bryan,

I did box selection three times,from(0,100),(0,50),(0,0) respectively to (100, 0). The resuls of x,y coordinates after PanEnd are shown aside the pics. Please check.

@xyuan I am afaid am not really sure what to tell you. It’s hard to interpret anything from static images. For instance, in your top image, your mouse cursor is clearly not ended at (100, 0) but of course the static image does not tell the whole story. When I try the similar example in the docs here: js-on-event-callback-triggers it behaves exactly as I would expect.

I tried your given link, the result still seem to be strange. Pic contains the dynamic infos.
After rangesupdate, the panend xy is not same as the pan xy just above rangesupdate.

xyuan

I mean, in above pic, the panend x is expected to be 99.65, but i get 93.73.
Although, I can understand the misunderstanding now. Because the rangesupdate
happended before PanEnd. Maybe this is the setting of Bokeh.
Thanks all the same, I will try to get correct xy in rangesupdate callback.

xyuan

Right: the update to the range depends on the distance traveled, which is the difference between mouse end and mouse start. But pan end reports mouse stop.The distance (and thus the range update) can be anything, depending on where the start was. If range updates are what you are after, then RangesUpdate is definitely the appropriate choice, since Bokeh will already take care of all that (this ultimate goal was not evident from the earlier posts).

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.