MCPcopy Create free account
hub / github.com/GarageGames/Torque3D / scrollRectVisible

Method scrollRectVisible

Engine/source/gui/containers/guiScrollCtrl.cpp:214–249  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

212//-----------------------------------------------------------------------------
213
214void GuiScrollCtrl::scrollRectVisible(RectI rect)
215{
216 // rect is passed in virtual client space
217 if(rect.extent.x > mContentExt.x)
218 rect.extent.x = mContentExt.x;
219 if(rect.extent.y > mContentExt.y)
220 rect.extent.y = mContentExt.y;
221
222 // Determine the points bounding the requested rectangle
223 Point2I rectUpperLeft = rect.point;
224 Point2I rectLowerRight = rect.point + rect.extent;
225
226 // Determine the points bounding the actual visible area...
227 Point2I visUpperLeft = mChildRelPos;
228 Point2I visLowerRight = mChildRelPos + mContentExt;
229 Point2I delta(0,0);
230
231 // We basically try to make sure that first the top left of the given
232 // rect is visible, and if it is, then that the bottom right is visible.
233
234 // Make sure the rectangle is visible along the X axis...
235 if(rectUpperLeft.x < visUpperLeft.x)
236 delta.x = rectUpperLeft.x - visUpperLeft.x;
237 else if(rectLowerRight.x > visLowerRight.x)
238 delta.x = rectLowerRight.x - visLowerRight.x;
239
240 // Make sure the rectangle is visible along the Y axis...
241 if(rectUpperLeft.y < visUpperLeft.y)
242 delta.y = rectUpperLeft.y - visUpperLeft.y;
243 else if(rectLowerRight.y > visLowerRight.y)
244 delta.y = rectLowerRight.y - visLowerRight.y;
245
246 // If we had any changes, scroll, otherwise don't.
247 if(delta.x || delta.y)
248 scrollDelta(delta.x, delta.y);
249}
250
251//-----------------------------------------------------------------------------
252

Callers 7

scrollCellVisibleMethod · 0.80
processTickMethod · 0.80
scrollVisibleMethod · 0.80
ensureCursorOnScreenMethod · 0.80
scrollToTagMethod · 0.80
scrollToTopMethod · 0.80
scrollToBottomMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected