@@ -142,10 +142,10 void HorizontalAxis::updateGeometry() | |||||
142 | labelItem->setPos(layout[i] + delta - center.x(), labelItem->pos().y()); |
|
142 | labelItem->setPos(layout[i] + delta - center.x(), labelItem->pos().y()); | |
143 | } |
|
143 | } | |
144 |
|
144 | |||
145 | //label overlap detection |
|
145 | //label overlap detection - compensate one pixel for rounding errors | |
146 | if(labelItem->pos().x() < width || |
|
146 | if(labelItem->pos().x() < width || | |
147 | labelItem->pos().x() < axisRect.left() || |
|
147 | labelItem->pos().x() < (axisRect.left() - 1.0) || | |
148 | labelItem->pos().x() + boundingRect.width() -1 > axisRect.right()){ |
|
148 | (labelItem->pos().x() + boundingRect.width() - 1.0) > axisRect.right()){ | |
149 | labelItem->setVisible(false); |
|
149 | labelItem->setVisible(false); | |
150 | } else { |
|
150 | } else { | |
151 | labelItem->setVisible(true); |
|
151 | labelItem->setVisible(true); |
@@ -152,10 +152,10 void VerticalAxis::updateGeometry() | |||||
152 | labelItem->setPos(labelItem->pos().x() , layout[i] + delta - center.y()); |
|
152 | labelItem->setPos(labelItem->pos().x() , layout[i] + delta - center.y()); | |
153 | } |
|
153 | } | |
154 |
|
154 | |||
155 | //label overlap detection |
|
155 | //label overlap detection - compensate one pixel for rounding errors | |
156 | if(labelItem->pos().y() + boundingRect.height() > height || |
|
156 | if (labelItem->pos().y() + boundingRect.height() > height || | |
157 | labelItem->pos().y() + boundingRect.height()/2 > axisRect.bottom() || |
|
157 | (labelItem->pos().y() + (boundingRect.height() / 2.0) - 1.0) > axisRect.bottom() || | |
158 | labelItem->pos().y() + boundingRect.height()/2 < axisRect.top()) { |
|
158 | labelItem->pos().y() + (boundingRect.height() / 2.0) < (axisRect.top() - 1.0)) { | |
159 | labelItem->setVisible(false); |
|
159 | labelItem->setVisible(false); | |
160 | } |
|
160 | } | |
161 | else { |
|
161 | else { |
General Comments 0
You need to be logged in to leave comments.
Login now