1#ifndef BLOB_TRANSITION_MANAGER_H
2#define BLOB_TRANSITION_MANAGER_H
50 std::vector<QPointF> &velocity,
52 std::vector<QPointF> &control_points,
54 const std::function<
void(std::vector<QPointF> &, QPointF &, std::vector<QPointF> &,
float, QVector2D)> &
56 const std::function<
void(
const QPointF &)> &SetLastWindowPos
void movementStopped()
Emitted when the inactivity counter exceeds a threshold, indicating that window movement has stopped.
void significantMovementDetected()
Emitted when the calculated velocity exceeds a threshold, indicating significant window movement.
std::pmr::deque< WindowMovementSample > GetMovementBuffer() const
Gets a copy of the current movement buffer.
Definition blob_transition_manager.h:130
BlobTransitionManager(QObject *parent=nullptr)
Constructs a BlobTransitionManager.
Definition blob_transition_manager.cpp:5
void IncrementInactivityCounter()
Increments the inactivity counter. Called when no significant movement is detected.
Definition blob_transition_manager.h:112
std::pmr::deque< WindowMovementSample > movement_buffer_
Buffer storing recent window movement samples. Uses polymorphic allocator for potential performance b...
Definition blob_transition_manager.h:152
QVector2D m_smoothed_velocity_
Smoothed velocity vector calculated from the movement buffer.
Definition blob_transition_manager.h:154
qint64 last_movement_time_
Timestamp (ms since epoch) of the last added movement sample.
Definition blob_transition_manager.h:160
static constexpr int kMaxMovementSamples
Maximum number of window movement samples to store in the buffer.
Definition blob_transition_manager.h:150
void AddMovementSample(const QPointF &position, qint64 timestamp)
Adds a new window movement sample to the internal buffer. Removes the oldest sample if the buffer exc...
Definition blob_transition_manager.cpp:94
void SetLastMovementTime(const qint64 time)
Manually sets the timestamp of the last movement.
Definition blob_transition_manager.h:124
void ClearAllMovementBuffers()
Clears the internal movement sample buffer.
Definition blob_transition_manager.h:62
void ResetInactivityCounter()
Resets the inactivity counter to zero. Typically called when movement is detected.
Definition blob_transition_manager.h:101
bool is_moving_
Flag indicating if the window is currently considered to be moving based on processed samples.
Definition blob_transition_manager.h:156
bool IsMoving() const
Checks if the manager currently considers the window to be moving.
Definition blob_transition_manager.h:83
void transitionCompleted()
Emitted when a transition (e.g., to idle state) completes.
void SetMoving(const bool is_moving)
Manually sets the moving state.
Definition blob_transition_manager.h:89
int inactivity_counter_
Counter incremented each frame when no significant movement is detected. Used to determine when movem...
Definition blob_transition_manager.h:158
bool is_resizing_
Flag indicating if the window is currently being resized (prevents movement processing during resize)...
Definition blob_transition_manager.h:162
void SetResizingState(const bool is_resizing)
Sets the flag indicating whether the window is currently being resized. Movement processing is skippe...
Definition blob_transition_manager.h:96
qint64 GetLastMovementTime() const
Gets the timestamp of the last recorded movement sample.
Definition blob_transition_manager.h:118
void ProcessMovementBuffer(std::vector< QPointF > &velocity, QPointF &blob_center, std::vector< QPointF > &control_points, float blob_radius, const std::function< void(std::vector< QPointF > &, QPointF &, std::vector< QPointF > &, float, QVector2D)> &ApplyInertiaForce, const std::function< void(const QPointF &)> &SetLastWindowPos)
Processes the buffered window movement samples to calculate velocity and apply inertia.
Definition blob_transition_manager.cpp:9
int GetInactivityCounter() const
Gets the current value of the inactivity counter.
Definition blob_transition_manager.h:107
void ClearMovementBuffer()
Clears the internal buffer of window movement samples.
Definition blob_transition_manager.cpp:102
Structure representing a single sample of the window's position at a specific time.
Definition blob_transition_manager.h:28
QPointF position
The window's top-left position at the time of the sample.
Definition blob_transition_manager.h:29
qint64 timestamp
The timestamp (milliseconds since epoch) when the sample was taken.
Definition blob_transition_manager.h:30