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

Method GetPivot

libs/drape/overlay_handle.cpp:55–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53}
54
55m2::PointD OverlayHandle::GetPivot(ScreenBase const & screen, bool perspective) const
56{
57 m2::RectD r = GetPixelRect(screen, false);
58 m2::PointD size(0.5 * r.SizeX(), 0.5 * r.SizeY());
59 m2::PointD result = r.Center();
60
61 if (m_anchor & dp::Left)
62 result.x -= size.x;
63 else if (m_anchor & dp::Right)
64 result.x += size.x;
65
66 if (m_anchor & dp::Top)
67 result.y -= size.y;
68 else if (m_anchor & dp::Bottom)
69 result.y += size.y;
70
71 if (perspective)
72 result = screen.PtoP3d(result, -m_pivotZ);
73
74 return result;
75}
76
77bool OverlayHandle::IsIntersect(ScreenBase const & screen, ref_ptr<OverlayHandle> const h) const
78{

Calls 4

SizeXMethod · 0.80
SizeYMethod · 0.80
PtoP3dMethod · 0.80
CenterMethod · 0.45

Tested by 3

CheckBookmarksFunction · 0.36
EqualBookmarksFunction · 0.36
UNIT_TESTFunction · 0.36