Fixed possible wrong range of clamp in footer of chart widget.

This commit is contained in:
23rd 2023-10-12 16:59:29 +03:00
parent a8cb5419d6
commit b9fa14139a
2 changed files with 5 additions and 2 deletions

View File

@ -420,7 +420,11 @@ void ChartWidget::Footer::moveSide(bool left, float64 x) {
if (_width < (2 * w + mid)) {
return;
} else if (left) {
const auto min = std::clamp(x, 0., _rightSide.min - w - mid);
const auto rightLimit = _rightSide.min - w - mid;
const auto min = std::clamp(
x,
0.,
(rightLimit <= 0) ? _widthBetweenSides : rightLimit);
_leftSide = Limits{ .min = min, .max = min + w };
} else if (!left) {
const auto min = std::clamp(x, _leftSide.max + mid, _width);

View File

@ -742,7 +742,6 @@ void StackLinearChartView::paintPieText(QPainter &p, const PaintContext &c) {
: (minScale) + percentage * (maxScale - minScale);
const auto text = parts[k].percentageText;
const auto textW = font->width(text);
const auto textH = font->height;
const auto textXShift = textW / 2.;
const auto textYShift = textW / 2.;
const auto textRectCenter = rectF.center() + QPointF(