The solution that @thefest29 used does not work for me because the slider is on a transitioning overlay and I found that the only way to use that solution is to wait until the overlay has fully transitioned into place. I did manage to find another work-around though! In fact, this work-around could probably easily be implemented in the widget library by the Corona engineers.
My fix is to add an invisible rectangle to the slider group. This forces the slider group to always take into account the potential of the handle being at the far left or far right. I am using a horizontal slider so my code that I will show below will only work for a horizontal slider, but it can easily be adapted to work with the vertical slider if you look at the widget source code (https://github.com/coronalabs/framework-widget/blob/master/widgetLibrary/widget_slider.lua).
Here is my code:
local sliderSheet = ... create sheet ... local options = { sheet = sliderSheet, leftFrame = 1, fillFrame = 2, middleFrame = 3, rightFrame = 4, handleFrame = 5, frameWidth = 0.5 \* size, frameHeight = size, handleWidth = 2 \* size, handleHeight = 2 \* size, x = x, y= y, orientation = "horizontal", width = sliderWidth, value = sliderValue, listener = listener } local slider = widget.newSlider(options) --Bug fix work around to cause sliders to properly align! local fullw = options.width + slider.\_handle.width local backing = display.newRect( slider, (options.width \* 0.5), slider.\_left.y, fullw, 1) backing.fill = {0,0,0,0}
I am not positive since I have not tested this, but I believe that the equivalent code fix for a vertical slider would be something like this:
local fullh = options.height + slider.\_handle.height local backing = display.newRect( slider, slider.\_top.x, (options.height \* 0.5), 1, fullh) backing.fill = {0,0,0,0}