ScaleBar

fun ScaleBar(modifier: Modifier = Modifier, contentPadding: PaddingValues = PaddingValues(4.dp), alignment: Alignment = Alignment.TopStart, textColor: Color = Color.Black, primaryColor: Color = Color.Black, secondaryColor: Color = Color.White, borderWidth: Dp = 2.dp, height: Dp = 2.dp, textBarMargin: Dp = 8.dp, textBorderWidth: Dp = 2.dp, textSize: TextUnit = 8.sp, isMetricUnit: Boolean = true, refreshInterval: Duration = 15.milliseconds, showTextBorder: Boolean = true, ratio: Float = 0.5f, useContinuousRendering: Boolean = false)

Add a ScaleBar ornament to the map, the scale bar will update accordingly when the map's zoom level or latitude changes.

By default, the ScaleBar will be placed to the Alignment.TopStart of the map with padding of 4dp.

Parameters

modifier

Modifier to be applied to the ScaleBar.

contentPadding

The default padding applied to the ScaleBar, paddings from modifier will be applied on top of this default padding.

alignment

The alignment of the ScaleBar within the Map.

textColor

Defines text color of the scale bar.

primaryColor

Defines primary color of the scale bar.

secondaryColor

Defines secondary color of the scale bar.

borderWidth

Defines width of the border for the scale bar.

height

Defines height of the scale bar.

textBarMargin

Defines margin of the text bar of the scale bar.

textBorderWidth

Defines text border width of the scale bar.

textSize

Defines text size of the scale bar.

isMetricUnit

Whether the scale bar is using metric unit. True if the scale bar is using metric system, false if the scale bar is using imperial units.

refreshInterval

Configures minimum refresh interval, in millisecond, default is 15 milliseconds.

showTextBorder

Configures whether to show the text border or not, default is true.

ratio

Configures ratio of scale bar max width compared with MapView width, default is 0.5.

useContinuousRendering

If set to True scale bar will be triggering onDraw depending on refreshInterval even if actual data did not change. If set to False scale bar will redraw only on demand. Defaults to False and should not be changed explicitly in most cases. Could be set to True to produce correct GPU frame metrics when running gfxinfo command.