mirror of https://github.com/AxioDL/boo.git
Additional methods for SScrollDelta
This commit is contained in:
parent
8333536a7c
commit
9658d1372d
|
@ -64,11 +64,11 @@ struct STouchCoord {
|
|||
};
|
||||
|
||||
struct SScrollDelta {
|
||||
double delta[2];
|
||||
bool isFine; /* Use system-scale fine-scroll (for scrollable-trackpads) */
|
||||
double delta[2] = {};
|
||||
bool isFine = false; /* Use system-scale fine-scroll (for scrollable-trackpads) */
|
||||
bool isAccelerated = false; /* System performs acceleration computation */
|
||||
|
||||
SScrollDelta operator+(const SScrollDelta& other) {
|
||||
SScrollDelta operator+(const SScrollDelta& other) const {
|
||||
SScrollDelta ret;
|
||||
ret.delta[0] = delta[0] + other.delta[0];
|
||||
ret.delta[1] = delta[1] + other.delta[1];
|
||||
|
@ -76,6 +76,14 @@ struct SScrollDelta {
|
|||
ret.isAccelerated = isAccelerated || other.isAccelerated;
|
||||
return ret;
|
||||
}
|
||||
SScrollDelta operator-(const SScrollDelta& other) const {
|
||||
SScrollDelta ret;
|
||||
ret.delta[0] = delta[0] - other.delta[0];
|
||||
ret.delta[1] = delta[1] - other.delta[1];
|
||||
ret.isFine = isFine || other.isFine;
|
||||
ret.isAccelerated = isAccelerated || other.isAccelerated;
|
||||
return ret;
|
||||
}
|
||||
SScrollDelta& operator+=(const SScrollDelta& other) {
|
||||
delta[0] += other.delta[0];
|
||||
delta[1] += other.delta[1];
|
||||
|
@ -87,6 +95,7 @@ struct SScrollDelta {
|
|||
delta[0] = 0.0;
|
||||
delta[1] = 0.0;
|
||||
}
|
||||
bool isZero() const { return delta[0] == 0.0 && delta[1] == 0.0; }
|
||||
};
|
||||
|
||||
enum class ESpecialKey {
|
||||
|
|
Loading…
Reference in New Issue