From: Jens Steinhauser Date: Fri, 4 Sep 2015 16:23:02 +0000 (+0200) Subject: Ruler: Prevent ticks from disappearing at high zoom levels X-Git-Tag: pulseview-0.3.0~111 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=2d14193769fead2c7882c63246b12b0f80df23d5;p=pulseview.git Ruler: Prevent ticks from disappearing at high zoom levels --- 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 {