Class: LayerOpacityView

LayerOpacityView()

A number slider that shows and updates the opacity in a MapAsset model. Changing the opacity of a layer will also make it visible, if it was not visible before (i.e. this view also updates the MapAsset's visible attribute.)

Screenshot

Constructor

new LayerOpacityView()

Since:
  • 2.18.0
Source:

Extends

  • Backbone.View

Members

className :string

The HTML classes to use for this view's element
Type:
  • string
Source:

classes :Object

CSS classes assigned to the HTML elements that make up this view
Type:
  • Object
Properties:
Name Type Description
sliderContainer string The element that will be converted by this view into a number slider widget. An element with this class must exist in the template.
handle string The class given to the element that acts as a handle for the slider UI. The handle is created during render and the class is set by the jquery slider widget.
range string The class given to the element that shades the slider from 0 to the current opacity. The range is created during render and the class is set by the jquery slider widget.
label string The element that displays the current opacity value as a percentage. This element is created during render.
Source:

events :Object

The events this view will listen to and the associated function to call.
Type:
  • Object
Source:

model :MapAsset

The model that this view uses
Type:
Source:

template :Underscore.template

The primary HTML template for this view
Type:
  • Underscore.template
Source:

type :string

The type of View this is
Type:
  • string
Source:

Methods

initialize(optionsopt)

Executed when a new LayerOpacityView is created
Parameters:
Name Type Attributes Description
options Object <optional>
A literal object with options to pass to the view
Source:

onClose()

Perform clean-up functions when this view is about to be removed from the page or navigated away from.
Source:

render() → {LayerOpacityView}

Renders this view
Source:
Returns:
Returns the rendered view element
Type
LayerOpacityView

updateLabel(newOpacity)

Update the label with the newOpacity displayed as a percentage
Parameters:
Name Type Description
newOpacity Number A number between 0 and 1 indicating the new opacity value for the MapAsset model
Source:

updateModel(newOpacity)

Update the MapAsset model's opacity attribute with a new value.
Parameters:
Name Type Description
newOpacity Number A number between 0 and 1 indicating the new opacity value for the MapAsset model
Source:

updateSlider()

Get the new opacity value from the model and update the slider handle position and label. This function is called whenever the model opacity is updated.
Source: