This class is meant as an emulation of SC2DSlider. last mod: 17-jul-09 sciss
Also refer to JSCView for different behaviour affecting all widgets
different behaviour | |
knob | slightly bigger (15x15 pixels vs. 12x12) |
known issues / todo | |
focus border | (FIXED?) not adjusted when resizing the component |
Note: please use the abstraction layer Slider2D if possible!
A rectangular element that allows you to control two parameters simultaneously by moving a knob horizontally and vertically.
( var win; win = JSCWindow( "JSCSlider2D", Rect( 100, 100, 340, 140 ), resizable: false ); n = JSCSlider2D( win, Rect( 20, 20, 80, 80 )).x_( 1 ).y_( 1 ); n.knobColor_( Color( 0.75, 0.125, 0.25, 0.8 )); n = JSCSlider2D( win, Rect( 120, 20, 80, 80 )).x_( 0.5 ).y_( 0.5 ); n.knobColor_( Color( 0.125, 0.6, 0.25, 0.8 )); n = JSCSlider2D( win, Rect( 220, 20, 80, 80 )).x_( 0 ).y_( 0 ); n.knobColor_( Color( 0.125, 0.25, 0.75, 0.8 )); win.front; ) // assign an action function. note that 'n' holds the right most (blue) slider. n.action = { arg b; ("x = "++b.x++"; y = "++b.y).postln }; n.enabled_( false ); n.enabled_( true ); n.x_( 0.66 ); n.y_( 0.33 ); // snap values n.step_( 0.25 ); // no snapping n.step_( 0.0 );
Drag and drop returns and accepts Points. Hold ctrl key to initiate a drag.
R | random x/y |
N | minimum x/y |
X | maximum x/y |
C | center x/y |
csr left/down | decrease x/y |
csr right/up | increase x/y |