I was wondering if this is possible…
to improve the sliders visually and change 2.8e15 to 0.000028 or 0.000.
if there’s something like a setPrecision(3) could do the job
You can add following lines in ofxSlider.h and ofxSlider.cpp
// ofxSlider.h
// somewhere in the public section
int precision = 0;
void setPrecision(int p){precision = p;};
// ofxSlider.cpp
// around line 230
void ofxSlider<Type>::generateText(){
//string valStr = toString(value.get()); // original code
string valStr = ofToString(value.get(), precision);
...
And then use it like following.
// ofApp.h
ofxFloatSlider mySlider;
// ofApp.cpp
mySlider.setPrecision(4);
I did a quick test and it is working.
But it might cause an unexpected side effect because of a template.
2 Likes