History

Initialise delta field in WheelEvent, add deltaX and deltaY fields

Ada committed 7 months ago

Commit b00d2b51 parent 384cf352 files · +13 −4Browse files

Showing the changes to libraries/script-engine/src/WheelEvent.cpp (1 of 2 files). Show all

Unified · Split

libraries/script-engine/src/WheelEvent.cpp+11−3
@@ -19,7 +19,8 @@ · 18 unmodified lines
19WheelEvent::WheelEvent() :19WheelEvent::WheelEvent() :
20 x(0.0f),20 x(0.0f),
21 y(0.0f),21 y(0.0f),
22 delta(0.0f),22 deltaX(0.0f),
23 deltaY(0.0f),
23 orientation("UNKNOwN"),24 orientation("UNKNOwN"),
24 isLeftButton(false),25 isLeftButton(false),
25 isRightButton(false),26 isRightButton(false),
@@ -42,6 +43,9 @@ WheelEvent::WheelEvent(const QWheelEvent& event) { · 16 unmodified lines
42 orientation = "VERTICAL";43 orientation = "VERTICAL";
43 }44 }
44 45
46 deltaX = event.angleDelta().x();
47 deltaY = event.angleDelta().y();
48
45 // button pressed state49 // button pressed state
46 isLeftButton = (event.buttons().testFlag(Qt::LeftButton));50 isLeftButton = (event.buttons().testFlag(Qt::LeftButton));
47 isRightButton = (event.buttons().testFlag(Qt::RightButton));51 isRightButton = (event.buttons().testFlag(Qt::RightButton));
@@ -60,7 +64,9 @@ WheelEvent::WheelEvent(const QWheelEvent& event) { · 12 unmodified lines
60 * @property {number} x - Integer x-coordinate of the event on the Interface window or HMD HUD.64 * @property {number} x - Integer x-coordinate of the event on the Interface window or HMD HUD.
61 * @property {number} y - Integer y-coordinate of the event on the Interface window or HMD HUD.65 * @property {number} y - Integer y-coordinate of the event on the Interface window or HMD HUD.
62 * @property {number} delta - Integer number indicating the direction and speed to scroll: positive numbers to scroll up, and66 * @property {number} delta - Integer number indicating the direction and speed to scroll: positive numbers to scroll up, and
63 * negative numers to scroll down.67 * negative numers to scroll down. <b>Deprecated. Duplicate of <code>deltaY</code>.</b>
68 * @property {number} deltaX - Horizontal scroll, with negative values representing a rightwards scroll.
69 * @property {number} deltaY - Vertical scroll, with negative values representing a downward scroll.
64 * @property {string} orientation - The orientation of the wheel: <code>"VERTICAL"</code> for a typical mouse;70 * @property {string} orientation - The orientation of the wheel: <code>"VERTICAL"</code> for a typical mouse;
65 * <code>"HORIZONTAL"</code> for a "horizontal" wheel.71 * <code>"HORIZONTAL"</code> for a "horizontal" wheel.
66 * @property {boolean} isLeftButton - <code>true</code> if the left button was pressed when the event was generated, otherwise72 * @property {boolean} isLeftButton - <code>true</code> if the left button was pressed when the event was generated, otherwise
@@ -86,7 +92,9 @@ ScriptValue WheelEvent::toScriptValue(ScriptEngine* engine, const WheelEvent& ev · 19 unmodified lines
86 ScriptValue obj = engine->newObject();92 ScriptValue obj = engine->newObject();
87 obj.setProperty("x", event.x);93 obj.setProperty("x", event.x);
88 obj.setProperty("y", event.y);94 obj.setProperty("y", event.y);
89 obj.setProperty("delta", event.delta);95 obj.setProperty("delta", event.deltaY);
96 obj.setProperty("deltaX", event.deltaX);
97 obj.setProperty("deltaY", event.deltaY);
90 obj.setProperty("orientation", event.orientation);98 obj.setProperty("orientation", event.orientation);
91 obj.setProperty("isLeftButton", event.isLeftButton);99 obj.setProperty("isLeftButton", event.isLeftButton);
92 obj.setProperty("isRightButton", event.isRightButton);100 obj.setProperty("isRightButton", event.isRightButton);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t