MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / cursorInControl

Method cursorInControl

Engine/source/gui/core/guiControl.cpp:1509–1527  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1507//-----------------------------------------------------------------------------
1508
1509bool GuiControl::cursorInControl()
1510{
1511 GuiCanvas *root = getRoot();
1512 if (! root) return false;
1513
1514 Point2I pt = root->getCursorPos();
1515 pt = root->getPlatformWindow() ? root->getPlatformWindow()->screenToClient(pt) : pt;
1516 Point2I extent = getExtent();
1517 Point2I offset = localToGlobalCoord(Point2I(0, 0));
1518 if (pt.x >= offset.x && pt.y >= offset.y &&
1519 pt.x < offset.x + extent.x && pt.y < offset.y + extent.y)
1520 {
1521 return true;
1522 }
1523 else
1524 {
1525 return false;
1526 }
1527}
1528
1529//-----------------------------------------------------------------------------
1530

Callers

nothing calls this directly

Calls 4

getPlatformWindowMethod · 0.80
Point2IClass · 0.50
getCursorPosMethod · 0.45
screenToClientMethod · 0.45

Tested by

no test coverage detected