Codebase list mirage / 03e7ae9
Fix scroll commands when it is a smooth scroll event Thomas Ross 3 years ago
1 changed file(s) with 18 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
42494249
42504250 def mousewheel_scrolled(self, widget, event):
42514251 if event.type == Gdk.EventType.SCROLL:
4252 direction = 0
4253 if event.direction == Gdk.ScrollDirection.UP:
4254 direction = 1
4255 elif event.direction == Gdk.ScrollDirection.DOWN:
4256 direction = -1
4257 elif event.direction == Gdk.ScrollDirection.SMOOTH:
4258 __, x_delta, y_delta = event.get_scroll_deltas()
4259 if y_delta > 0:
4260 direction = -1
4261 elif y_delta < 0:
4262 direction = 1
4263
42524264 # Zooming of the image by Ctrl-mousewheel
42534265 if event.get_state() & Gdk.ModifierType.CONTROL_MASK:
4254 if event.direction == Gdk.ScrollDirection.UP:
4266 if direction == 1:
42554267 self.zoom_in(None, None, None)
4256 elif event.direction == Gdk.ScrollDirection.DOWN:
4268 elif direction == -1:
42574269 self.zoom_out(None, None, None)
4270
42584271 return True
42594272 # Navigation of images with mousewheel:
42604273 else:
4261 if event.direction == Gdk.ScrollDirection.UP:
4274 if direction == 1:
42624275 self.goto_prev_image(None, None, None)
4263 elif event.direction == Gdk.ScrollDirection.DOWN:
4276 elif direction == -1:
42644277 self.goto_next_image(None, None, None)
4278
42654279 return True
42664280
42674281 def mouse_moved(self, widget, event):