Skip to content

Commit cad44a0

Browse files
committed
fix another dumb tick label bug
1 parent 7dac061 commit cad44a0

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

QtSLiM/QtSLiMChromosomeWidget.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1326,9 +1326,11 @@ void QtSLiMChromosomeWidget::drawTicksInContentRect(QRect contentRect, __attribu
13261326

13271327
painter.drawText(QRect(tickLabelX, tickLabelY, 0, 0), textFlags, tickLabel);
13281328

1329-
// keep track of where we have drawn text, to avoid overlap
1330-
leftmostNotDrawn = std::max(leftmostNotDrawn, labelRightEdge);
1331-
rightmostNotDrawn = std::min(rightmostNotDrawn, labelLeftEdge);
1329+
// keep track of where we have drawn text, to avoid overlap; this is a bit tricky because we draw the ticks out of order
1330+
if (simpleTickIndex == 1)
1331+
leftmostNotDrawn = std::max(leftmostNotDrawn, labelRightEdge); // changes only when we draw the left-edge tick
1332+
if (simpleTickIndex != 1)
1333+
rightmostNotDrawn = std::min(rightmostNotDrawn, labelLeftEdge); // does not change when we draw the left-edge tick
13321334
}
13331335

13341336
painter.restore();

0 commit comments

Comments
 (0)