[pitivi] timeline: Scroll to the mouse pointer when scrolling with the mouse
- From: Thibault Saunier <tsaunier src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] timeline: Scroll to the mouse pointer when scrolling with the mouse
- Date: Thu, 11 Jun 2015 09:18:39 +0000 (UTC)
commit 749cbe2430be7708218028bd39f65433ac6fa748
Author: Thibault Saunier <tsaunier gnome org>
Date: Mon May 11 10:16:54 2015 +0200
timeline: Scroll to the mouse pointer when scrolling with the mouse
Fixes T57
pitivi/timeline/timeline.py | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/pitivi/timeline/timeline.py b/pitivi/timeline/timeline.py
index 400c777..4087fdb 100644
--- a/pitivi/timeline/timeline.py
+++ b/pitivi/timeline/timeline.py
@@ -495,12 +495,25 @@ class Timeline(Gtk.EventBox, timelineUtils.Zoomable, Loggable):
elif delta_y < 0:
self.parent.scroll_up()
elif event.get_state() & Gdk.ModifierType.CONTROL_MASK:
+ event_widget = self.get_event_widget(event)
+ x, unused_y = event_widget.translate_coordinates(self, event.x, event.y)
+ x -= CONTROL_WIDTH
+ mouse_position = self.pixelToNs(x + self.hadj.get_value())
+
+ rescroll = False
if delta_y > 0:
+ rescroll = True
timelineUtils.Zoomable.zoomOut()
self.queue_draw()
elif delta_y < 0:
+ rescroll = True
timelineUtils.Zoomable.zoomIn()
self.queue_draw()
+
+ if rescroll:
+ diff = x - (self.layout.get_allocation().width / 2)
+ self.hadj.set_value(self.nsToPixel(mouse_position) - (self.layout.get_allocation().width /
2) - diff)
+
return False
def __buttonPressEventCb(self, unused_widget, event):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]