|
Wavelength
Privacy-focused, cross-platform, and open-source communication application
|
Implements the Resizing state behavior for the Blob animation. More...
#include <resizing_state.h>
Public Member Functions | |
| void | Apply (std::vector< QPointF > &control_points, std::vector< QPointF > &velocity, QPointF &blob_center, const BlobConfig::BlobParameters ¶ms) override |
| Applies state-specific logic. Currently empty for ResizingState. The primary logic for this state is handled in HandleResize(). | |
| void | ApplyForce (const QVector2D &force, std::vector< QPointF > &velocity, QPointF &blob_center, const std::vector< QPointF > &control_points, double blob_radius) override |
| Applies an external force to the blob, similar to the Moving state. The force applied to each control point's velocity is scaled based on its distance from the center. A portion of the force is also applied directly to the blob's center position. This is used by HandleResize to apply a force based on the size change. | |
| void | HandleResize (std::vector< QPointF > &control_points, std::vector< QPointF > &target_points, std::vector< QPointF > &velocity, QPointF &blob_center, const QSize &old_size, const QSize &new_size) |
| Handles the logic when a resize event occurs while in this state. Recalculates the blob's center based on the new size, shifts control points and target points accordingly, and applies a force based on the magnitude and direction of the size change. | |
| ResizingState () | |
| Default constructor for ResizingState. | |
Public Member Functions inherited from BlobState | |
| virtual | ~BlobState ()=default |
| Virtual destructor. Ensures proper cleanup when deleting derived state objects through a base class pointer. | |
Implements the Resizing state behavior for the Blob animation.
This state is active when the application window is being resized. It primarily handles the adjustment of the blob's position and applies a force based on the size change to create a visual reaction. The Apply() method in this state currently does nothing, as the main logic is triggered by the HandleResize() method.
| ResizingState::ResizingState | ( | ) |
Default constructor for ResizingState.
|
overridevirtual |
Applies state-specific logic. Currently empty for ResizingState. The primary logic for this state is handled in HandleResize().
| control_points | Reference to the vector of current control point positions. |
| velocity | Reference to the vector of current control point velocities. |
| blob_center | Reference to the blob's center position. |
| params | Blob appearance parameters (read-only). |
Implements BlobState.
|
overridevirtual |
Applies an external force to the blob, similar to the Moving state. The force applied to each control point's velocity is scaled based on its distance from the center. A portion of the force is also applied directly to the blob's center position. This is used by HandleResize to apply a force based on the size change.
| force | The external force vector to apply. |
| velocity | Reference to the vector of current control point velocities (modified). |
| blob_center | Reference to the blob's center position (modified). |
| control_points | Reference to the vector of current control point positions (read-only). |
| blob_radius | The current average radius of the blob (read-only). |
Implements BlobState.
| void ResizingState::HandleResize | ( | std::vector< QPointF > & | control_points, |
| std::vector< QPointF > & | target_points, | ||
| std::vector< QPointF > & | velocity, | ||
| QPointF & | blob_center, | ||
| const QSize & | old_size, | ||
| const QSize & | new_size ) |
Handles the logic when a resize event occurs while in this state. Recalculates the blob's center based on the new size, shifts control points and target points accordingly, and applies a force based on the magnitude and direction of the size change.
| control_points | Reference to the vector of current control point positions (modified). |
| target_points | Reference to the vector of target control point positions (modified). |
| velocity | Reference to the vector of current control point velocities (modified). |
| blob_center | Reference to the blob's center position (modified). |
| old_size | The size of the widget before the resize. |
| new_size | The size of the widget after the resize. |