Selects a scale value for the application based on the screen density (sometimes density is called DPI or PPI).

Available since

1.0.0

.

See:

Constructor

new ()

Creates a new ScreenDensityScaleCalculator object.

Available since

1.0.0

.

Methods

addScaleForDensity (density:Float, scale:Float):Void

Adds a new scale for the specified screen density.

calculator.addScaleForDensity(160, 1);
calculator.addScaleForDensity(240, 1.5);
calculator.addScaleForDensity(320, 2);
calculator.addScaleForDensity(480, 3);

getScale (density:Float):Float

Returns the ideal scale for the specified screen density.

removeScaleForDensity (density:Float):Void

Removes an application scale that was added with addScaleForDensity().

selector.addScaleForDensity(320, 2);
selector.removeScaleForDensity(320);

See: