mirror of
https://github.com/linux-man/LoveFrames.git
synced 2024-11-18 16:04:22 +00:00
fixed indicator tracking
This commit is contained in:
parent
7f3c34e6ee
commit
839db5491d
@ -338,26 +338,24 @@ function newobject:ScrollTo(position)
|
||||
local bartype = self.bartype
|
||||
local listo = self.parent.parent.parent
|
||||
local onscroll = listo.OnScroll
|
||||
|
||||
|
||||
if bartype == "vertical" then
|
||||
local denormalized = position * self.maxy
|
||||
local newy = denormalized + self.parent.y
|
||||
if newy > self.maxy then
|
||||
self.staticy = self.maxy - self.parent.y
|
||||
elseif newy < self.parent.y then
|
||||
local maxRealPos = self.parent.height - self.height
|
||||
if position > 1 then
|
||||
self.staticy = maxRealPos
|
||||
elseif position < 0 then
|
||||
self.staticy = 0
|
||||
else
|
||||
self.staticy = denormalized
|
||||
self.staticy = position * maxRealPos
|
||||
end
|
||||
elseif bartype == "horizontal" then
|
||||
local denormalized = position * self.maxx
|
||||
local newx = denormalized + self.parent.x
|
||||
if newx > self.maxx then
|
||||
self.staticx = self.maxx - self.parent.x
|
||||
elseif newx < self.parent.x then
|
||||
local maxRealPos = self.parent.width - self.width
|
||||
if position > 1 then
|
||||
self.staticx = maxRealPos
|
||||
elseif position < 0 then
|
||||
self.staticx = 0
|
||||
else
|
||||
self.staticx = denormalized
|
||||
self.staticx = position * maxRealPos
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -962,11 +962,10 @@ function newobject:UpdateIndicator()
|
||||
twidth = linewidth
|
||||
end
|
||||
end
|
||||
local correction = self:GetWidth() / 2
|
||||
local correction = self:GetWidth() / 8
|
||||
if indicatorRelativeX < leftlimit then
|
||||
correction = correction * -1
|
||||
end
|
||||
print(correction)
|
||||
hbody:GetScrollBar():ScrollTo((width + correction) / twidth)
|
||||
end
|
||||
end
|
||||
@ -978,7 +977,7 @@ function newobject:UpdateIndicator()
|
||||
if not (indicatorRelativeY > uplimit and indicatorRelativeY < downlimit) then
|
||||
local vbody = self:GetVerticalScrollBody()
|
||||
if vbody then
|
||||
local correction = self:GetHeight() / 2 / theight
|
||||
local correction = self:GetHeight() / 8 / theight
|
||||
if indicatorRelativeY < uplimit then
|
||||
correction = correction * -1
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user