astro-pi / beta-testing

Bug tracker for the Trinket Sense HAT emulator
https://trinket.io/sense-hat
3 stars 0 forks source link

Sensor sliders increments #21

Closed rik-cross closed 8 years ago

rik-cross commented 8 years ago

The temperature slider increments in such a way that it's sometimes impossible to set the temperature to a desired integer amount.

For example, when testing the sensor I can get the slider to 33.1 degrees and 34.7 degrees, but nothing in between.

screen shot 2016-07-21 at 09 52 25 screen shot 2016-07-21 at 09 52 13

In fact, the increment steps seem to depend on the size of the sense HAT window in the Trinket. A smaller window gives bigger increments, and a bigger Trinket window gives smaller increments.

davidhoness commented 8 years ago

Yeah the increment size changes if you resize the window divider. So I think this may be an artefact of the slider control being used, a JQuery one I presume?

brianpmarks commented 8 years ago

We're using rangeslider.js which seems like a good implementation but may not be best suited for this use case due to both the step issue discussed here as well as the loading issue in astro-pi/beta-testing#8.

Because of these issues I wonder what thoughts are on switching the sliders over to a number type input? Other advantages of it include implicit validation (both restricting non-numerical characters as well as enforcement of min, max, and step attributes) and the ability to use arrow keys to increase or decrease the value (or of course to simply type in an explicit value.) For non-HTML5 browsers we could add our own validation.

While I think the sliders look nice, I think the input element might be more practical. I'll work up a prototype of this and welcome any feedback on the idea in the meantime.

davidhoness commented 8 years ago

I would prefer to keep the sliders please. I'm actually not too worried about this issue since there is a way for users to select the granularity that they want. If #8 is being caused by the slider control itself though can we change to different control before we move on?

eah13 commented 8 years ago

We could try a naked range input element, or fall back to that in some cases. I've still got hope though that we can diagnose and fix this.

brianpmarks commented 8 years ago

@davidhoness Thanks for the feedback. I was worried that the step granularity would be a bigger issue. I think the other issue can be solved.

eah13 commented 8 years ago

This is fixed as best we can-some of the limitations are inherent to sliders.

We've limited the granularity of the sliders to whole numbers, which helps a lot with Temp and Humidity. Pressure can still be tough to get exactly because the browser has trouble breaking the slider up into hundreds of increments.

Give this a whirl and see if it's good enough. If the pressure precision is distracting we could start it at 1010hPa and limit it to increments of 10hPa and it'd be much easier to operate with little loss in functionality. Currently in most screen configurations it's hard or impossible to get back to 1013hPa once it's been adjusted.

Closing as fixed but as with other issues please continue to discuss here if you have comments