TK.DragValue

new DragValue(optionsopt)

TK.DragValue enables dragging an element and setting a value according to the dragged distance. TK.DragValue is for example used in TK.Knob and TK.ValueButton.

Parameters:
Name Type Attributes Default Description
options Object <optional>
{ }

An object containing initial options.

Properties:
Name Type Attributes Default Description
options.node Element

The DOM node used for dragging. All DOM events are registered with this Element.

options.range function <optional>

A function returning a TK.Range object for calculating the value. Returns its parent (usually having TK.Ranged-features) by default.

options.events function <optional>

Returns an element firing the events startdrag, dragging and stopdrag. By default it returns this.parent.

options.classes Element | boolean <optional>
false

While dragging, the class toolkit-dragging will be added to this element. If set to false the class will be set on options.node.

options.get function <optional>

Callback function returning the value to drag. By default it returns this.parent.options.value.

options.set function <optional>

Callback function for setting the value. By default it calls this.parent.userset("value", [value]);.

options.direction String <optional>
"polar"

Direction for changing the value. Can be polar, vertical or horizontal.

options.active Boolean <optional>
true

If false, dragging is deactivated.

options.cursor Boolean <optional>
false

If true, a TK.GlobalCursor is set while dragging.

options.blind_angle Number <optional>
20

If options.direction is polar, this is the angle of separation between positive and negative value changes

options.rotation Number <optional>
45

Defines the angle of the center of the positive value changes. 0 means straight upward. For instance, a value of 45 leads to increasing value when moving towards top and right.

options.reverse Boolean <optional>
false

If true, the difference of pointer travel is inverted.

options.limit Boolean <optional>
false

Limit the returned value to min and max of the range.

Mixes In:
Source:

Extends

  • TK.Module

Events

dragging

Is fired while a user is dragging.

Parameters:
Name Type Description
event DOMEvent

The native DOM event.

Source:

startdrag

Is fired when a user starts dragging.

Parameters:
Name Type Description
event DOMEvent

The native DOM event.

Source:

stopdrag

Is fired when a user stops dragging.

Parameters:
Name Type Description
event DOMEvent

The native DOM event.

Source: