MCPcopy Create free account
hub / github.com/comaps/comaps / OnTap

Method OnTap

libs/drape_frontend/frontend_renderer.cpp:1978–2011  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1976}
1977
1978void FrontendRenderer::OnTap(m2::PointD const & pt, bool isLongTap)
1979{
1980 if (m_blockTapEvents)
1981 return;
1982
1983 double const halfSize = VisualParams::Instance().GetTouchRectRadius();
1984 m2::PointD sizePoint(halfSize, halfSize);
1985 m2::RectD selectRect(pt - sizePoint, pt + sizePoint);
1986
1987 ScreenBase const & screen = m_userEventStream.GetCurrentScreen();
1988 bool isMyPosition = false;
1989
1990 m2::PointD const pxPoint2d = screen.P3dtoP(pt);
1991 m2::PointD mercator = screen.PtoG(pxPoint2d);
1992
1993 // Long tap should show/hide the interface. There is no need to detect tapped features.
1994 if (isLongTap)
1995 {
1996 m_tapEventInfoHandler({mercator, isLongTap, isMyPosition, FeatureID(), kml::kInvalidMarkId});
1997 return;
1998 }
1999
2000 if (m_myPositionController->IsModeHasPosition())
2001 {
2002 m2::PointD const pixelPos = screen.PtoP3d(screen.GtoP(m_myPositionController->Position()));
2003 isMyPosition = selectRect.IsPointInside(pixelPos);
2004 if (isMyPosition)
2005 mercator = m_myPositionController->Position();
2006 }
2007
2008 ASSERT(m_tapEventInfoHandler != nullptr, ());
2009 auto [featureId, markId] = GetVisiblePOI(selectRect);
2010 m_tapEventInfoHandler({mercator, isLongTap, isMyPosition, featureId, markId});
2011}
2012
2013void FrontendRenderer::OnForceTap(m2::PointD const & pt)
2014{

Callers

nothing calls this directly

Calls 11

ASSERTFunction · 0.85
GetTouchRectRadiusMethod · 0.80
GetCurrentScreenMethod · 0.80
IsModeHasPositionMethod · 0.80
PtoP3dMethod · 0.80
FeatureIDClass · 0.50
P3dtoPMethod · 0.45
PtoGMethod · 0.45
GtoPMethod · 0.45
PositionMethod · 0.45
IsPointInsideMethod · 0.45

Tested by

no test coverage detected