mirror of
https://hubproxy.babadafafafafa.cn/https://github.com/telegramdesktop/tdesktop
synced 2026-09-21 00:23:56 +08:00
Fixed animation processing after selecting part of pie chart.
This commit is contained in:
@@ -447,6 +447,9 @@ void StackLinearChartView::paintZoomed(QPainter &p, const PaintContext &c) {
|
||||
selectedLineIndex = k;
|
||||
}
|
||||
}
|
||||
if (_piePartController.isFinished()) {
|
||||
_piePartAnimation.stop();
|
||||
}
|
||||
paintPieText(p, c);
|
||||
|
||||
if (selectedLineIndex >= 0) {
|
||||
@@ -591,7 +594,7 @@ void StackLinearChartView::PiePartController::update(int id) {
|
||||
}
|
||||
}
|
||||
|
||||
float64 StackLinearChartView::PiePartController::progress(int id) {
|
||||
float64 StackLinearChartView::PiePartController::progress(int id) const {
|
||||
const auto it = _startedAt.find(id);
|
||||
if (it == end(_startedAt)) {
|
||||
return 0.;
|
||||
@@ -607,7 +610,7 @@ float64 StackLinearChartView::PiePartController::progress(int id) {
|
||||
|
||||
QPointF StackLinearChartView::PiePartController::offset(
|
||||
LineId id,
|
||||
float64 angle) {
|
||||
float64 angle) const {
|
||||
const auto offset = st::statisticsPieChartPartOffset * progress(id);
|
||||
const auto radians = angle * M_PI / 180.;
|
||||
return { std::cos(radians) * offset, std::sin(radians) * offset };
|
||||
@@ -617,6 +620,16 @@ auto StackLinearChartView::PiePartController::selected() const -> LineId {
|
||||
return _selected;
|
||||
}
|
||||
|
||||
bool StackLinearChartView::PiePartController::isFinished() const {
|
||||
for (const auto &[id, _] : _startedAt) {
|
||||
const auto p = progress(id);
|
||||
if (p > 0 && p < 1) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void StackLinearChartView::handleMouseMove(
|
||||
const Data::StatisticalChart &chartData,
|
||||
const QPoint ¢er,
|
||||
|
||||
Reference in New Issue
Block a user