cvfosammmm / Setzer

LaTeX editor written in Python with Gtk
https://www.cvfosammmm.org/setzer/
Other
388 stars 34 forks source link

Add panning with middle mouse button #345

Closed oscfdezdz closed 1 year ago

oscfdezdz commented 1 year ago

Fix #253

cvfosammmm commented 1 year ago

there shouldn't be an extra method for pan, just the existing cursor movement ones. there you can check for the button press / release.

oscfdezdz commented 1 year ago

just the existing cursor movement ones.

I tried using existing on_hover, it wasn't working and checking with GTK inspector, signal is blocked when button is pressed. I'm probably unaware of something here.

cvfosammmm commented 1 year ago

But you can use the existing handler. You can connect more than one signal to this function.

cvfosammmm commented 1 year ago

This still doesn't look good. What I would suggest is this: keep all relevant state (cursor pos, pressed buttons, panning start pos, ...) as an attribute of the controller, update these attributes when events occur (mouse movement, ...). After each update call methods to do things, like update the cursor, move the view, ..., based on the state. These methods should't work with event objects at all. Doing it in this way will make it clearer what the rules are that you want to implement.

oscfdezdz commented 1 year ago

I can't get it to work, so I think I'd better close this.