mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-19 07:37:11 +02:00
Fixed mouse selection of pie chart with single part.
This commit is contained in:
parent
b261d23645
commit
6995fcafb5
2 changed files with 5 additions and 1 deletions
|
@ -180,6 +180,7 @@ auto StackLinearChartView::partsPercentage(
|
|||
auto minPercDiffIndex = int(-1);
|
||||
auto roundedPercentagesSum = 0.;
|
||||
|
||||
_pieHasSinglePart = false;
|
||||
for (auto k = 0; k < sums.size(); k++) {
|
||||
const auto rawPercentage = sums[k] / totalSum;
|
||||
const auto rounded = 0.01 * std::round(rawPercentage * 100.);
|
||||
|
@ -198,6 +199,7 @@ auto StackLinearChartView::partsPercentage(
|
|||
|
||||
stackedPercentage += rounded;
|
||||
result.push_back({ rounded, stackedPercentage * 360. - 180. });
|
||||
_pieHasSinglePart |= (rounded == 1.);
|
||||
}
|
||||
{
|
||||
const auto index = (roundedPercentagesSum > 1.)
|
||||
|
@ -787,7 +789,8 @@ void StackLinearChartView::handleMouseMove(
|
|||
}
|
||||
|
||||
bool StackLinearChartView::skipSelectedTranslation() const {
|
||||
return (_entries.size() == (_transition.lines.size() - 1));
|
||||
return _pieHasSinglePart
|
||||
|| (_entries.size() == (_transition.lines.size() - 1));
|
||||
}
|
||||
|
||||
void StackLinearChartView::paintSelectedXIndex(
|
||||
|
|
|
@ -148,6 +148,7 @@ private:
|
|||
};
|
||||
PiePartController _piePartController;
|
||||
Ui::Animations::Basic _piePartAnimation;
|
||||
bool _pieHasSinglePart = false;
|
||||
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue