From 0a538201063a2f55c5b481af08c2435d782af299 Mon Sep 17 00:00:00 2001 From: "james.k.crook@gmail.com" Date: Sun, 6 May 2012 17:47:52 +0000 Subject: [PATCH] Fix for ruler elements disappearing at high zoom beyond time 5:57:54.84. --- src/widgets/Ruler.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/widgets/Ruler.cpp b/src/widgets/Ruler.cpp index 913e75028..2ea1268fb 100644 --- a/src/widgets/Ruler.cpp +++ b/src/widgets/Ruler.cpp @@ -1047,7 +1047,9 @@ void Ruler::Update(TimeTrack* timetrack)// Envelope *speedEnv, long minSpeed, lo // Major ticks double d = mMin - UPP/2; double lastD = d; - int majorInt = (int)floor(sg * d / mMajor); + // using ints for majorint doesn't work, as + // majorint will overflow and be negative at high zoom. + double majorInt = floor(sg * d / mMajor); i = -1; while(i <= mLength) { double warpfactor; @@ -1060,8 +1062,8 @@ void Ruler::Update(TimeTrack* timetrack)// Envelope *speedEnv, long minSpeed, lo lastD = d; d += UPP/warpfactor; - if ((int)floor(sg * d / mMajor) > majorInt) { - majorInt = (int)floor(sg * d / mMajor); + if (floor(sg * d / mMajor) > majorInt) { + majorInt = floor(sg * d / mMajor); Tick(i, sg * majorInt * mMajor, true, false); } }