ScaleRangeSliderViewModel

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

Provides the logic for the ScaleRangeSlider widget.

See also
Example
const view = new MapView({
  container: "viewDiv",
  map: map
});

const scaleRangeSlider = new ScaleRangeSlider({
  viewModel: {  // autocasts as new ScaleRangeSliderViewModel()
    view: view
  }
}, "scaleRangeSliderDiv");

Constructors

ScaleRangeSliderViewModel

Constructor
new ScaleRangeSliderViewModel(properties)
Parameter
properties Object
optional

See the properties for a list of all the properties that may be passed into the constructor.

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

The name of the class.

Accessor

When provided, the initial minScale and maxScale values will match the layer's.

ScaleRangeSliderViewModel

The maximum scale of the active scale range.

ScaleRangeSliderViewModel

The lowest possible maximum scale value from the slider.

ScaleRangeSliderViewModel

The minimum scale of the active scale range.

ScaleRangeSliderViewModel

The highest possible minimum scale value from the slider.

ScaleRangeSliderViewModel

The valid scale ranges available based on the slider position.

ScaleRangeSliderViewModel

The SliderViewModel for supporting the scale range slider widget.

ScaleRangeSliderViewModel

The current state of the widget.

ScaleRangeSliderViewModel

A reference to the MapView or SceneView.

ScaleRangeSliderViewModel

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.

layer

Property
layer Layer

When provided, the initial minScale and maxScale values will match the layer's.

When a tiled layer is used, the slider will be restricted from moving the slider thumbs past the lods of the layer's tiling scheme. Since version 4.28, when a MapImageLayer is used, the slider will be restricted from moving past the min/max scale defined on the map service. The unavailable scale range will be designated with a dashed line.

maxScale

Property
maxScale Number

The maximum scale of the active scale range. When the maxScale reaches the maxScaleLimit, the maxScale value becomes 0 and there is no maximum scale set.

maxScaleLimit

Property
maxScaleLimit Number

The lowest possible maximum scale value from the slider.

minScale

Property
minScale Number

The minimum scale of the active scale range. When the minScale reaches the minScaleLimit, the minScale value becomes 0 and there is no minimum scale set.

minScaleLimit

Property
minScaleLimit Number

The highest possible minimum scale value from the slider.

scaleRanges

Property
scaleRanges ScaleRangesreadonly

The valid scale ranges available based on the slider position.

sliderViewModel

Property
sliderViewModel SliderViewModel

The SliderViewModel for supporting the scale range slider widget.

state

Property
state Stringreadonly

The current state of the widget.

Possible Values:"disabled" |"ready"

Default Value:disabled

view

Property
view MapView |SceneView

A reference to the MapView or SceneView. Set this to link the widget to a specific view.

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

Returns true if a named group of handles exist.

Accessor

Utility method for converting scale-to-slider values.

ScaleRangeSliderViewModel

Utility method for converting slider-to-scale values.

ScaleRangeSliderViewModel

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.

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");
}

mapScaleToSlider

Method
mapScaleToSlider(scale){Number}

Utility method for converting scale-to-slider values.

Parameter
scale Number

The map scale to be converted.

Returns
Type Description
Number The value of the slider.

mapSliderToScale

Method
mapSliderToScale(value){Number}

Utility method for converting slider-to-scale values.

Parameter
value Number

The value of the slider.

Returns
Type Description
Number The map scale that corresponds to the value of the slider.

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");

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