[pitivi] trackobject: stabilize layer height calculation
- From: Edward Hervey <edwardrv src gnome org>
- To: svn-commits-list gnome org
- Subject: [pitivi] trackobject: stabilize layer height calculation
- Date: Wed, 18 Mar 2009 14:08:59 -0400 (EDT)
commit 65f3ecab684d07a4a00d00c26c17638bdbfe5fcb
Author: Brandon Lewis <brandon_lewis berkeley edu>
Date: Sun Mar 15 14:34:27 2009 -0700
trackobject: stabilize layer height calculation
---
pitivi/ui/controller.py | 3 +++
pitivi/ui/trackobject.py | 7 +++++--
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/pitivi/ui/controller.py b/pitivi/ui/controller.py
index f29413e..29108ac 100644
--- a/pitivi/ui/controller.py
+++ b/pitivi/ui/controller.py
@@ -59,6 +59,9 @@ class Controller(object):
return Point(*self._canvas.convert_from_item_space(item,
*self.from_event(event)))
+ def to_item_space(self, item, point):
+ return Point(*self._canvas.convert_to_item_space(item, *point))
+
def pos(self, item):
bounds = item.get_bounds()
return Point(bounds.x1, bounds.y1)
diff --git a/pitivi/ui/trackobject.py b/pitivi/ui/trackobject.py
index 7f530ac..47ed9f6 100644
--- a/pitivi/ui/trackobject.py
+++ b/pitivi/ui/trackobject.py
@@ -15,6 +15,7 @@ from preview import Preview
import gst
from common import LAYER_HEIGHT_EXPANDED, LAYER_HEIGHT_COLLAPSED
from common import LAYER_SPACING
+from pitivi.ui.point import Point
LEFT_SIDE = gtk.gdk.Cursor(gtk.gdk.LEFT_SIDE)
RIGHT_SIDE = gtk.gdk.Cursor(gtk.gdk.RIGHT_SIDE)
@@ -107,6 +108,8 @@ class TrackObject(View, goocanvas.Group, Zoomable):
def drag_start(self):
TimelineController.drag_start(self)
self._view.raise_(None)
+ tx = self._view.props.parent.get_transform()
+ self._y_offset = tx[5]
def click(self, pos):
mode = 0
@@ -121,8 +124,8 @@ class TrackObject(View, goocanvas.Group, Zoomable):
x, y = pos
self._view.element.setStart(max(self._view.pixelToNs(x), 0),
snap=True)
- priority = int(max(0, 1 + (y // (LAYER_HEIGHT_EXPANDED +
- LAYER_SPACING))))
+ priority = int(max(0, (y - self._y_offset) // (LAYER_HEIGHT_EXPANDED +
+ LAYER_SPACING)))
self._view.element.priority = priority
def __init__(self, element, track, timeline):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]