MCPcopy Create free account
hub / github.com/MyGUI/mygui / setViewOffset

Method setViewOffset

MyGUIEngine/src/MyGUI_ScrollView.cpp:273–309  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

271 }
272
273 void ScrollView::setViewOffset(const IntPoint& _value)
274 {
275 IntPoint value = _value;
276 IntPoint currentOffset = getClientWidget()->getPosition();
277
278 if (mHRange != 0)
279 {
280 if (value.left > 0)
281 value.left = 0;
282 else if (value.left < -(int)mHRange)
283 value.left = -(int)mHRange;
284 }
285 else
286 {
287 value.left = currentOffset.left;
288 }
289
290 if (mVRange != 0)
291 {
292 if (value.top > 0)
293 value.top = 0;
294 else if (value.top < -(int)mVRange)
295 value.top = -(int)mVRange;
296 }
297 else
298 {
299 value.top = currentOffset.top;
300 }
301
302 if (mHScroll != nullptr)
303 mHScroll->setScrollPosition(-value.left);
304
305 if (mVScroll != nullptr)
306 mVScroll->setScrollPosition(-value.top);
307
308 getClientWidget()->setPosition(value);
309 }
310
311 IntPoint ScrollView::getViewOffset() const
312 {

Callers

nothing calls this directly

Calls 3

getPositionMethod · 0.45
setScrollPositionMethod · 0.45
setPositionMethod · 0.45

Tested by

no test coverage detected