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
1919 WheelEvent::WheelEvent() :
2020 x(0.0f),
2121 y(0.0f),
22− delta(0.0f),
22+ deltaX(0.0f),
23+ deltaY(0.0f),
2324 orientation("UNKNOwN"),
2425 isLeftButton(false),
2526 isRightButton(false),
@@ -42,6 +43,9 @@ WheelEvent::WheelEvent(const QWheelEvent& event) { · 16 unmodified lines
4243 orientation = "VERTICAL";
4344 }
4445
46+ deltaX = event.angleDelta().x();
47+ deltaY = event.angleDelta().y();
48+
4549 // button pressed state
4650 isLeftButton = (event.buttons().testFlag(Qt::LeftButton));
4751 isRightButton = (event.buttons().testFlag(Qt::RightButton));
@@ -60,7 +64,9 @@ WheelEvent::WheelEvent(const QWheelEvent& event) { · 12 unmodified lines
6064 * @property {number} x - Integer x-coordinate of the event on the Interface window or HMD HUD.
6165 * @property {number} y - Integer y-coordinate of the event on the Interface window or HMD HUD.
6266 * @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.
6470 * @property {string} orientation - The orientation of the wheel: <code>"VERTICAL"</code> for a typical mouse;
6571 * <code>"HORIZONTAL"</code> for a "horizontal" wheel.
6672 * @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
8692 ScriptValue obj = engine->newObject();
8793 obj.setProperty("x", event.x);
8894 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);
9098 obj.setProperty("orientation", event.orientation);
9199 obj.setProperty("isLeftButton", event.isLeftButton);
92100 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