Skip to content

Commit

Permalink
#5753: Privatise XYWnd::getZoomedScale(), formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
codereader committed Sep 17, 2021
1 parent 7bbd03b commit beb85d4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
16 changes: 11 additions & 5 deletions radiant/xyview/XYWnd.cpp
Expand Up @@ -1546,17 +1546,23 @@ void XYWnd::mouseToPoint(int x, int y, Vector3& point)
// NOTE: the zoom out factor is 4/5, we could think about customizing it
// we don't go below a zoom factor corresponding to 10% of the max world size
// (this has to be computed against the window size)
float XYWnd::getZoomedScale( int steps ) {
const float min_scale = std::min( getWidth(), getHeight() ) / ( 1.1f * ( _maxWorldCoord - _minWorldCoord ) );
float XYWnd::getZoomedScale(int steps)
{
const float min_scale = std::min(getWidth(), getHeight()) / (1.1f * (_maxWorldCoord - _minWorldCoord));
const float max_scale = GlobalXYWnd().maxZoomFactor();
const float fZoom = pow( 5.0f / 4.0f, steps );
const float fZoom = pow(5.0f / 4.0f, steps);
const float scale = getScale() * fZoom;
if ( scale > max_scale ) {

if (scale > max_scale)
{
return max_scale;
}
if ( scale < min_scale ) {

if (scale < min_scale)
{
return min_scale;
}

return scale;
}

Expand Down
2 changes: 1 addition & 1 deletion radiant/xyview/XYWnd.h
Expand Up @@ -133,7 +133,6 @@ class XYWnd :

void mouseToPoint(int x, int y, Vector3& point);

float getZoomedScale( int steps );
void zoomIn() override;
void zoomOut() override;
void zoomInOn( wxPoint cursor, int zoom );
Expand Down Expand Up @@ -179,6 +178,7 @@ class XYWnd :
void onContextMenu();
void drawSizeInfo(int nDim1, int nDim2, const Vector3& vMinBounds, const Vector3& vMaxBounds);
void drawCameraIcon();
float getZoomedScale(int steps);

// callbacks
bool checkChaseMouse(unsigned int state);
Expand Down

0 comments on commit beb85d4

Please sign in to comment.