mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-20 08:07:09 +02:00
Fixed possible wrong range of clamp in footer of chart widget.
This commit is contained in:
parent
a8cb5419d6
commit
b9fa14139a
2 changed files with 5 additions and 2 deletions
|
@ -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);
|
||||
|
|
|
@ -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(
|
||||
|
|
Loading…
Add table
Reference in a new issue