From 2d14193769fead2c7882c63246b12b0f80df23d5 Mon Sep 17 00:00:00 2001 From: Jens Steinhauser Date: Fri, 4 Sep 2015 18:23:02 +0200 Subject: [PATCH] Ruler: Prevent ticks from disappearing at high zoom levels --- pv/view/ruler.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pv/view/ruler.cpp b/pv/view/ruler.cpp index cd72a179..ab08a320 100644 --- a/pv/view/ruler.cpp +++ b/pv/view/ruler.cpp @@ -198,8 +198,7 @@ Ruler::TickPositions Ruler::calculate_tick_positions( { TickPositions tp; - const double minor_period = - (major_period / MinorTickSubdivision).convert_to(); + const pv::util::Timestamp minor_period = major_period / MinorTickSubdivision; const pv::util::Timestamp first_major_division = floor(offset / major_period); const pv::util::Timestamp first_minor_division = ceil(offset / minor_period); const pv::util::Timestamp t0 = first_major_division * major_period; @@ -214,7 +213,7 @@ Ruler::TickPositions Ruler::calculate_tick_positions( x = ((t - offset) / scale).convert_to(); if (division % MinorTickSubdivision == 0) { - // Recalculate 't' without using 'minor_period' which is of type double. + // Recalculate 't' without using 'minor_period' which is a fraction t = t0 + division / MinorTickSubdivision * major_period; tp.major.emplace_back(x, format_function(t)); } else { -- 2.30.2