ScaleRanges

AMD: require(["esri/widgets/ScaleRangeSlider/ScaleRanges"], (ScaleRanges) => { /* code goes here */ });
ESM: import ScaleRanges from "@arcgis/core/widgets/ScaleRangeSlider/ScaleRanges.js";
Class: esri/widgets/ScaleRangeSlider/ScaleRanges
Inheritance: ScaleRanges Accessor
Since: ArcGIS Maps SDK for JavaScript 4.13

The ScaleRanges class represents the ranges of scales for the ScaleRangeSlider widget.

See also

Property Overview

Any properties can be set, retrieved or listened to. See the Working with Properties topic.
Show inherited properties Hide inherited properties
Name Type Summary Class
String

The name of the class.

Accessor

The recommended scales at each of the named scale ranges.

ScaleRanges

Property Details

declaredClass

Inherited
Property
declaredClass Stringreadonly
Inherited from Accessor

The name of the class. The declared class name is formatted as esri.folder.className.

RecommendedScales

Property
RecommendedScales Objectstatic,constant

The recommended scales at each of the named scale ranges.

Properties
world Number
continent Number
Default Value:50000000
countriesBig Number
Default Value:25000000
countriesSmall Number
Default Value:12000000
statesProvinces Number
Default Value:6000000
stateProvince Number
Default Value:3000000
counties Number
Default Value:1500000
county Number
Default Value:750000
metropolitanArea Number
Default Value:320000
cities Number
Default Value:160000
city Number
Default Value:80000
town Number
Default Value:40000
neighborhood Number
Default Value:20000
streets Number
Default Value:10000
street Number
Default Value:5000
buildings Number
Default Value:2500
building Number
Default Value:1250
smallBuilding Number
Default Value:800
rooms Number
Default Value:400
room Number
Default Value:100

Method Overview

Show inherited methods Hide inherited methods
Name Return Type Summary Class

Adds one or more handles which are to be tied to the lifecycle of the object.

Accessor
Number

Clamps the scale to the closest minScale or maxScale on the scale range.

ScaleRanges
Boolean

Determines whether the given scale is within the current scale range.

ScaleRanges
NamedScaleRange

Finds the scale range name at a given index.

ScaleRanges
ScaleRanges

Helper to create a ScaleRanges object from a minimum and maximum scale.

ScaleRanges
Boolean

Returns true if a named group of handles exist.

Accessor
Boolean

Determines if the input scale value can be considered to be at the smallest scale range edge.

ScaleRanges
Boolean

Determines if the input scale value can be considered to be at the largest scale range edge.

ScaleRanges

Removes a group of handles owned by the object.

Accessor

Method Details

addHandles

Inherited
Method
addHandles(handleOrHandles, groupKey)
Inherited from Accessor
Since: ArcGIS Maps SDK for JavaScript 4.25 Accessor since 4.0, addHandles added at 4.25.

Adds one or more handles which are to be tied to the lifecycle of the object. The handles will be removed when the object is destroyed.

// Manually manage handles
const handle = reactiveUtils.when(
  () => !view.updating,
  () => {
    wkidSelect.disabled = false;
  },
  { once: true }
);

this.addHandles(handle);

// Destroy the object
this.destroy();
Parameters
handleOrHandles WatchHandle|WatchHandle[]

Handles marked for removal once the object is destroyed.

groupKey *
optional

Key identifying the group to which the handles should be added. All the handles in the group can later be removed with Accessor.removeHandles(). If no key is provided the handles are added to a default group.

clampScale

Method
clampScale(scale){Number}

Clamps the scale to the closest minScale or maxScale on the scale range. If the provided scale goes beyond the allowed range, it snaps back to the clamped value.

Parameter
scale Number

The scale value from the slider.

Returns
Type Description
Number The scale number to which the slider will clamp.

contains

Method
contains(scale){Boolean}

Determines whether the given scale is within the current scale range.

Parameter
scale Number

The scale value.

Returns
Type Description
Boolean If true, the scale is contained within the range.

findScaleRangeByIndex

Method
findScaleRangeByIndex(index){NamedScaleRange}

Finds the scale range name at a given index.

Parameter
index Number

The index of the scale.

Returns
Type Description
NamedScaleRange The named scale range for the given index.

fromScaleRange

Method
fromScaleRange(minScale, maxScale){ScaleRanges}

Helper to create a ScaleRanges object from a minimum and maximum scale.

Parameters
minScale Number

The minimum scale.

maxScale Number

The maximum scale.

Returns
Type Description
ScaleRanges The scale ranges.

hasHandles

Inherited
Method
hasHandles(groupKey){Boolean}
Inherited from Accessor
Since: ArcGIS Maps SDK for JavaScript 4.25 Accessor since 4.0, hasHandles added at 4.25.

Returns true if a named group of handles exist.

Parameter
groupKey *
optional

A group key.

Returns
Type Description
Boolean Returns true if a named group of handles exist.
Example
// Remove a named group of handles if they exist.
if (obj.hasHandles("watch-view-updates")) {
  obj.removeHandles("watch-view-updates");
}

isMaxScaleEdge

Method
isMaxScaleEdge(scale){Boolean}

Determines if the input scale value can be considered to be at the smallest scale range edge.

Parameter
scale

The scale value to test against the scale range.

Returns
Type Description
Boolean If true, the input scale value is considered to be at the smallest scale range.

isMinScaleEdge

Method
isMinScaleEdge(scale){Boolean}

Determines if the input scale value can be considered to be at the largest scale range edge.

Parameter
scale

The scale value to test against the scale range.

Returns
Type Description
Boolean If true, the input scale value is considered to be at the largest scale range.

removeHandles

Inherited
Method
removeHandles(groupKey)
Inherited from Accessor
Since: ArcGIS Maps SDK for JavaScript 4.25 Accessor since 4.0, removeHandles added at 4.25.

Removes a group of handles owned by the object.

Parameter
groupKey *
optional

A group key or an array or collection of group keys to remove.

Example
obj.removeHandles(); // removes handles from default group

obj.removeHandles("handle-group");
obj.removeHandles("other-handle-group");

Type Definitions

NamedScaleRange

Type Definition
NamedScaleRange Object

The NamedScaleRange provides the minimum and maximum scale of an named scale id.

Properties
id String

The named scale range, such as "room" or "metropolitan area".

minScale Number

The minimum scale.

maxScale Number

The maximum scale.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.