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

Function convertDistanceFromPointToInch

core/ui/UIScrollView.cpp:44–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42constexpr float BOUNCE_BACK_DURATION = 1.0f;
43
44float convertDistanceFromPointToInch(const Vec2& dis)
45{
46 auto renderView = Director::getInstance()->getRenderView();
47 int dpi = Device::getDPI();
48 float distance = Vec2(dis.x * renderView->getScaleX() / dpi, dis.y * renderView->getScaleY() / dpi).getLength();
49 return distance;
50}
51} // namespace
52
53#define MOVE_INCH (7.0f / 160.0f)

Callers 1

interceptTouchEventMethod · 0.70

Calls 5

getInstanceFunction · 0.85
Vec2Function · 0.50
getLengthMethod · 0.45
getScaleXMethod · 0.45
getScaleYMethod · 0.45

Tested by

no test coverage detected