| 1 | // Copyright (C) 2016 The Qt Company Ltd. |
|---|---|
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
| 3 | |
| 4 | #include <private/scatteranimation_p.h> |
| 5 | #include <private/scatterchartitem_p.h> |
| 6 | #include <QtCore/QDebug> |
| 7 | |
| 8 | QT_BEGIN_NAMESPACE |
| 9 | |
| 10 | ScatterAnimation::ScatterAnimation(ScatterChartItem *item, int duration, QEasingCurve &curve) |
| 11 | : XYAnimation(item, duration, curve) |
| 12 | { |
| 13 | } |
| 14 | |
| 15 | ScatterAnimation::~ScatterAnimation() |
| 16 | { |
| 17 | } |
| 18 | |
| 19 | void ScatterAnimation::updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState) |
| 20 | { |
| 21 | XYAnimation::updateState(newState, oldState); |
| 22 | |
| 23 | if (oldState == QAbstractAnimation::Running && newState == QAbstractAnimation::Stopped |
| 24 | && animationType() == RemovePointAnimation) { |
| 25 | // Removing a point from scatter chart will keep extra marker item after animation stops. |
| 26 | // Also, if the removed point was not the last one in series, points after the removed one |
| 27 | // will report wrong coordinates when clicked. To fix these issues, update geometry after |
| 28 | // point removal animation has finished. |
| 29 | chartItem()->updateGeometry(); |
| 30 | } |
| 31 | } |
| 32 | |
| 33 | QT_END_NAMESPACE |
| 34 |
