Skip to content

Commit

Permalink
handle mouseScroll while active
Browse files Browse the repository at this point in the history
  • Loading branch information
fx-lange committed Aug 12, 2015
1 parent 70fd35a commit 65eb5ac
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
9 changes: 7 additions & 2 deletions src/ofxNumEdit.cpp
Expand Up @@ -262,7 +262,7 @@ getRange(Type min, Type max, float width){

template<typename Type>
bool ofxNumEdit<Type>::mouseScrolled(ofMouseEventArgs & args){
if(mouseInside){
if(mouseInside || bGuiActive){
if(args.y>0 || args.y<0){
double range = getRange(value.getMin(),value.getMax(),b.width);
Type newValue = value + ofMap(args.y,-1,1,-range, range);
Expand Down Expand Up @@ -374,10 +374,15 @@ template<typename Type>
void ofxNumEdit<Type>::valueChanged(Type & value){
if(bChangedInternally){
bChangedInternally = false;
valueStrWidth = getTextBoundingBox(valueStr,0,0).width;
}else{
valueStr = ofToString(value);
valueStrWidth = getTextBoundingBox(valueStr,0,0).width;
if(bGuiActive){
selectIdx1 = selectIdx2 = valueStr.size();
calculateSelectionArea();
}
}
valueStrWidth = getTextBoundingBox(valueStr,0,0).width;
setNeedsRedraw();
}

Expand Down
1 change: 0 additions & 1 deletion src/ofxNumEdit.h
Expand Up @@ -5,7 +5,6 @@

/*
* TODO
* floating point (multiple)
* check min/max
* crash?
* no key spam
Expand Down

0 comments on commit 65eb5ac

Please sign in to comment.