TK.DragValue

new DragValue(options)

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

Parameters:
Name Type Description
options Object
Properties:
Name Type Attributes Default Description
options.range function

A function returning a TK.Range object for calculating the value.

options.node Element

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

options.events Element <optional>
options.node

A DOM element firing the drag events.

options.classes Element <optional>
options.node

While dragging, the class toolkit-dragging will be added to this Element.

options.get function

Callback function returning the value to drag.

options.set function

Callback function for setting the 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 global cursor 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.

Mixes In:
Source:

Extends

  • TK.Module

Events

startdrag

Is fired when a user starts dragging.

Parameters:
Name Type Description
event DOMEvent

The native DOM event.

Source:

startdrag

Is fired while a user is 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: