UNPKG

pencil.js

Version:

Nice modular interactive 2D drawing library.

92 lines (91 loc) 2.15 kB
/** * @module Knob */ /** * Knob class * <br><img src="./media/examples/knob.png" alt="knob demo"/> * @class * @extends {module:Input} */ export default class Knob { /** * @typedef {Object} KnobOptions * @prop {Number} [min=0] - Minimum value when the knob is at lowest * @prop {Number} [max=10] - Maximum value when the knob is at highest * @prop {Number} [value=0] - Initial value * @prop {Number} [radius=100] - Radius of the knob */ /** * @type {KnobOptions} */ static get defaultOptions(): { /** * - Minimum value when the knob is at lowest */ min?: number; /** * - Maximum value when the knob is at highest */ max?: number; /** * - Initial value */ value?: number; /** * - Radius of the knob */ radius?: number; }; /** * Width of the rotation marker * @type {Number} */ static get NOTCH_SIZE(): number; /** * knob constructor * @param {PositionDefinition} positionDefinition - Position of the center * @param {KnobOptions} [options] - Specific options */ constructor(positionDefinition: PositionDefinition, options?: { /** * - Minimum value when the knob is at lowest */ min?: number; /** * - Maximum value when the knob is at highest */ max?: number; /** * - Initial value */ value?: number; /** * - Radius of the knob */ radius?: number; }); /** * Set this knob's radius * @param {Number} value - Radius of the knob */ set radius(value: number); /** * Get this knob's radius * @return {Number} */ get radius(): number; /** * @inheritDoc */ click(): void; /** * Change this current value * @param {Number} newValue - A new value to set */ set value(newValue: number); /** * Returns this current value * @return {Number} */ get value(): number; }