engri-1101 / vinal

A Python package for visualizing graph algorithms.
https://vinal.henryrobbins.com
Other
3 stars 0 forks source link

BUG: create_tour_plot fails if you move mouse too quickly #6

Closed henryrobbins closed 2 hours ago

henryrobbins commented 2 hours ago

During manual tour creation, the visualization breaks if you move your mouse too quickly and you are forced to restart.

https://github.com/user-attachments/assets/6f019bcc-0089-4ac7-861d-a77341e080f8

henryrobbins commented 2 hours ago

Initial Investigation

For each visualization, _add_tools is used to set the JavaScript callbacks for both the "on click" and "hover" events. The hover event callback is hard-coded to set source.data['last_index'] = cb_data.index.indices[0] (i.e. update the last_index variable to be the node that is currently being hovered over). The on click callback for the create tour plot is the create_tour_on_click function. It's possible last_index is getting updated while create_tour_on_click is still being evaluated? cc @6x9equals42