MCPcopy Create free account
hub / github.com/axmolengine/axmol / setContentOffset

Method setContentOffset

extensions/GUI/src/GUI/ScrollView/ScrollView.cpp:216–240  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

214}
215
216void ScrollView::setContentOffset(Vec2 offset, bool animated /* = false*/)
217{
218 if (animated)
219 { // animate scrolling
220 this->setContentOffsetInDuration(offset, BOUNCE_DURATION);
221 }
222 else
223 { // set the container position directly
224 if (!_bounceable)
225 {
226 const Vec2 minOffset = this->minContainerOffset();
227 const Vec2 maxOffset = this->maxContainerOffset();
228
229 offset.x = MAX(minOffset.x, MIN(maxOffset.x, offset.x));
230 offset.y = MAX(minOffset.y, MIN(maxOffset.y, offset.y));
231 }
232
233 _container->setPosition(offset);
234
235 if (_delegate != nullptr)
236 {
237 _delegate->scrollViewDidScroll(this);
238 }
239 }
240}
241
242void ScrollView::setContentOffsetInDuration(Vec2 offset, float dt)
243{

Callers 8

setZoomScaleMethod · 0.95
relocateContainerMethod · 0.95
deaccelerateScrollingMethod · 0.95
onTouchMovedMethod · 0.95
onMouseScrollMethod · 0.80
runThisTestMethod · 0.80
_updateContentSizeMethod · 0.80

Calls 5

minContainerOffsetMethod · 0.95
maxContainerOffsetMethod · 0.95
setPositionMethod · 0.45
scrollViewDidScrollMethod · 0.45

Tested by 2

onMouseScrollMethod · 0.64
runThisTestMethod · 0.64