pencil.js
Version:
Nice modular interactive 2D drawing library.
75 lines (74 loc) • 1.81 kB
TypeScript
/**
* @module Checkbox
*/
/**
* Checkbox class
* <br><img src="./media/examples/checkbox.png" alt="checkbox demo"/>
* @class
* @extends {module:Input}
*/
export default class Checkbox {
/**
* @typedef {Object} CheckboxOptions
* @extends InputOptions
* @prop {Number} [size=20] - Width and height of the checkbox
* @prop {Boolean} [value=false] - Whether it's check ot not
*/
/**
* @type {CheckboxOptions}
*/
static get defaultOptions(): any;
/**
* Margin around the filling square in ratio
* @type {Number}
*/
static get MARGIN(): number;
/**
* Checkbox constructor
* @param {PositionDefinition} positionDefinition - Top-left corner
* @param {CheckboxOptions} [options] - Specific options
*/
constructor(positionDefinition: PositionDefinition, options?: any);
fill: Square;
/**
* Set it's width
* @param {Number} value - Width of the checkbox
*/
set width(value: number);
/**
* Get it's width
* @return {Number}
*/
get width(): number;
/**
* Set it's height
* @param {Number} value - Height of the checkbox
*/
set height(value: number);
/**
* Get it's height
* @return {Number}
*/
get height(): number;
/**
* @inheritDoc
*/
click(): void;
/**
* Inverse whether it's checked
* @param {Boolean} [newValue] - If defined, will force the value
* @return {Boolean}
*/
toggle(newValue?: boolean): boolean;
/**
* Change whether it's checked
* @param {Boolean} value - New value
*/
set value(value: boolean);
/**
* Return whether it's checked
* @return {Boolean}
*/
get value(): boolean;
}
import Square from "@pencil.js/square";