mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-11 22:47:13 -06:00
Added option for downscaling
This commit is contained in:
@@ -43,6 +43,14 @@ public interface FlatSystemProperties
|
||||
* <strong>Default</strong> {@code true}
|
||||
*/
|
||||
String UI_SCALE_ENABLED = "flatlaf.uiScale.enabled";
|
||||
|
||||
/**
|
||||
* Specifies whether values smaller than 1.0f are allowed for the custom scale factor.
|
||||
* <p>
|
||||
* <strong>Allowed Values</strong> {@code false} and {@code true}<br>
|
||||
* <strong>Default</strong> {@code false}
|
||||
*/
|
||||
String UI_DOWNSCALE_ENABLED = "flatlaf.uiDowncale.enabled";
|
||||
|
||||
/**
|
||||
* Specifies whether Ubuntu font should be used on Ubuntu Linux.
|
||||
|
||||
@@ -257,6 +257,10 @@ public class UIScale
|
||||
private static boolean isUserScalingEnabled() {
|
||||
return FlatSystemProperties.getBoolean( FlatSystemProperties.UI_SCALE_ENABLED, true );
|
||||
}
|
||||
|
||||
private static boolean isDownscalingEnabled() {
|
||||
return FlatSystemProperties.getBoolean( FlatSystemProperties.UI_DOWNSCALE_ENABLED, false );
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies a custom scale factor given in system property "flatlaf.uiScale"
|
||||
@@ -323,7 +327,7 @@ public class UIScale
|
||||
* Sets the user scale factor.
|
||||
*/
|
||||
private static void setUserScaleFactor( float scaleFactor ) {
|
||||
if( scaleFactor <= 1f )
|
||||
if( ( !isDownscalingEnabled() && scaleFactor <= 1f ) || scaleFactor <= 0f )
|
||||
scaleFactor = 1f;
|
||||
else // round scale factor to 1/4
|
||||
scaleFactor = Math.round( scaleFactor * 4f ) / 4f;
|
||||
|
||||
Reference in New Issue
Block a user