MCPcopy Create free account
hub / github.com/Meridian59/Meridian59 / CmCenterMap

Method CmCenterMap

roomedit/source/editcli.cpp:4652–4680  ·  view source on GitHub ↗

//////////////////////////////////////////////////////////////// TEditorClient -------------

Source from the content-addressed store, hash-verified

4650// -------------
4651//
4652void TEditorClient::CmCenterMap ()
4653{
4654 // Center map
4655 CenterMapAroundCoords ((MapMinX + MapMaxX) / 2, (MapMinY + MapMaxY) / 2);
4656
4657 // Zoom out until everything is visible
4658 SetScale (ScaleMax);
4659 while ( Scale > ScaleMin )
4660 {
4661 if ( MAPX(0) <= MapMinX && MAPX(ScrMaxX) >= MapMaxX &&
4662 // Vertical axe is reversed !
4663 MAPY(0) >= MapMaxY && MAPY(ScrMaxY) <= MapMinY )
4664 {
4665 break;
4666 }
4667
4668 float OldScale = Scale;
4669 DecScale();
4670
4671 // If scale didn't change, the Scale is minimal
4672 if ( OldScale == Scale )
4673 break;
4674 }
4675
4676 // Refresh window
4677 Invalidate(); // Redraw map
4678 AdjustScroller(); // Adjust scroller units
4679 DrawStatusBar(); // Draw new scale
4680}
4681
4682
4683/////////////////////////////////////////////////////////////////////

Callers

nothing calls this directly

Calls 2

SetScaleFunction · 0.85
DecScaleFunction · 0.85

Tested by

no test coverage detected