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

Method _reset

Engine/source/gui/containers/guiAutoScrollCtrl.cpp:200–229  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

198//-----------------------------------------------------------------------------
199
200void GuiAutoScrollCtrl::_reset( GuiControl* control )
201{
202 U32 axis = _getScrollAxis();
203 U32 counterAxis = ( axis == 1 ? 0 : 1 );
204
205 Point2I newPosition( mChildBorder, mChildBorder );
206 Point2I newExtent = control->getExtent();
207
208 // Fit control on axis that is not scrolled.
209 newExtent[ counterAxis ] = getExtent()[ counterAxis ] - mChildBorder * 2;
210
211 // For the right and down scrolls, position the control away from the
212 // right/bottom edge of our control.
213
214 if( mDirection == Right )
215 newPosition.x = - ( newExtent.x - getExtent().x + mChildBorder );
216 else if( mDirection == Down )
217 newPosition.y = - ( newExtent.y - getExtent().y + mChildBorder );
218
219 // Set the child geometry.
220
221 control->setPosition( newPosition );
222 control->setExtent( newExtent );
223
224 // Reset counters.
225
226 mCurrentTime = 0.0f;
227 mCurrentPhase = PhaseInitial;
228 mCurrentPosition = control->getPosition()[ axis ];
229}
230
231//-----------------------------------------------------------------------------
232

Callers

nothing calls this directly

Calls 5

_getScrollAxisFunction · 0.85
getExtentMethod · 0.80
setExtentMethod · 0.80
setPositionMethod · 0.45
getPositionMethod · 0.45

Tested by

no test coverage detected