Module implementing a track pad, which is simply a 2D slider.
Requires: d3@v4 du.Widget
du.widgets.trackpad.TrackPad(name[, parent])
The track pad widget class.
| arg | type | description |
|---|
| name | string | Identifier of the widget. |
| parent | object | Parent element to append widget to. If not specified, widget is appended to body. optional |
du.widgets.trackpad.TrackPad.xRange(range)
Sets the range for the horizontal dimension. Default is [0, 1].
| arg | type | description |
|---|
| range | Array | Array containing the lower and upper boundaries of the horizontal range. |
| return | description |
|---|
du.widgets.trackpad.TrackPad | Reference to the current TrackPad. |
du.widgets.trackpad.TrackPad.yRange(range)
Sets the range for the vertical dimension. Default is [0, 1].
| arg | type | description |
|---|
| range | Array | Array containing the lower and upper boundaries of the vertical range. |
| return | description |
|---|
du.widgets.trackpad.TrackPad | Reference to the current TrackPad. |
du.widgets.trackpad.TrackPad.callback(func)
Sets callback attached to the track pad. Must accept two parameter describing the position of the track pad. By default no callback is set.
| arg | type | description |
|---|
| func | function | The callback to call on value change. |
| return | description |
|---|
du.widgets.trackpad.TrackPad | Reference to the current TrackPad. |
du.widgets.trackpad.TrackPad.guide(on)
Enables the horizontal and vertical lines that help see the value of the trackpad. Default is false.
| arg | type | description |
|---|
| on | boolean | Whether guiding lines are enabled. |
| return | description |
|---|
du.widgets.trackpad.TrackPad | Reference to the current TrackPad. |