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

Method onTouchBegan

extensions/GUI/src/GUI/ControlExtension/ControlSwitch.cpp:387–404  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

385}
386
387bool ControlSwitch::onTouchBegan(Touch* pTouch, Event* /*pEvent*/)
388{
389 if (!isTouchInside(pTouch) || !isEnabled() || !isVisible())
390 {
391 return false;
392 }
393
394 _moved = false;
395
396 Vec2 location = this->locationFromTouch(pTouch);
397
398 _initialTouchXPosition = location.x - _switchSprite->getSliderXPosition();
399
400 _switchSprite->getThumbSprite()->setColor(Color3B::GRAY);
401 _switchSprite->needsLayout();
402
403 return true;
404}
405
406void ControlSwitch::onTouchMoved(Touch* pTouch, Event* /*pEvent*/)
407{

Callers

nothing calls this directly

Calls 5

locationFromTouchMethod · 0.95
isEnabledFunction · 0.50
isVisibleFunction · 0.50
setColorMethod · 0.45
needsLayoutMethod · 0.45

Tested by

no test coverage detected