Socket
Socket
Sign inDemoInstall

@ircam/gui-components

Package Overview
Dependencies
0
Maintainers
3
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @ircam/gui-components

Set of simple GUI components


Version published
Weekly downloads
6
increased by500%
Maintainers
3
Install size
102 kB
Created
Weekly downloads
 

Readme

Source

GUI-Components

Set of simple gui components (to be extended)

Install

npm install [--save] @ircam/gui-components

Available Components

  • Slider - example

Usage

import { Slider} from '@ircam/gui-components';

const slider = new Slider({
  mode: 'jump',
  container: '#container',
  default: 0.6,
  markers: [0.5],
  callback: (value) => console.log(value),
});

API

gui-components

gui-components~Slider

Versatile canvas based slider.

Kind: inner class of gui-components

new Slider(options)
ParamTypeDefaultDescription
optionsObjectOverride default parameters.
[options.mode]'jump' | 'proportionnal' | 'handle''jump'Mode of the slider: - in 'jump' mode, the value is changed on 'touchstart' or 'mousedown', and on move. - in 'proportionnal' mode, the value is updated relatively to move. - in 'handle' mode, the slider can be grabbed only around its value.
[options.callback]functionCallback to be executed when the value of the slider changes.
[options.width]Number200Width of the slider.
[options.height]Number30Height of the slider.
[options.min]Number0Minimum value.
[options.max]Number1Maximum value.
[options.step]Number0.01Step between each consecutive values.
[options.default]Number0Default value.
[options.container]String | Element'body'CSS Selector or DOM element in which inserting the slider.
[options.backgroundColor]String'#464646'Background color of the slider.
[options.foregroundColor]String'steelblue'Foreground color of the slider.
[options.orientation]'horizontal' | 'vertical''horizontal'Orientation of the slider.
[options.markers]Array[]List of values where markers should be displayed on the slider.
[options.showHandle]BooleantrueIn 'handle' mode, define if the draggable should be show or not.
[options.handleSize]Number20Size of the draggable zone.
[options.handleColor]String'rgba(255, 255, 255, 0.7)'Color of the draggable zone (when showHandle is true).

Example

import { Slider} from 'gui-components';

const slider = new Slider({
  mode: 'jump',
  container: '#container',
  default: 0.6,
  markers: [0.5],
  callback: (value) => console.log(value),
});

slider.value : Number

Current value of the slider.

Kind: instance property of Slider

slider.reset()

Reset the slider to its default value.

Kind: instance method of Slider

slider.resize(width, height)

Resize the slider.

Kind: instance method of Slider

ParamTypeDescription
widthNumberNew width of the slider.
heightNumberNew height of the slider.

License

BSD-3-Clause

FAQs

Last updated on 07 Nov 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc