Search and Top Navigation
#2853 closed feature (fixed)
Opened May 13, 2008 04:53PM UTC
Closed May 27, 2008 07:28PM UTC
Last modified February 26, 2009 12:10PM UTC
ui-slider: More calculation errors
Reported by: | making718 | Owned by: | paul |
---|---|---|---|
Priority: | major | Milestone: | 1.5 |
Component: | ui.slider | Version: | 1.5b4 |
Keywords: | slider | Cc: | |
Blocked by: | Blocking: |
Description
I've been playing with the most recent version of the slider. I have found that sometimes when using the arrow keys to change the value of the slider, the handle will get stuck. I found that the convertValue function sometimes returns a number like 21.999999 instead of 22. I have fixed the problem with the arrow keys by changing these lines in the moveTo function.
Store the slider's value this.currentHandle.data("mouse").sliderValue = {
x: this.convertValue(x, "x"),
y: this.convertValue(y, "y")
};
to
Store the slider's value this.currentHandle.data("mouse").sliderValue = {
x: Math.round(this.convertValue(x, "x")),
y: Math.round(this.convertValue(y, "y"))
};
Attachments (0)
Change History (5)
Changed May 13, 2008 05:02PM UTC by comment:1
Changed May 24, 2008 03:39AM UTC by comment:2
milestone: | 1.2.4 |
---|
Milestone 1.2.4 deleted
Changed May 24, 2008 07:16PM UTC by comment:3
component: | ui.core → ui.slider |
---|---|
version: | 1.2.3 → 1.5b4 |
Changed May 27, 2008 07:28PM UTC by comment:4
resolution: | → fixed |
---|---|
status: | new → closed |
Changed February 26, 2009 12:10PM UTC by comment:5
milestone: | → 1.5 |
---|
After some more testing I found that there are sometimes values that I was not even able to drag the slider to, so I added Math.round to the return of convertValue to fix this problem.
convertValue: function(value,axis) {
return Math.round(this.options.min[axis] + (value / (this.actualSize[axis == "x" ? "width" : "height"] - this.handleSize(null,axis))) * this.options.realMax[axis]);
}
Replying to [ticket:2853 making718]: