Files
Basalt/source/project/objects/Switch.lua
Robert Jelic b0b104ee82 couple of bugfixes
-fixed screen flickering
-fixed menubar (now works as intended)
-reworked sliders (behaviour more like scrollbars)
-visual fix to dropdowns
2022-06-06 17:06:56 +02:00

41 lines
1.1 KiB
Lua

local function Switch(name)
local base = Object(name)
local objectType = "Switch"
base.width = 3
base.height = 1
base.bgColor = colors.lightGray
base.fgColor = colors.gray
base:setValue(false)
base:setZIndex(5)
local object = {
getType = function(self)
return objectType
end;
mouseClickHandler = function(self, event, button, x, y)
if (base.mouseClickHandler(self, event, button, x, y)) then
local obx, oby = self:getAbsolutePosition(self:getAnchorPosition())
if (((event == "mouse_click") or (event == "mouse_drag")) and (button == 1))or(event=="monitor_touch") then
end
return true
end
end;
draw = function(self)
if (base.draw(self)) then
if (self.parent ~= nil) then
local obx, oby = self:getAnchorPosition()
end
self:setVisualChanged(false)
end
end;
}
return setmetatable(object, base)
end