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

Method getSelectionBounds

Engine/source/gui/editor/guiEditCtrl.cpp:1476–1503  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1474//-----------------------------------------------------------------------------
1475
1476RectI GuiEditCtrl::getSelectionBounds() const
1477{
1478 Vector<GuiControl *>::const_iterator i = mSelectedControls.begin();
1479
1480 Point2I minPos = (*i)->localToGlobalCoord( Point2I( 0, 0 ) );
1481 Point2I maxPos = minPos;
1482
1483 for(; i != mSelectedControls.end(); i++)
1484 {
1485 Point2I iPos = (**i).localToGlobalCoord( Point2I( 0 , 0 ) );
1486
1487 minPos.x = getMin( iPos.x, minPos.x );
1488 minPos.y = getMin( iPos.y, minPos.y );
1489
1490 Point2I iExt = ( **i ).getExtent();
1491
1492 iPos.x += iExt.x;
1493 iPos.y += iExt.y;
1494
1495 maxPos.x = getMax( iPos.x, maxPos.x );
1496 maxPos.y = getMax( iPos.y, maxPos.y );
1497 }
1498
1499 minPos = getContentControl()->globalToLocalCoord( minPos );
1500 maxPos = getContentControl()->globalToLocalCoord( maxPos );
1501
1502 return RectI( minPos.x, minPos.y, ( maxPos.x - minPos.x ), ( maxPos.y - minPos.y ) );
1503}
1504
1505//-----------------------------------------------------------------------------
1506

Callers

nothing calls this directly

Calls 9

getMaxFunction · 0.85
getContentControlFunction · 0.85
localToGlobalCoordMethod · 0.80
getExtentMethod · 0.80
globalToLocalCoordMethod · 0.80
Point2IClass · 0.50
RectIClass · 0.50
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected