kivy-garden / garden.matplotlib

Matplotlib backends using kivy
MIT License
104 stars 50 forks source link

Update backend_kivy.py #66

Closed Florian-GRIMAUD closed 4 years ago

Florian-GRIMAUD commented 4 years ago

While creating an application for my work, I ran into the following problem : If my graph widget based on this backend was integrated under a ScrollView widget, the touch event was missplaced by an offset proportionnal to the widget size. For example, if I tried to use the zoom-rect tool, my rubberband was not being drawn right under my mouse but slightly on the left and slightly lower as well. After some testing I found out that the touch event was not exactly in the window frame of reference anymore because of the ScrollView widget and thus, just letting kivy handle it by using self.to_window(touch.x,touch.y) was enough to solve the problem for my graph widget under a ScrollView widget and without any impact on my graph widgets that were not under one. Hope this helps.