Fixes to horizontal scrollarea, improve charlist flexibility

This commit is contained in:
Henrique Santiago
2012-08-31 01:56:10 -03:00
parent c517f7b745
commit 18a0d7ab94
12 changed files with 133 additions and 60 deletions

View File

@@ -15,7 +15,7 @@ local function calcValues(self)
else -- horizontal
pxrange = (self:getWidth() - decrementButton:getWidth() - decrementButton:getMarginLeft() - decrementButton:getMarginRight()
- incrementButton:getWidth() - incrementButton:getMarginLeft() - incrementButton:getMarginRight())
center = self:getX() + self:getWidth() / 2
center = self:getX() + math.floor(self:getWidth() / 2)
end
local range = self.maximum - self.minimum + 1
@@ -83,6 +83,7 @@ local function parseSliderPos(self, pos)
offset = math.min(math.max(point - center, -pxrange/2), pxrange/2)
local newvalue = math.floor(((offset / (pxrange - px)) + 0.5) * (range - 1)) + self.minimum
self:setValue(newvalue)
-- this function must be reworked, scroll is not that good based on center
end