Class: Distance

Distance


new Distance()

Deprecated:
  • Will be dropped wiht the introduction of global distance units

Members


<static, constant> KILOMETERS

Kilometers, represented as false by legacy versions of the plugin

<static, constant> MILES

Miles, represented as true by legacy versions of the plugin

<static, constant> MILES_PER_KILOMETER

Miles per kilometer

Methods


<static> kilometersToUI(km, The)

Converts kilometers to a UI distance, either the same value, or converted to miles depending on settings.
Parameters:
Name Type Description
km number The input distance in kilometers
The number UI distance in the units specified by settings

<static> uiToKilometers(uiDistance)

Converts a UI distance (eg from a form control) to kilometers, accounting for the global units setting
Parameters:
Name Type Description
uiDistance number The distance from the UI, could be in miles or kilometers depending on settings
Returns:
The input distance in kilometers
Type
number

<static> uiToMeters(uiDistance)

Converts a UI distance (eg from a form control) to meters, accounting for the global units setting
Parameters:
Name Type Description
uiDistance number The distance from the UI, could be in miles or kilometers depending on settings
Returns:
The input distance in meters
Type
number

<static> uiToMiles(uiDistance)

Converts a UI distance (eg from a form control) to miles, according to settings
Parameters:
Name Type Description
uiDistance number The distance from the UI, could be in miles or kilometers depending on settings
Returns:
The input distance
Type
number