/ui/elements/layerStyle

The module exports an object of methods to for the creation of layer style elements.

Dictionary entries:

  • layer_style_display_hover
  • layer_style_display_labels
  • layer_style_opacity
  • layer_style_select_theme
  • icon_scaling_field
  • icon_scaling_label
  • icon_scaling_cluster
  • icon_scaling_zoom_in
  • icon_scaling_zoom_out

Requires

Methods

(inner) applyTheme(layer)

The applyTheme method assigns the label and hover configuration referenced by the setLabel and setHover keys of the current theme.

The method is called from the panel method prior to the creation of the style elements. The label and hover elements are therefore created for the configuration assigned by the current theme.

Parameters:
NameTypeDescription
layerlayer

A decorated mapp layer with a style object.

Properties
NameTypeAttributesDescription
layer.stylelayer-style

The layer style configuration.

style.themeObject<optional>

The current theme.

theme.setLabelstring<optional>

Key for label from style.labels{} to assign.

theme.setHoverstring<optional>

Key for hover from style.hovers{} to assign.

(inner) hover(layer) → {HTMLElement}

The hover() style element method will return a checkbox to toggle the display of the current hover.

Parameters:
NameTypeDescription
layerlayer

A decorated mapp layer with a style object.

Properties
NameTypeDescription
layer.stylelayer-style

The layer style configuration.

style.hoverObject

The current hover.

hover.hiddenBoolean

Whether a checkbox should be returned.

hover.displayBoolean

The state of the hover.

Returns:

A checkbox element to toggle the current hover.

Type: 
HTMLElement

(inner) hovers(layer) → {HTMLElement}

The hovers() style element method will return a dropdown to change the current hover assigned to a layer.

Parameters:
NameTypeDescription
layerlayer

A decorated mapp layer with a style object.

Properties
NameTypeDescription
layer.stylelayer-style

The layer style configuration.

style.hoverObject

The current hover.

style.hoversObject

Object where each property represents a hover configuration.

Returns:

A dropdown element to switch the current hover.

Type: 
HTMLElement

(inner) icon_scaling(layer) → {HTMLElement}

The icon_scaling() style element method will returns a contents array with controls for icon.scaling properties (field, icon, clusterScale, zoomInScale, and zoomOutScale).

Parameters:
NameTypeDescription
layerlayer

A decorated mapp layer with a style object.

Properties
NameTypeAttributesDescription
layer.stylelayer-style

The layer style configuration.

style.icon_scalingObject

The icon_scaling config.

icon_scaling.hiddenBoolean

Do not show icon_scaling controls in panel.

icon_scaling.fieldString<optional>

Assign field value as feature property for scaling point feature icons.

icon_scaling.fieldsObject<optional>

An Object of objects with fields that can be assigned the feature property for scaling.

icon_scaling.iconBoolean<optional>

Add control to alter the base icon scale.

icon_scaling.clusterScaleBoolean<optional>

Add control to alter the cluster.clusterScale value.

icon_scaling.zoomInScaleBoolean<optional>

Add control to alter the zoomInScale value.

icon_scaling.zoomOutScaleBoolean<optional>

Add control to alter the zoomOutScale value.

Returns:
with contents array of HTMLElements to control icon scaling.
Type: 
HTMLElement

(inner) label(layer) → {HTMLElement}

The label() style element method will return a checkbox to toggle the display of the current label.

Parameters:
NameTypeDescription
layerlayer

A decorated mapp layer with a style object.

Properties
NameTypeDescription
layer.stylelayer-style

The layer style configuration.

style.labelObject

The current label.

label.hiddenBoolean

Whether a checkbox should be returned.

label.displayBoolean

The state of the label.

Returns:

A checkbox element to toggle the current label.

Type: 
HTMLElement

(inner) labels(layer) → {HTMLElement}

The labels() style element method will return a dropdown to change the current label assigned to a layer.

Parameters:
NameTypeDescription
layerlayer

A decorated mapp layer with a style object.

Properties
NameTypeDescription
layer.stylelayer-style

The layer style configuration.

style.labelObject

The current label.

style.labelsObject

Object where each property represents a label configuration.

Returns:

A dropdown element to switch the current label.

Type: 
HTMLElement

(inner) panel(layer) → {HTMLElement}

The panel() style element method creates an array of style.elements from all available style property keys if not implicit.

The elements array will be mapped to return a flat array of HTMLElements as content for the layer.style.view node.

The layer.style.view is returned for the style drawer shown in the default mapp view layer.view.

Parameters:
NameTypeDescription
layerlayer

A decorated mapp layer with a style object.

Properties
NameTypeAttributesDescription
layer.stylelayer-style

The layer style configuration.

style.elementsArray<optional>

Array of method keys to order elements in the layer.style.view.

style.legendHTMLElement<optional>

The legend node created by the theme element method.

layer.showCallbacksArray

Array of methods executed on layer.show().

Returns:

The layer.style.view element.

Type: 
HTMLElement

(inner) theme(layer) → {HTMLElement}

The theme() style element method will returns a content array with elements for the theme meta text and legend.

Parameters:
NameTypeDescription
layerlayer

A decorated mapp layer with a style object.

Properties
NameTypeAttributesDescription
layer.stylelayer-style

The layer style configuration.

style.legendHTMLElement<optional>

The legend node created by the theme method into which the drawLegend method renders.

style.themeObject

The current theme.

theme.metastring<optional>

Meta text to display.

theme.meta_nodeHTMLElement<optional>

The node created for the theme.meta text.

Returns:
with contents array for the theme meta and legend.
Type: 
HTMLElement

(inner) themes(layer) → {HTMLElement}

The themes() style element method will return a dropdown to change the current theme assigned to a layer.

The dropdown callback assigns the theme selected from the style.themes{} configuration and recreates the style panel for the current theme.

A location layer entry has no style drawer. The elements from the panel method replace the children of the entry style.panel. The children of a new style drawer replace those of the style drawer in the layer.view otherwise. The targets are exclusive since a node can only be moved into one parent.

Parameters:
NameTypeDescription
layerlayer

A decorated mapp layer with a style object.

Properties
NameTypeAttributesDescription
layer.stylelayer-style

The layer style configuration.

style.panelHTMLElement<optional>

The style panel element of a location layer entry.

style.themeObject

The current theme.

style.themesObject

Object where each property represents a theme.

theme.titlestring<optional>

Theme title for the dropdown placeholder and entries.

layer.viewHTMLElement<optional>

The layer view containing the style drawer element.

layer.reloadfunction

The layer reload method called after the theme has been set.

Returns:

A dropdown element to switch the current theme.

Type: 
HTMLElement

(inner) zoomLabel(layer)

The method checks whether the label object has a min or maxZoom restriction and will toggle the status of the associated checkbox.

Parameters:
NameTypeDescription
layerlayer

A decorated mapp layer with a style object.