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

Method moveSelectionToCtrl

Engine/source/gui/editor/guiEditCtrl.cpp:1049–1068  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1047//-----------------------------------------------------------------------------
1048
1049void GuiEditCtrl::moveSelectionToCtrl( GuiControl *newParent, bool callback )
1050{
1051 for( U32 i = 0; i < mSelectedControls.size(); ++ i )
1052 {
1053 GuiControl* ctrl = mSelectedControls[i];
1054 if( ctrl->getParent() == newParent
1055 || ctrl->isLocked()
1056 || selectionContainsParentOf( ctrl ) )
1057 continue;
1058
1059 Point2I globalpos = ctrl->localToGlobalCoord(Point2I(0,0));
1060 newParent->addObject(ctrl);
1061 Point2I newpos = ctrl->globalToLocalCoord(globalpos) + ctrl->getPosition();
1062 ctrl->setPosition(newpos);
1063 }
1064
1065 onHierarchyChanged_callback();
1066
1067 //TODO: undo
1068}
1069
1070//-----------------------------------------------------------------------------
1071

Callers

nothing calls this directly

Calls 9

isLockedMethod · 0.80
localToGlobalCoordMethod · 0.80
globalToLocalCoordMethod · 0.80
Point2IClass · 0.50
sizeMethod · 0.45
getParentMethod · 0.45
addObjectMethod · 0.45
getPositionMethod · 0.45
setPositionMethod · 0.45

Tested by

no test coverage detected