diff --git a/modules/Slider.js b/modules/Slider.js index 85c065443..e3ad61684 100644 --- a/modules/Slider.js +++ b/modules/Slider.js @@ -50,6 +50,10 @@ try { // For making it possiblie to run the test app in the following catch stat autoProgress:false, },conf); + let totalBorderSize = o.c.outerBorderSize + o.c.innerBorderSize; + o.c.rounded = o.c.rounded?o.c.width/2:0; + if (o.c.rounded) o.c._rounded = (o.c.width-2*totalBorderSize)/2; + // If horizontal, flip things around. if (o.c.horizontal) { let mediator = o.c.xStart; @@ -62,14 +66,12 @@ try { // For making it possiblie to run the test app in the following catch stat } // Make room for the border. Underscore indicates the area for the actual indicator bar without borders. - let totalBorderSize = o.c.outerBorderSize + o.c.innerBorderSize; o.c._xStart = o.c.xStart + totalBorderSize; o.c._width = o.c.width - 2*totalBorderSize; o.c._yStart = o.c.yStart + totalBorderSize; o.c._height = o.c.height - 2*totalBorderSize; - o.c.rounded = o.c.rounded?o.c._width/2:0; - o.c.STEP_SIZE = ((!o.c.horizontal?o.c._height:o.c._width)-(!o.c.rounded?0:(2*o.c.rounded)))/o.c.steps; + o.c.STEP_SIZE = ((!o.c.horizontal?o.c._height:o.c._width)-(!o.c.rounded?0:(2*o.c._rounded)))/o.c.steps; // Add a rectangle object with x, y, x2, y2, w and h values. o.c.r = {x:o.c.xStart, y:o.c.yStart, x2:o.c.xStart+o.c.width, y2:o.c.yStart+o.c.height, w:o.c.width, h:o.c.height}; @@ -181,10 +183,10 @@ try { // For making it possiblie to run the test app in the following catch stat g.setColor(o.c.colorFG).fillRect(o.c.borderRect). // To get outer border... setColor(o.c.colorBG).fillRect(o.c.hollowRect). // ... and here it's made hollow. - setColor(0==level?o.c.colorBG:o.c.colorFG).fillRect(o.f.updateBar((!o.c.rounded?0:(2*o.c.rounded))+level*o.c.STEP_SIZE)); // Here the bar is drawn. + setColor(0==level?o.c.colorBG:o.c.colorFG).fillRect(o.f.updateBar((!o.c.rounded?0:(2*o.c._rounded))+level*o.c.STEP_SIZE)); // Here the bar is drawn. if (o.c.rounded && level===0) { // Hollow circle indicates level zero when slider is rounded. - g.setColor(o.c.colorFG).fillCircle(o.c._xStart+(!o.c.horizontal?o.c._width/2:o.c.rounded-2), o.c._yStart+o.c._height-o.c.rounded, o.c.rounded). - setColor(o.c.colorBG).fillCircle(o.c._xStart+(!o.c.horizontal?o.c._width/2:o.c.rounded-2), o.c._yStart+o.c._height-o.c.rounded, o.c.rounded-o.c.outerBorderSize); + g.setColor(o.c.colorFG).fillCircle(o.c._xStart+(!o.c.horizontal?o.c._rounded:o.c._rounded), o.c._yStart+o.c._height-o.c._rounded, o.c._rounded). + setColor(o.c.colorBG).fillCircle(o.c._xStart+(!o.c.horizontal?o.c._rounded:o.c._rounded), o.c._yStart+o.c._height-o.c._rounded, o.c._rounded-o.c.outerBorderSize); } }; }