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

Method doSnapping

Engine/source/gui/editor/guiEditCtrl.cpp:2165–2192  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2163//-----------------------------------------------------------------------------
2164
2165void GuiEditCtrl::doSnapping( const GuiEvent& event, const RectI& selectionBounds, Point2I& delta )
2166{
2167 // Clear snapping. If we have snapping on, we want to find a new best snap.
2168
2169 mSnapped[ SnapVertical ] = false;
2170 mSnapped[ SnapHorizontal ] = false;
2171
2172 // Compute global bounds.
2173
2174 RectI selectionBoundsGlobal = selectionBounds;
2175 selectionBoundsGlobal.point = getContentControl()->localToGlobalCoord( selectionBoundsGlobal.point );
2176
2177 // Apply the snaps.
2178
2179 doGridSnap( event, selectionBounds, selectionBoundsGlobal, delta );
2180 doGuideSnap( event, selectionBounds, selectionBoundsGlobal, delta );
2181 doControlSnap( event, selectionBounds, selectionBoundsGlobal, delta );
2182
2183 // If we have a horizontal snap, compute a delta.
2184
2185 if( mSnapped[ SnapVertical ] )
2186 snapDelta( SnapVertical, mSnapEdge[ SnapVertical ], mSnapOffset[ SnapVertical ], selectionBoundsGlobal, delta );
2187
2188 // If we have a vertical snap, compute a delta.
2189
2190 if( mSnapped[ SnapHorizontal ] )
2191 snapDelta( SnapHorizontal, mSnapEdge[ SnapHorizontal ], mSnapOffset[ SnapHorizontal ], selectionBoundsGlobal, delta );
2192}
2193
2194//-----------------------------------------------------------------------------
2195

Callers

nothing calls this directly

Calls 3

getContentControlFunction · 0.85
snapDeltaFunction · 0.85
localToGlobalCoordMethod · 0.80

Tested by

no test coverage detected