MCPcopy Create free account
hub / github.com/GarageGames/Torque3D / doSnapping

Method doSnapping

Engine/source/gui/editor/guiEditCtrl.cpp:2152–2179  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2150//-----------------------------------------------------------------------------
2151
2152void GuiEditCtrl::doSnapping( const GuiEvent& event, const RectI& selectionBounds, Point2I& delta )
2153{
2154 // Clear snapping. If we have snapping on, we want to find a new best snap.
2155
2156 mSnapped[ SnapVertical ] = false;
2157 mSnapped[ SnapHorizontal ] = false;
2158
2159 // Compute global bounds.
2160
2161 RectI selectionBoundsGlobal = selectionBounds;
2162 selectionBoundsGlobal.point = getContentControl()->localToGlobalCoord( selectionBoundsGlobal.point );
2163
2164 // Apply the snaps.
2165
2166 doGridSnap( event, selectionBounds, selectionBoundsGlobal, delta );
2167 doGuideSnap( event, selectionBounds, selectionBoundsGlobal, delta );
2168 doControlSnap( event, selectionBounds, selectionBoundsGlobal, delta );
2169
2170 // If we have a horizontal snap, compute a delta.
2171
2172 if( mSnapped[ SnapVertical ] )
2173 snapDelta( SnapVertical, mSnapEdge[ SnapVertical ], mSnapOffset[ SnapVertical ], selectionBoundsGlobal, delta );
2174
2175 // If we have a vertical snap, compute a delta.
2176
2177 if( mSnapped[ SnapHorizontal ] )
2178 snapDelta( SnapHorizontal, mSnapEdge[ SnapHorizontal ], mSnapOffset[ SnapHorizontal ], selectionBoundsGlobal, delta );
2179}
2180
2181//-----------------------------------------------------------------------------
2182

Callers

nothing calls this directly

Calls 3

getContentControlFunction · 0.85
snapDeltaFunction · 0.85
localToGlobalCoordMethod · 0.80

Tested by

no test coverage detected