Opened 12 years ago

Closed 12 years ago

Last modified 8 years ago

#3982 closed defect (fixed)

Slider: doesn't always respect discreteValues with showButtons="true"

Reported by: guest Owned by: Douglas Hays
Priority: high Milestone: 1.0
Component: Dijit - Form Version: 0.9
Keywords: Cc:
Blocked By: Blocking:

Description

HOW TO REPRODUCE:

Go to <http://82.230.65.68:31416/~fred/dojo/fred_samples/bug_001.html> Press '+' on first slider Press '+' on second slider

RESULT:

First slider Value = 0.024793388429752067 Second slider Value = 0.01

EXPECTED RESULT:

First slider Value = 0.01 Second slider Value = 0.01

Attachments (1)

bug_001.html (1.3 KB) - added by guest 12 years ago.
Content of mentionned file

Download all attachments as: .zip

Change History (9)

Changed 12 years ago by guest

Attachment: bug_001.html added

Content of mentionned file

comment:1 Changed 12 years ago by guest

This is on Mac OS X, Firefox, with dojo 0.9, serial #9050

comment:2 Changed 12 years ago by guest

phiggins on irc said:

	phiggins	in /dijit/form/Slider.js
	phiggins	var count = this.discreteValues; if(count > maxPixels){ count = maxPixels; } count--;
	phiggins	var pixelsPerValue = maxPixels / count; var wholeIncrements = Math.round(pixelValue / pixelsPerValue);
	phiggins	the pixels are off

don't fully know what that means :-)

comment:3 Changed 12 years ago by Adam Peller

Owner: changed from bill to Douglas Hays

comment:4 Changed 12 years ago by bill

Milestone: 1.0

Hmm, it's a pretty obscure case where a slider has more discrete values than pixels (in this case 301 vs 200), but I suppose you could make + work to just go one value even if it's the same pixel... don't know how much work that is though and whether or not it's worth it. Marking to consider for 1.0.

comment:5 Changed 12 years ago by guest

I'm the original reporter

If the correct fix is too complex (having subpixels values), there are 2 others possible fixes:

1)Using a multiple of the increment: that way, in a slider having 301 values and only 200 pixels, we would have '+' moving by 2 values. That would be good enough, and should not be too difficult to implement.
2) Even simpler, '+' could be plainly disabled if there is not enough space (or could simply increment the value of '0'), because if a UI designed chose a Slider it is because the "analog" feedback is more important than a precise value entry.

I think the current behavior is very wrong because:

1) Having a Slider that is integer based returning non integral values is a major breach on contract
2) The bug will appear depending on the browser width (so an app with no issue on a Desktop will break on a mobile phone, for instance).

comment:6 Changed 12 years ago by bill

Summary: dijit.form.HorizontalSlider don't always respect discreteValues with showButtons="true"Slider: doesn't always respect discreteValues with showButtons="true"

comment:7 Changed 12 years ago by Douglas Hays

Resolution: fixed
Status: newclosed

(In [10352]) Fixes #3982. Allow subpixel values.

comment:8 Changed 8 years ago by bill

Component: DijitDijit - Form
Note: See TracTickets for help on using tickets.