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
|
if(self.getOffset~=nil)then
|
||||||
xO, yO = self:getOffset()
|
xO, yO = self:getOffset()
|
||||||
end
|
end
|
||||||
|
if(obj.element.getIgnoreOffset())then
|
||||||
|
xO, yO = 0, 0
|
||||||
|
end
|
||||||
if (obj.element[v[1]](obj.element, btn, x+xO, y+yO, ...)) then
|
if (obj.element[v[1]](obj.element, btn, x+xO, y+yO, ...)) then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ return function(name, basalt)
|
|||||||
end,
|
end,
|
||||||
|
|
||||||
sendEvent = function(self, event, ...)
|
sendEvent = function(self, event, ...)
|
||||||
return eventSystem:sendEvent(event, self, ...)
|
return eventSystem:sendEvent(event, self, event, ...)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
onClick = function(self, ...)
|
onClick = function(self, ...)
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ return function(name, basalt)
|
|||||||
|
|
||||||
local barType = "vertical"
|
local barType = "vertical"
|
||||||
local symbol = " "
|
local symbol = " "
|
||||||
local symbolBG = colors.yellow
|
local symbolBG = colors.black
|
||||||
local symbolFG = colors.black
|
local symbolFG = colors.black
|
||||||
local scrollAmount = 3
|
local scrollAmount = 3
|
||||||
local index = 1
|
local index = 1
|
||||||
@@ -23,6 +23,7 @@ return function(name, basalt)
|
|||||||
symbolSize = math.max((barType == "vertical" and h or w-(#symbol)) - (scrollAmount-1), 1)
|
symbolSize = math.max((barType == "vertical" and h or w-(#symbol)) - (scrollAmount-1), 1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
updateSymbolSize()
|
||||||
|
|
||||||
local function mouseEvent(self, button, x, y)
|
local function mouseEvent(self, button, x, y)
|
||||||
local obx, oby = self:getPosition()
|
local obx, oby = self:getPosition()
|
||||||
@@ -67,7 +68,7 @@ return function(name, basalt)
|
|||||||
index = 1
|
index = 1
|
||||||
end
|
end
|
||||||
local w,h = self:getSize()
|
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()
|
updateSymbolSize()
|
||||||
self:updateDraw()
|
self:updateDraw()
|
||||||
return self
|
return self
|
||||||
@@ -145,8 +146,9 @@ return function(name, basalt)
|
|||||||
return self
|
return self
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
|
||||||
scrollbarMoveHandler = function(self)
|
scrollbarMoveHandler = function(self)
|
||||||
self:sendEvent("scrollbar_moved", self, self:getIndex())
|
self:sendEvent("scrollbar_moved", self:getIndex())
|
||||||
end,
|
end,
|
||||||
|
|
||||||
customEventHandler = function(self, event, ...)
|
customEventHandler = function(self, event, ...)
|
||||||
@@ -170,7 +172,7 @@ return function(name, basalt)
|
|||||||
for n = 0, h - 1 do
|
for n = 0, h - 1 do
|
||||||
if (index == n + 1) then
|
if (index == n + 1) then
|
||||||
for curIndexOffset = 0, math.min(symbolSize - 1, h) do
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -212,6 +212,10 @@ return function(name, basalt)
|
|||||||
return self
|
return self
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
getIgnoreOffset = function(self)
|
||||||
|
return ignOffset
|
||||||
|
end,
|
||||||
|
|
||||||
isCoordsInObject = function(self, x, y)
|
isCoordsInObject = function(self, x, y)
|
||||||
if(isVisible)and(self:isEnabled())then
|
if(isVisible)and(self:isEnabled())then
|
||||||
if(x==nil)or(y==nil)then return false end
|
if(x==nil)or(y==nil)then return false end
|
||||||
|
|||||||
@@ -255,6 +255,19 @@ return {
|
|||||||
self:listenEvent("other_event")
|
self:listenEvent("other_event")
|
||||||
end
|
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 = {
|
local object = {
|
||||||
animatePosition = function(self, x, y, duration, timeOffset, mode, f)
|
animatePosition = function(self, x, y, duration, timeOffset, mode, f)
|
||||||
mode = mode or defaultMode
|
mode = mode or defaultMode
|
||||||
@@ -282,6 +295,14 @@ return {
|
|||||||
return self
|
return self
|
||||||
end,
|
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, ...)
|
doneHandler = function(self, timerId, ...)
|
||||||
for k,v in pairs(activeAnimations)do
|
for k,v in pairs(activeAnimations)do
|
||||||
if(v.timerId==timerId)then
|
if(v.timerId==timerId)then
|
||||||
|
|||||||
Reference in New Issue
Block a user