[pitivi: 2/3] zoominterface.py: clamp ratio to minimum of 0 in computeZoomLevel()
- From: Edward Hervey <edwardrv src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi: 2/3] zoominterface.py: clamp ratio to minimum of 0 in computeZoomLevel()
- Date: Tue, 27 Apr 2010 19:19:53 +0000 (UTC)
commit 5a72e5bd97a7fffcd7e8a8da037deadc2ee46e35
Author: Brandon Lewis <brandon_lewis alum berkeley edu>
Date: Tue Apr 20 16:28:40 2010 -0700
zoominterface.py: clamp ratio to minimum of 0 in computeZoomLevel()
closes launchpad bug 549384
pitivi/ui/zoominterface.py | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/pitivi/ui/zoominterface.py b/pitivi/ui/zoominterface.py
index 4456715..0471855 100644
--- a/pitivi/ui/zoominterface.py
+++ b/pitivi/ui/zoominterface.py
@@ -109,8 +109,10 @@ class Zoomable(object):
@classmethod
def computeZoomLevel(cls, ratio):
- return int((((ratio - cls.min_zoom) / cls.zoom_range) ** (1.0/3.0)) *
- cls.zoom_steps)
+ return int((
+ (max(0, ratio - cls.min_zoom) /
+ cls.zoom_range) ** (1.0/3.0)) *
+ cls.zoom_steps)
@classmethod
def pixelToNs(cls, pixel):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]