actually fix page zooming this time

This commit is contained in:
Izalia Mae 2023-01-29 11:13:01 -05:00
parent 6874d1c0aa
commit ded8e94e73
2 changed files with 20 additions and 4 deletions

View file

@ -255,7 +255,7 @@ class WebTab(BuilderBase, Gtk.Box):
elif action == 'zoom':
zoom = kwargs.get('zoom')
if not zoom:
if zoom == None:
with self.db.session as s:
zoom = s.get_config('zoom')

View file

@ -490,14 +490,30 @@ class WebviewHandler(ComponentBase):
return False
zoom = webview.get_zoom_level()
direction = event.direction
if event.direction == Gdk.ScrollDirection.DOWN:
if direction == Gdk.ScrollDirection.SMOOTH:
deltas = event.get_scroll_deltas()
if deltas[2] > 0:
direction = Gdk.ScrollDirection.DOWN
elif deltas[2] < 0:
direction = Gdk.ScrollDirection.UP
elif deltas[1] != 0:
direction = Gdk.ScrollDirection.LEFT
else:
return True
if direction == Gdk.ScrollDirection.DOWN:
self.tab.page_action('zoom', zoom=zoom - 0.1)
elif event.direction == Gdk.ScrollDirection.UP:
elif direction == Gdk.ScrollDirection.UP:
self.tab.page_action('zoom', zoom=zoom + 0.1)
elif event.direction in {Gdk.ScrollDirection.LEFT, Gdk.ScrollDirection.RIGHT}:
elif direction in {Gdk.ScrollDirection.LEFT, Gdk.ScrollDirection.RIGHT}:
self.tab.page_action('zoom', zoom=1.0)
return True