Skip to content

Commit

Permalink
Merge pull request #575 from laeubi/only_update_on_change
Browse files Browse the repository at this point in the history
Only fire a selection event when the value changes
  • Loading branch information
lcaron authored Mar 16, 2024
2 parents 27bfb29 + 2659986 commit ee2548d
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -255,10 +255,13 @@ private void addMouseListeners() {

// Update value
final float ratio = (float) xPosition / originalWidth;
value = (int) Math.floor(ratio * (maximum - minimum));

SelectionListenerUtil.fireSelectionListeners(this,e);
int value = (int)Math.floor(ratio * (maximum - minimum));
if(this.value != value) {
this.value = value;
SelectionListenerUtil.fireSelectionListeners(this, e);
}
redraw();

});
}

Expand Down

0 comments on commit ee2548d

Please sign in to comment.