GMSymbol2DSlider:
Filter:
GraphicalModule/Classes (extension) | GUI > Graphical Module

GMSymbol2DSlider
ExtensionExtension

A simple 2D slider for creating graphical interfaces.

Description

GMSymbol2DSlider is an easy to use customisable slider.

It inherits from the GMZZ2DSlider class, and is only responsible for graphical specifications. See GMZZSlider and GMZZ2DSlider for non-graphical properties settings.

A note about this documentation

This class is an extension of the GMSymbolSlider class. It retains the same principle, but for two axis at once instead of one. As such, you should read the GMSymbolSlider class documentation first, as only differences between those two classes are documented here.

Helpers style

The \dot helper style is pretty straightforward and will display a grid composed of dots on the view. The \centerValues parameter is ignored in this case :

The \line helper style allows several configurations.

If the helpersRatio parameter is set to 1, it will then display a grid on the view, and render the \centerValues parameter useless :

Otherwise, it becomes possible to center the helpers on the view :

This can be used to differentiate the scales polarities :

Class Methods

.new

Creates a new instance of GMSymbol2DSlider.

By default, its graphical properties are defined by its associated GMStyle. This means that creating sliders with different colors implies creating multiples GMStyle. The font color of the displayed value corresponds to the valueFontColor property.

Returns:

a GMSymbol2DSlider instance.

Instance Methods

.displayLine

Sets or gets wether the handle position should be highlighted with lines on each view axis.

.drawLine

Deprecated. Use displayLine instead.

.xDisplayFunction

Sets or gets the Function that will be used to adapt the value displayed on the horizontal axis if needed. Set to nil to disable.

.yDisplayFunction

Sets or gets the Function that will be used to adapt the value displayed on the vertical axis if needed. Set to nil to disable.

.svg

Sets a path to a valid SVG file to be displayed on top of the widget's background.

.svgRatio

Sets or gets the background SVG's size ratio relative to the widget size.

.free

Frees the current background SVG, allowing garbage collection.

GMSymbolSlider Methods

See the GMSymbolSlider class documentation for those methods.

.symbol

.symbolMinSize

.symbolMaxSize

.symbolRatio

.displayValues

.roundValues

.fontRatio

.displayHelpers

.drawHelpers

.centerHelpers

.helpersRatio

.helpersStyle

Internal Methods

.draw

.prDrawSlider

.prDrawValues

.prDrawLineHelpers

.prDrawDotHelpers

.prResizeSVG

Examples

2D sliders are amazing to create simple drone instruments :

In the context of Frequency Modulation, using a 2D slider allows to control the two parameters at once : the modulators frequency ratio, and the modulators index.

In this example, helpers are configured so that if one holds CTRL + SHIFT, the frequency ratio (on the vertical axis) will snap to a 'natural' ratio (0.25, 0.5, 1, 2, etc), thus producing an harmonic sound.

Once the desired ratio has been set, one can hold the CTRL key (but not the SHIFT key) to modify the index value without modifying the ratio value :