mirror of
https://github.com/virtcode/hypr-dynamic-cursors
synced 2025-09-19 16:13:21 +02:00
chore: more abstraction and other refactors
This commit is contained in:
parent
4f0a765aa7
commit
fa7cab8717
9 changed files with 263 additions and 175 deletions
20
src/other/Shake.hpp
Normal file
20
src/other/Shake.hpp
Normal file
|
@ -0,0 +1,20 @@
|
|||
#include <hyprutils/math/Vector2D.hpp>
|
||||
#include <vector>
|
||||
|
||||
using namespace Hyprutils::Math;
|
||||
|
||||
class CShake {
|
||||
public:
|
||||
/* calculates the new zoom factor for the current pos */
|
||||
double update(Vector2D pos);
|
||||
|
||||
private:
|
||||
/* tracks the global software lock issued by cursor shaking */
|
||||
bool software = false;
|
||||
|
||||
/* ringbuffer for last samples */
|
||||
std::vector<Vector2D> samples;
|
||||
/* we also store the distance for each sample to the last, so we do only compute this once */
|
||||
std::vector<double> samples_distance;
|
||||
int samples_index = 0;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue