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

Function snapPoint

Engine/source/gui/editor/guiEditCtrl.cpp:1072–1090  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1070//-----------------------------------------------------------------------------
1071
1072static Point2I snapPoint(Point2I point, Point2I delta, Point2I gridSnap)
1073{
1074 S32 snap;
1075 if(gridSnap.x && delta.x)
1076 {
1077 snap = point.x % gridSnap.x;
1078 point.x -= snap;
1079 if(delta.x > 0 && snap != 0)
1080 point.x += gridSnap.x;
1081 }
1082 if(gridSnap.y && delta.y)
1083 {
1084 snap = point.y % gridSnap.y;
1085 point.y -= snap;
1086 if(delta.y > 0 && snap != 0)
1087 point.y += gridSnap.y;
1088 }
1089 return point;
1090}
1091
1092void GuiEditCtrl::moveAndSnapSelection( const Point2I &delta, bool callback )
1093{

Callers 1

moveAndSnapSelectionMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected