[pitivi] ui/timeline: fix scrollToPlayhead() so it doesn't scroll too far. Fixes #573886.
- From: Edward Hervey <edwardrv src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] ui/timeline: fix scrollToPlayhead() so it doesn't scroll too far. Fixes #573886.
- Date: Fri, 30 Jul 2010 08:29:26 +0000 (UTC)
commit a4abbcbebb8c2e0cf496efe7e54646709ecb5e30
Author: Volker Sobek <reklov live com>
Date: Thu Jul 29 19:08:40 2010 +0200
ui/timeline: fix scrollToPlayhead() so it doesn't scroll too far. Fixes #573886.
pitivi/ui/timeline.py | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/pitivi/ui/timeline.py b/pitivi/ui/timeline.py
index 5c15954..97d3983 100644
--- a/pitivi/ui/timeline.py
+++ b/pitivi/ui/timeline.py
@@ -464,11 +464,16 @@ class Timeline(gtk.Table, Loggable, Zoomable):
self._state = state
def scrollToPlayhead(self):
- width = self.get_allocation().width
+ """
+ Scroll the current position as close to the center of the view
+ as possible (as close as the timeline canvas allows).
+ """
+ page_size = self.hadj.get_page_size()
+
new_pos = Zoomable.nsToPixel(self._position)
scroll_pos = self.hadj.get_value()
- if (new_pos < scroll_pos) or (new_pos > scroll_pos + width):
- self.scrollToPosition(new_pos - width / 2)
+ if (new_pos > scroll_pos + page_size) or (new_pos < scroll_pos):
+ self.scrollToPosition(min(new_pos - page_size / 2, self.hadj.upper - page_size - 1))
return False
def scrollToPosition(self, position):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]