class PSlider { float xpos, ypos; float x, y; float w, l; float delL ; float delS ; float maxv, minv, ratio, slv; String label; boolean dragging = false; PSlider( float x1, float y1, float len1, float h1, String lab1, float minv1, float maxv1 ) { rectMode(CORNER); xpos = x1; ypos = y1; w = h1; l = len1; x = x1 + l/2.0 -w/2; y = y1; maxv = maxv1; minv = minv1; delS = (l-3*w)/(maxv- minv)/100; delL = delS*10; ratio = (maxv - minv)/(l-3*w); slv = round(10000*(x-xpos - w)*ratio)/10000 + minv; label = lab1; } void initPos (float slv_init) { x =(slv_init -minv ) * (l-3.0*w)/(maxv - minv) +xpos +w ; } boolean over(){ boolean result = false; if (mouseX>xpos && mouseXypos && mouseYxpos && mouseXy && mouseYxpos+l-w && mouseXy && mouseYx + w && mouseXy && mouseYxpos+w && mouseXy && mouseYx && mouseXy && mouseYx && mouseXxpos+w) x -= delL; fill(200, 200,255); rect( xpos+w, y, x-xpos -w, w ); } void incByOneL(){ if (xxpos+w+delS/10) x -= delS; fill(200, 255, 200); rect( xpos, y, w, w ); } void incByOneS(){ if (x