Small Fixes
Fixed Scrollbar issue causing too long without yield Fixed ignoreOffset bug
This commit is contained in:
@@ -343,6 +343,9 @@ return function(name, basalt)
|
||||
if(self.getOffset~=nil)then
|
||||
xO, yO = self:getOffset()
|
||||
end
|
||||
if(obj.element.getIgnoreOffset())then
|
||||
xO, yO = 0, 0
|
||||
end
|
||||
if (obj.element[v[1]](obj.element, btn, x+xO, y+yO, ...)) then
|
||||
return true
|
||||
end
|
||||
|
||||
@@ -141,7 +141,7 @@ return function(name, basalt)
|
||||
end,
|
||||
|
||||
sendEvent = function(self, event, ...)
|
||||
return eventSystem:sendEvent(event, self, ...)
|
||||
return eventSystem:sendEvent(event, self, event, ...)
|
||||
end,
|
||||
|
||||
onClick = function(self, ...)
|
||||
|
||||
@@ -10,7 +10,7 @@ return function(name, basalt)
|
||||
|
||||
local barType = "vertical"
|
||||
local symbol = " "
|
||||
local symbolBG = colors.yellow
|
||||
local symbolBG = colors.black
|
||||
local symbolFG = colors.black
|
||||
local scrollAmount = 3
|
||||
local index = 1
|
||||
@@ -23,6 +23,7 @@ return function(name, basalt)
|
||||
symbolSize = math.max((barType == "vertical" and h or w-(#symbol)) - (scrollAmount-1), 1)
|
||||
end
|
||||
end
|
||||
updateSymbolSize()
|
||||
|
||||
local function mouseEvent(self, button, x, y)
|
||||
local obx, oby = self:getPosition()
|
||||
@@ -67,7 +68,7 @@ return function(name, basalt)
|
||||
index = 1
|
||||
end
|
||||
local w,h = self:getSize()
|
||||
index = math.min(index, (barType == "vertical" and h or w) - (symbolSize - 1))
|
||||
--index = math.min(index, (barType == "vertical" and h or w) - (symbolSize - 1))
|
||||
updateSymbolSize()
|
||||
self:updateDraw()
|
||||
return self
|
||||
@@ -145,8 +146,9 @@ return function(name, basalt)
|
||||
return self
|
||||
end,
|
||||
|
||||
|
||||
scrollbarMoveHandler = function(self)
|
||||
self:sendEvent("scrollbar_moved", self, self:getIndex())
|
||||
self:sendEvent("scrollbar_moved", self:getIndex())
|
||||
end,
|
||||
|
||||
customEventHandler = function(self, event, ...)
|
||||
@@ -170,7 +172,7 @@ return function(name, basalt)
|
||||
for n = 0, h - 1 do
|
||||
if (index == n + 1) then
|
||||
for curIndexOffset = 0, math.min(symbolSize - 1, h) do
|
||||
self:blit(1, index + curIndexOffset, symbol:rep(math.max(#symbol, w)), tHex[symbolFG]:rep(math.max(#symbol, w)), tHex[symbolBG]:rep(math.max(#symbol, w)))
|
||||
self:addBlit(1, index + curIndexOffset, symbol:rep(math.max(#symbol, w)), tHex[symbolFG]:rep(math.max(#symbol, w)), tHex[symbolBG]:rep(math.max(#symbol, w)))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -212,6 +212,10 @@ return function(name, basalt)
|
||||
return self
|
||||
end,
|
||||
|
||||
getIgnoreOffset = function(self)
|
||||
return ignOffset
|
||||
end,
|
||||
|
||||
isCoordsInObject = function(self, x, y)
|
||||
if(isVisible)and(self:isEnabled())then
|
||||
if(x==nil)or(y==nil)then return false end
|
||||
|
||||
@@ -255,6 +255,19 @@ return {
|
||||
self:listenEvent("other_event")
|
||||
end
|
||||
|
||||
local function createColorAnimation(self, duration, timeOffset, typ, set, ...)
|
||||
local newColors = {...}
|
||||
if(activeAnimations[typ]~=nil)then
|
||||
os.cancelTimer(activeAnimations[typ].timerId)
|
||||
end
|
||||
activeAnimations[typ] = {}
|
||||
local colorIndex = 1
|
||||
activeAnimations[typ].call = function()
|
||||
local color = newColors[colorIndex]
|
||||
set(self, color)
|
||||
end
|
||||
end
|
||||
|
||||
local object = {
|
||||
animatePosition = function(self, x, y, duration, timeOffset, mode, f)
|
||||
mode = mode or defaultMode
|
||||
@@ -282,6 +295,14 @@ return {
|
||||
return self
|
||||
end,
|
||||
|
||||
animateBackground = function(self, color, duration, timeOffset, mode, f)
|
||||
mode = mode or defaultMode
|
||||
duration = duration or 1
|
||||
timeOffset = timeOffset or 0
|
||||
createColorAnimation(self, color, nil, duration, timeOffset, mode, "background", f, self.getBackground, self.setBackground)
|
||||
return self
|
||||
end,
|
||||
|
||||
doneHandler = function(self, timerId, ...)
|
||||
for k,v in pairs(activeAnimations)do
|
||||
if(v.timerId==timerId)then
|
||||
|
||||
Reference in New Issue
Block a user