Small Fixes

- Small Dropdown fix
- Fast, let us fix isDragging variable before the global police comes
This commit is contained in:
Robert Jelic
2023-05-10 16:56:10 +02:00
parent e14922f6c0
commit d2f4717500
2 changed files with 9 additions and 3 deletions

View File

@@ -98,7 +98,7 @@ return function(name, basalt)
if (obx <= x) and (obx + dropdownW > x) and (oby + n == y) then if (obx <= x) and (obx + dropdownW > x) and (oby + n == y) then
self:setValue(list[n + yOffset]) self:setValue(list[n + yOffset])
self:updateDraw() self:updateDraw()
local val = self:sendEvent("mouse_click", self, "mouse_click", dir, x, y) local val = self:sendEvent("mouse_click", self, "mouse_click", button, x, y)
if(val==false)then return val end if(val==false)then return val end
if(isMon)then if(isMon)then
basalt.schedule(function() basalt.schedule(function()
@@ -139,7 +139,7 @@ return function(name, basalt)
if (obx <= x) and (obx + dropdownW > x) and (oby + n == y) then if (obx <= x) and (obx + dropdownW > x) and (oby + n == y) then
isOpened = false isOpened = false
self:updateDraw() self:updateDraw()
local val = self:sendEvent("mouse_up", self, "mouse_up", dir, x, y) local val = self:sendEvent("mouse_up", self, "mouse_up", button, x, y)
if(val==false)then return val end if(val==false)then return val end
return true return true
end end
@@ -150,6 +150,12 @@ return function(name, basalt)
end end
end, end,
dragHandler = function(self, btn, x, y)
if(base.dragHandler(self, btn, x, y))then
isOpened = true
end
end,
scrollHandler = function(self, dir, x, y) scrollHandler = function(self, dir, x, y)
if(isOpened)then if(isOpened)then
local xPos, yPos = self:getAbsolutePosition() local xPos, yPos = self:getAbsolutePosition()

View File

@@ -5,7 +5,7 @@ return function(name, basalt)
local objectType = "MovableFrame" local objectType = "MovableFrame"
local parent local parent
local dragXOffset, dragYOffset = 0, 0 local dragXOffset, dragYOffset, isDragging = 0, 0, false
local dragMap = { local dragMap = {
{x1 = 1, x2 = "width", y1 = 1, y2 = 1} {x1 = 1, x2 = "width", y1 = 1, y2 = 1}