Class: ColorSlider

vef.ui.color.ColorSlider(target, colorScale)

color scale slider for changing the values of a color scale. Used internally by ColorScalePicker

Constructor

new ColorSlider(target, colorScale)

Parameters:
Name Type Description
target HTMLElement | string
colorScale Array.<object> initial color scale events: slide: on dragging handles with mouse stop: stop dragging handles with mouse select: click/select handle with mouse deselect: no handle is selected anymore
Author:
Source:

Methods

addHandle(options)

Add a ne handle (color-item) to the ColorSlider options = { color: "#000000", value: 0, opacity: 1 }
Parameters:
Name Type Description
options object
Source:

clear()

Remove al handles/color-ítems
Source:

deselectHandle()

set the ColorSlider to deselected and trigger the "deselect" event
Source:

getColorScale()

get the current color scale as an array
Source:
Returns:
[object[]]

getHandle(index) → {object}

Get a handle objec by index
Parameters:
Name Type Description
index number
Source:
Returns:
Type
object

getLength() → {number}

Get the amount of items/handles
Source:
Returns:
Type
number

getSelectedHandle() → {object}

get the currently selected handle object
Source:
Returns:
Type
object

invertScale(min, max)

Invert the color scale value order
Parameters:
Name Type Description
min number
max number
Source:

removeHandle(handle)

Remove a handle object from the ColorSlider
Parameters:
Name Type Description
handle object
Source:

selectHandle(handle)

Select a handle object and trigger the "select" event
Parameters:
Name Type Description
handle object
Source:

setColorScale(colorScale)

Set the ColorSlider Values from an existing color scale array
Parameters:
Name Type Description
colorScale Array.<object>
Source:

stretchToScale(min, max)

stretch values linear from min to max
Parameters:
Name Type Description
min number
max number
Source:

update(autoMinMax)

Update the positions of the handles based on their values and re-render the color gradient
Parameters:
Name Type Description
autoMinMax boolean stretch min/max to value extent
Source: