-
Notifications
You must be signed in to change notification settings - Fork 206
bugfix(mouse): Fix bad drag tolerances with high scroll speed factors #2823
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -298,8 +298,55 @@ | |
|
|
||
| Real toAngle() const; ///< turn 2D vector into angle (where angle 0 is down the +x axis) | ||
|
|
||
| void add( const Coord2D *a ) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do these function takes the argument by pointer?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because that is the current standard in these classes here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm a bit skeptical about leaning into a worse option for consistency. Seems to me like it'd just create more work for the eventual refactor.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes is not ideal. Do you want the refactor to happen before adding new functions? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Whatever is most convenient to you. I wouldn't want it to delay this PR. |
||
| { | ||
| x += a->x; | ||
| y += a->y; | ||
| } | ||
|
|
||
| void sub( const Coord2D *a ) | ||
| { | ||
| x -= a->x; | ||
| y -= a->y; | ||
| } | ||
|
|
||
| void operator+=(const Coord2D& a) | ||
| { | ||
| add(&a); | ||
| } | ||
|
|
||
| void operator-=(const Coord2D& a) | ||
| { | ||
| sub(&a); | ||
| } | ||
|
|
||
| void set( const Coord2D *a ) | ||
| { | ||
| x = a->x; | ||
| y = a->y; | ||
| } | ||
|
|
||
| void set( Real ax, Real ay ) | ||
| { | ||
| x = ax; | ||
| y = ay; | ||
| } | ||
| }; | ||
|
|
||
| inline Coord2D operator+(const Coord2D& a, const Coord2D& b) | ||
| { | ||
| Coord2D c = a; | ||
| c.add(&b); | ||
| return c; | ||
| } | ||
|
|
||
| inline Coord2D operator-(const Coord2D& a, const Coord2D& b) | ||
| { | ||
| Coord2D c = a; | ||
| c.sub(&b); | ||
| return c; | ||
| } | ||
|
|
||
| inline Real Coord2D::toAngle() const | ||
| { | ||
| #if RTS_GENERALS /*&& RETAIL_COMPATIBLE_CRC*/ | ||
|
|
@@ -376,8 +423,57 @@ | |
| } | ||
|
|
||
| Int length() const { return (Int)sqrt( (double)(x*x + y*y) ); } | ||
| Real lengthSqr() const { return x*x + y*y; } | ||
|
Check warning on line 426 in Core/Libraries/Include/Lib/BaseType.h
|
||
|
|
||
| void add( const ICoord2D *a ) | ||
| { | ||
| x += a->x; | ||
| y += a->y; | ||
| } | ||
|
|
||
| void sub( const ICoord2D *a ) | ||
| { | ||
| x -= a->x; | ||
| y -= a->y; | ||
| } | ||
|
|
||
| void operator+=(const ICoord2D& a) | ||
| { | ||
| add(&a); | ||
| } | ||
|
|
||
| void operator-=(const ICoord2D& a) | ||
| { | ||
| sub(&a); | ||
| } | ||
|
|
||
| void set( const ICoord2D *a ) | ||
| { | ||
| x = a->x; | ||
| y = a->y; | ||
| } | ||
|
|
||
| void set( Int ax, Int ay ) | ||
| { | ||
| x = ax; | ||
| y = ay; | ||
| } | ||
| }; | ||
|
|
||
| inline ICoord2D operator+(const ICoord2D& a, const ICoord2D& b) | ||
| { | ||
| ICoord2D c = a; | ||
| c.add(&b); | ||
| return c; | ||
| } | ||
|
|
||
| inline ICoord2D operator-(const ICoord2D& a, const ICoord2D& b) | ||
| { | ||
| ICoord2D c = a; | ||
| c.sub(&b); | ||
| return c; | ||
| } | ||
|
|
||
| struct Region2D | ||
| { | ||
| Coord2D lo, hi; // bounds of 2D rectangular region | ||
|
|
@@ -471,6 +567,16 @@ | |
| z -= a->z; | ||
| } | ||
|
|
||
| void operator+=(const Coord3D& a) | ||
| { | ||
| add(&a); | ||
| } | ||
|
|
||
| void operator-=(const Coord3D& a) | ||
| { | ||
| sub(&a); | ||
| } | ||
|
|
||
| void set( const Coord3D *a ) | ||
| { | ||
| x = a->x; | ||
|
|
@@ -507,6 +613,20 @@ | |
| } | ||
| }; | ||
|
|
||
| inline Coord3D operator+(const Coord3D& a, const Coord3D& b) | ||
| { | ||
| Coord3D c = a; | ||
| c.add(&b); | ||
| return c; | ||
| } | ||
|
|
||
| inline Coord3D operator-(const Coord3D& a, const Coord3D& b) | ||
| { | ||
| Coord3D c = a; | ||
| c.sub(&b); | ||
| return c; | ||
| } | ||
|
|
||
| struct ICoord3D | ||
| { | ||
| Int x, y, z; | ||
|
|
@@ -524,8 +644,60 @@ | |
| { | ||
| return x == value && y == value && z == value; | ||
| } | ||
|
|
||
| void add( const ICoord3D *a ) | ||
| { | ||
| x += a->x; | ||
| y += a->y; | ||
| z += a->z; | ||
| } | ||
|
|
||
| void sub( const ICoord3D *a ) | ||
| { | ||
| x -= a->x; | ||
| y -= a->y; | ||
| z -= a->z; | ||
| } | ||
|
|
||
| void operator+=(const ICoord3D& a) | ||
| { | ||
| add(&a); | ||
| } | ||
|
|
||
| void operator-=(const ICoord3D& a) | ||
| { | ||
| sub(&a); | ||
| } | ||
|
|
||
| void set( const ICoord3D *a ) | ||
| { | ||
| x = a->x; | ||
| y = a->y; | ||
| z = a->z; | ||
| } | ||
|
|
||
| void set( Int ax, Int ay, Int az ) | ||
| { | ||
| x = ax; | ||
| y = ay; | ||
| z = az; | ||
| } | ||
| }; | ||
|
|
||
| inline ICoord3D operator+(const ICoord3D& a, const ICoord3D& b) | ||
| { | ||
| ICoord3D c = a; | ||
| c.add(&b); | ||
| return c; | ||
| } | ||
|
|
||
| inline ICoord3D operator-(const ICoord3D& a, const ICoord3D& b) | ||
| { | ||
| ICoord3D c = a; | ||
| c.sub(&b); | ||
| return c; | ||
| } | ||
|
|
||
| // For alternative see AABoxClass | ||
| struct Region3D | ||
| { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.