Fix #9995: Adjust viewport zoom level for HiDPI displays
On HiDPI screens the zoom level is increased for detailed rendering. This causes hard-coded zoom levels to be off by this adjustment. To fix these default zoom levels, we scale the zoom level based on `_gui_zoom` to get the scaled zoom level.
This commit is contained in:
committed by
Michael Lutz
parent
47a998fb0c
commit
93d2d4590f
@@ -79,6 +79,26 @@ static inline int UnScaleGUI(int value)
|
||||
return UnScaleByZoom(value, ZOOM_LVL_GUI);
|
||||
}
|
||||
|
||||
/**
|
||||
* Scale zoom level relative to GUI zoom.
|
||||
* @param value zoom level to scale
|
||||
* @return scaled zoom level
|
||||
*/
|
||||
static inline ZoomLevel ScaleZoomGUI(ZoomLevel value)
|
||||
{
|
||||
return std::clamp(ZoomLevel(value + (ZOOM_LVL_GUI - ZOOM_LVL_OUT_4X)), ZOOM_LVL_MIN, ZOOM_LVL_MAX);
|
||||
}
|
||||
|
||||
/**
|
||||
* UnScale zoom level relative to GUI zoom.
|
||||
* @param value zoom level to scale
|
||||
* @return un-scaled zoom level
|
||||
*/
|
||||
static inline ZoomLevel UnScaleZoomGUI(ZoomLevel value)
|
||||
{
|
||||
return std::clamp(ZoomLevel(value - (ZOOM_LVL_GUI - ZOOM_LVL_OUT_4X)), ZOOM_LVL_MIN, ZOOM_LVL_MAX);
|
||||
}
|
||||
|
||||
/**
|
||||
* Scale traditional pixel dimensions to GUI zoom level.
|
||||
* @param value Pixel amount at #ZOOM_LVL_BASE (traditional "normal" interface size).
|
||||
|
||||
Reference in New Issue
Block a user