mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-14 08:04:40 +00:00
Merge pull request #880 from eightyeight/issue-180
Improve documentation on getCursorPos and fix cursorInControl
This commit is contained in:
commit
8de36576cd
2 changed files with 5 additions and 1 deletions
|
|
@ -2225,7 +2225,10 @@ DefineEngineMethod( GuiCanvas, reset, void, (),,
|
||||||
}
|
}
|
||||||
|
|
||||||
DefineEngineMethod( GuiCanvas, getCursorPos, Point2I, (),,
|
DefineEngineMethod( GuiCanvas, getCursorPos, Point2I, (),,
|
||||||
"@brief Get the current position of the cursor.\n\n"
|
"@brief Get the current position of the cursor in screen-space. Note that this position"
|
||||||
|
" might be outside the Torque window. If you want to get the position within the Canvas,"
|
||||||
|
" call screenToClient on the result.\n\n"
|
||||||
|
"@see Canvas::screenToClient()\n\n"
|
||||||
"@param param Description\n\n"
|
"@param param Description\n\n"
|
||||||
"@tsexample\n"
|
"@tsexample\n"
|
||||||
"%cursorPos = Canvas.getCursorPos();\n"
|
"%cursorPos = Canvas.getCursorPos();\n"
|
||||||
|
|
|
||||||
|
|
@ -1427,6 +1427,7 @@ bool GuiControl::cursorInControl()
|
||||||
if (! root) return false;
|
if (! root) return false;
|
||||||
|
|
||||||
Point2I pt = root->getCursorPos();
|
Point2I pt = root->getCursorPos();
|
||||||
|
pt = root->getPlatformWindow() ? root->getPlatformWindow()->screenToClient(pt) : pt;
|
||||||
Point2I extent = getExtent();
|
Point2I extent = getExtent();
|
||||||
Point2I offset = localToGlobalCoord(Point2I(0, 0));
|
Point2I offset = localToGlobalCoord(Point2I(0, 0));
|
||||||
if (pt.x >= offset.x && pt.y >= offset.y &&
|
if (pt.x >= offset.x && pt.y >= offset.y &&
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue