Change justification of spectrum right tick label.

This commit is contained in:
Jared Boone 2016-04-21 11:36:07 -07:00
parent e4b86d149c
commit 857fba6309

View File

@ -114,6 +114,7 @@ void FrequencyScale::draw_frequency_ticks(Painter& painter, const Rect r) {
(magnitude_n >= 6) ? "M" :
(magnitude_n >= 3) ? "k" : "";
const std::string label = to_string_dec_uint(tick_offset) + zero_pad + unit;
const auto label_width = style().font.size_of(label).w;
const Coord offset_low = r.left() + x_center - pixel_offset;
const Rect tick_low { offset_low, r.top(), 1, r.height() };
@ -123,7 +124,7 @@ void FrequencyScale::draw_frequency_ticks(Painter& painter, const Rect r) {
const Coord offset_high = r.left() + x_center + pixel_offset;
const Rect tick_high { offset_high, r.top(), 1, r.height() };
painter.fill_rectangle(tick_high, Color::white());
painter.draw_string({ offset_high + 2, r.top() }, style(), label );
painter.draw_string({ offset_high - 2 - label_width, r.top() }, style(), label );
tick_offset += tick_interval;
}