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

Method DoDrag

libs/drape_frontend/navigator.cpp:107–137  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

105}
106
107void Navigator::DoDrag(m2::PointD const & pt)
108{
109 if (m_LastPt1 == pt)
110 return;
111
112 ScreenBase const s = ShrinkInto(m_StartScreen, df::GetWorldRect());
113
114 double dx = pt.x - m_StartPt1.x;
115 double dy = pt.y - m_StartPt1.y;
116
117 ScreenBase tmp = s;
118 tmp.Move(dx, 0);
119 if (!CheckBorders(tmp))
120 dx = 0;
121
122 tmp = s;
123 tmp.Move(0, dy);
124 if (!CheckBorders(tmp))
125 dy = 0;
126
127 tmp = s;
128 tmp.Move(dx, dy);
129
130 if (CheckBorders(tmp))
131 {
132 m_StartScreen = tmp;
133 m_StartPt1 = pt;
134 m_LastPt1 = pt;
135 m_Screen = tmp;
136 }
137}
138
139void Navigator::StopDrag(m2::PointD const & pt)
140{

Callers 1

DragMethod · 0.80

Calls 4

ShrinkIntoFunction · 0.85
GetWorldRectFunction · 0.85
CheckBordersFunction · 0.85
MoveMethod · 0.45

Tested by

no test coverage detected