summaryrefslogtreecommitdiffstats
path: root/src/graphs2d/animation/qxyseriesanimation.cpp
blob: 955edc41d8bdb835a13cf5d1f3ad883117dcd4e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only

#include "qxyseriesanimation_p.h"

/*!
    \qmltype XYSeriesAnimation
    \qmlabstract
    \inqmlmodule QtGraphs
    \ingroup graphs_qml_2D
    \inherits GraphAnimation
    \brief An animation type which signifies the animation for points.

    XYSeriesAnimation is based on GraphAnimation and encapsulates all animations available to XYSeries graphs.
    This type initializes the state for its derived animations, but, as it is absract, can not be directly used
    for animations. See the child types GraphPointAnimation and SplineControlAnimation.

    \sa GraphAnimation, GraphPointAnimation, SplineControlAnimation
*/

QXYSeriesAnimation::QXYSeriesAnimation(QObject *parent)
    : QGraphAnimation(parent)
{}

QXYSeriesAnimation::~QXYSeriesAnimation() {}

void QXYSeriesAnimation::updateCurrent(QGraphTransition::TransitionType tt, int index, QPointF point)
{
    m_currentTransitionType = tt;
    m_newPointIndex = index;
    m_newPoint = point;

    if (m_previousTransitionType == QGraphTransition::TransitionType::None)
        m_previousTransitionType = m_currentTransitionType;

    if (animating() == QGraphAnimation::AnimationState::Stopped)
        m_activePointIndex = index;
}