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

Function ShrinkInto

libs/drape_frontend/screen_operations.cpp:83–102  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

81}
82
83ScreenBase const ShrinkInto(ScreenBase const & screen, m2::RectD const & boundRect)
84{
85 ScreenBase res = screen;
86
87 m2::RectD clipRect = res.ClipRect();
88 if (clipRect.minX() < boundRect.minX())
89 clipRect.Offset(boundRect.minX() - clipRect.minX(), 0);
90 if (clipRect.maxX() > boundRect.maxX())
91 clipRect.Offset(boundRect.maxX() - clipRect.maxX(), 0);
92 if (clipRect.minY() < boundRect.minY())
93 clipRect.Offset(0, boundRect.minY() - clipRect.minY());
94 if (clipRect.maxY() > boundRect.maxY())
95 clipRect.Offset(0, boundRect.maxY() - clipRect.maxY());
96
97 res.SetOrg(clipRect.Center());
98
99 // This assert fails near x = 180 (Philipines).
100 // ASSERT ( boundRect.IsRectInside(res.ClipRect()), (clipRect, res.ClipRect()) );
101 return res;
102}
103
104ScreenBase const ScaleInto(ScreenBase const & screen, m2::RectD const & boundRect)
105{

Callers 3

ApplyScaleFunction · 0.85
DoDragMethod · 0.85
ScaleImplMethod · 0.85

Calls 7

minXMethod · 0.80
maxXMethod · 0.80
minYMethod · 0.80
maxYMethod · 0.80
SetOrgMethod · 0.80
OffsetMethod · 0.45
CenterMethod · 0.45

Tested by

no test coverage detected