[pitivi: 6/11] add scroll position to mouse coordinate in timeline controller



commit 4efc4d6fdde5c018a9f4b7a7189b157eb6404677
Author: Brandon Lewis <brandon_lewis alum berkeley edu>
Date:   Fri Oct 1 16:22:03 2010 +0100

    add scroll position to mouse coordinate in timeline controller

 pitivi/ui/controller.py  |    3 +++
 pitivi/ui/trackobject.py |    5 +++--
 2 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/pitivi/ui/controller.py b/pitivi/ui/controller.py
index 685cc2f..57bbb55 100644
--- a/pitivi/ui/controller.py
+++ b/pitivi/ui/controller.py
@@ -166,6 +166,9 @@ class Controller(object):
     def _event_common(self, item, target, event):
         if not self._canvas:
             self._canvas = item.get_canvas()
+            # might there be a better way to do this?
+            self._hadj = self._canvas.app.gui.timeline.hadj
+            self._vadj = self._canvas.app.gui.timeline.vadj
         self._last_event = event
         s = event.get_state()
         self._shift_down = s & gtk.gdk.SHIFT_MASK
diff --git a/pitivi/ui/trackobject.py b/pitivi/ui/trackobject.py
index be4088e..95a7e00 100644
--- a/pitivi/ui/trackobject.py
+++ b/pitivi/ui/trackobject.py
@@ -121,8 +121,9 @@ class TimelineController(controller.Controller):
 
     def set_pos(self, item, pos):
         x, y = pos
-        position = Zoomable.pixelToNs(x)
-        priority = int((y - self._y_offset) // (LAYER_HEIGHT_EXPANDED + LAYER_SPACING))
+        position = Zoomable.pixelToNs(x + self._hadj.get_value())
+        priority = int((y - self._y_offset + self._vadj.get_value()) //
+            (LAYER_HEIGHT_EXPANDED + LAYER_SPACING))
         self._context.setMode(self._getMode())
         self._context.editTo(position, priority)
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]