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

Method moveAndSnapSelection

Engine/source/gui/editor/guiEditCtrl.cpp:1092–1121  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1090}
1091
1092void GuiEditCtrl::moveAndSnapSelection( const Point2I &delta, bool callback )
1093{
1094 // move / nudge gets a special callback so that multiple small moves can be
1095 // coalesced into one large undo action.
1096 // undo
1097
1098 if( callback )
1099 onPreSelectionNudged_callback( getSelectedSet() );
1100
1101 Vector<GuiControl *>::iterator i;
1102 Point2I newPos;
1103 for(i = mSelectedControls.begin(); i != mSelectedControls.end(); i++)
1104 {
1105 GuiControl* ctrl = *i;
1106 if( !ctrl->isLocked() && !selectionContainsParentOf( ctrl ) )
1107 {
1108 newPos = ctrl->getPosition() + delta;
1109 newPos = snapPoint( newPos, delta, mGridSnap );
1110 ctrl->setPosition( newPos );
1111 }
1112 }
1113
1114 // undo
1115 if( callback )
1116 onPostSelectionNudged_callback( getSelectedSet() );
1117
1118 // allow script to update the inspector
1119 if( callback && mSelectedControls.size() > 0 )
1120 onSelectionMoved_callback( mSelectedControls[ 0 ] );
1121}
1122
1123//-----------------------------------------------------------------------------
1124

Callers 1

guiEditCtrl.cppFile · 0.80

Calls 8

getSelectedSetFunction · 0.85
snapPointFunction · 0.85
isLockedMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
getPositionMethod · 0.45
setPositionMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected