Bug Tracker

Modify

Ticket #2853 (closed feature: invalid)

Opened 5 years ago

Last modified 3 years ago

ui-slider: More calculation errors

Reported by: making718 Owned by: paul
Priority: major Milestone: 1.2.4
Component: ui Version: 1.2.3
Keywords: slider Cc:
Blocking: Blocked by:

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"))

};

Change History

comment:1 in reply to: ↑ description Changed 5 years ago by making718

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 making718:

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"))

};

comment:2 Changed 3 years ago by dmethvin

  • Status changed from new to closed
  • Resolution set to invalid

This should be filed in the UI bug tracker if still relevant.

 http://dev.jqueryui.com

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.