Make the documentation clearer, match the documentation when no buttons are pressed for an event

pull/3227/head
uramer 3 years ago
parent f809354d92
commit e92c88a133

@ -156,9 +156,11 @@ namespace LuaUi
MyGUI::IntPoint absolutePosition = mWidget->getAbsolutePosition();
osg::Vec2f offset = position - osg::Vec2f(absolutePosition.left, absolutePosition.top);
sol::table table = makeTable();
int sdlButton = SDLUtil::myGuiMouseButtonToSdl(button);
table["position"] = position;
table["offset"] = offset;
table["button"] = SDLUtil::myGuiMouseButtonToSdl(button);
if (sdlButton == 0) // nil if no button was pressed
table["button"] = sdlButton;
return table;
}

@ -217,7 +217,8 @@
-- @type MouseEvent
-- @field openmw.util#Vector2 position Absolute position of the mouse cursor
-- @field openmw.util#Vector2 offset Position of the mouse cursor relative to the widget
-- @field #number button Mouse button which triggered the event (could be nil)
-- @field #number button Mouse button which triggered the event.
-- Matches the arguments of @{openmw_input#input.isMouseButtonPressed} (`nil` for none, 1 for left, 3 for right).
---
-- Register a new texture resource. Can be used to manually atlas UI textures.

Loading…
Cancel
Save