HanSolo / SteelSeries-Canvas

The HTML5 Canvas port of the SteelSeries component library. Mainly contains gauges.
120 stars 76 forks source link

Min/MaxMeasuredValue anomalies #5

Closed nickmcgill closed 11 years ago

nickmcgill commented 11 years ago

Hi, I've just started playing with your library, and have found a problem with the linear gauge if min & max values have been changed, and min/maxMeasured values are used. It's probably easiest to see the problem than describe, so here's a simple example:

function init(){
    linear = new steelseries.Linear('canvasLinear', {
                            width: 140,
                            height: 320,
                            lcdVisible: true,
                            minValue: 50,
                            maxValue: 150,
                            thresholdVisible: false,
                            ledVisible: false,
                            lcdDecimals: 0,
                            minMeasuredValueVisible: true,
                            maxMeasuredValueVisible: true
               });
            linear.setValueAnimated(75);
            linear.setMaxMeasuredValue(100);
            linear.setMinMeasuredValue(55);

    linear2 = new steelseries.Linear('canvasLinear2', {
                            width: 140,
                            height: 320,
                            gaugeType: steelseries.GaugeType.TYPE2,
                            unitString: 'deg C',
                            lcdVisible: true,
                            minValue: -10,
                            maxValue: 45,
                            thresholdVisible: false,
                            ledVisible: false,
                            lcdDecimals: 0,
                            minMeasuredValueVisible: true,
                            maxMeasuredValueVisible: true
               });
   linear2.setMinMeasuredValue(5);
   linear2.setMaxMeasuredValue(32);
   linear2.setValueAnimated(19);

}

(sorry, had to strip the html wrapper!)

Cheers

Nick

mcrossley commented 11 years ago

You're right, something very wrong there, let me do some investigation. It may take a day or two, I'm busy over Christmas with family etc.

nickmcgill commented 11 years ago

Thanks - no rush. Enjoy the rest of Christmas.

nickmcgill commented 11 years ago

I've found a fix that seems to work

https://dl.dropbox.com/u/46037093/steelseries.diff

HTH

Nick

mcrossley commented 11 years ago

That makes sense, taking into account non-zero minimum values.

Cheers Mark

sent from my Android ICS Touchpad On Dec 26, 2012 4:45 PM, "nickmcgill" notifications@github.com wrote:

I've found a fix that seems to work

https://dl.dropbox.com/u/46037093/steelseries.diff

HTH

Nick

— Reply to this email directly or view it on GitHubhttps://github.com/HanSolo/SteelSeries-Canvas/issues/5#issuecomment-11689527.

nickmcgill commented 11 years ago

Just to let you know, I haven't yet tested the radial gauges

Cheers

Nick

mcrossley commented 11 years ago

OK v0.12.0 committed, it fixes this min/max/threshold indicator positioning bug on linear and linearbargraph gauges.

Also it also enables set method chaining.

nickmcgill commented 11 years ago

Thanks - that was quick!