mirror of
https://github.com/linux-man/LoveFrames.git
synced 2024-11-18 16:04:22 +00:00
Use numeric mouse button constants
This commit is contained in:
parent
da48c48965
commit
a5fd850adb
2
init.lua
2
init.lua
@ -237,7 +237,7 @@ function loveframes.mousereleased(x, y, button)
|
||||
base:mousereleased(x, y, button)
|
||||
|
||||
-- reset the hover object
|
||||
if button == "l" then
|
||||
if button == 1 then
|
||||
loveframes.downobject = false
|
||||
loveframes.selectedobject = false
|
||||
end
|
||||
|
@ -144,7 +144,7 @@ function newobject:mousepressed(x, y, button)
|
||||
|
||||
local hover = self.hover
|
||||
|
||||
if hover and button == "l" then
|
||||
if hover and button == 1 then
|
||||
local baseparent = self:GetBaseParent()
|
||||
if baseparent and baseparent.type == "frame" then
|
||||
baseparent:MakeTop()
|
||||
@ -180,7 +180,7 @@ function newobject:mousereleased(x, y, button)
|
||||
local enabled = self.enabled
|
||||
local onclick = self.OnClick
|
||||
|
||||
if hover and down and clickable and button == "l" then
|
||||
if hover and down and clickable and button == 1 then
|
||||
if enabled then
|
||||
if onclick then
|
||||
onclick(self, x, y)
|
||||
|
@ -173,7 +173,7 @@ function newobject:mousepressed(x, y, button)
|
||||
|
||||
local hover = self.hover
|
||||
|
||||
if hover and button == "l" then
|
||||
if hover and button == 1 then
|
||||
local baseparent = self:GetBaseParent()
|
||||
if baseparent and baseparent.type == "frame" then
|
||||
baseparent:MakeTop()
|
||||
@ -209,7 +209,7 @@ function newobject:mousereleased(x, y, button)
|
||||
local checked = self.checked
|
||||
local onchanged = self.OnChanged
|
||||
|
||||
if hover and down and enabled and button == "l" then
|
||||
if hover and down and enabled and button == 1 then
|
||||
if checked then
|
||||
self.checked = false
|
||||
else
|
||||
|
@ -154,7 +154,7 @@ function newobject:mousepressed(x, y, button)
|
||||
|
||||
if hover then
|
||||
local col = loveframes.util.BoundingBox(self.x, x, self.y, y, self.width, 1, self.closedheight, 1)
|
||||
if button == "l" and col then
|
||||
if button == 1 and col then
|
||||
local baseparent = self:GetBaseParent()
|
||||
if baseparent and baseparent.type == "frame" then
|
||||
baseparent:MakeTop()
|
||||
@ -198,7 +198,7 @@ function newobject:mousereleased(x, y, button)
|
||||
local children = self.children
|
||||
local curobject = children[1]
|
||||
|
||||
if hover and col and down and button == "l" then
|
||||
if hover and col and down and button == 1 then
|
||||
if open then
|
||||
self:SetOpen(false)
|
||||
else
|
||||
|
@ -187,7 +187,7 @@ function newobject:mousepressed(x, y, button)
|
||||
local children = self.children
|
||||
local internals = self.internals
|
||||
|
||||
if hover and button == "l" then
|
||||
if hover and button == 1 then
|
||||
local baseparent = self:GetBaseParent()
|
||||
if baseparent and baseparent.type == "frame" then
|
||||
baseparent:MakeTop()
|
||||
|
@ -141,7 +141,7 @@ function newobject:mousepressed(x, y, button)
|
||||
local children = self.children
|
||||
local hover = self.hover
|
||||
|
||||
if hover and button == "l" then
|
||||
if hover and button == 1 then
|
||||
local baseparent = self:GetBaseParent()
|
||||
if baseparent and baseparent.type == "frame" then
|
||||
baseparent:MakeTop()
|
||||
|
@ -488,7 +488,7 @@ function newobject:mousepressed(x, y, button)
|
||||
local parent = self.parent
|
||||
local base = loveframes.base
|
||||
|
||||
if button == "l" then
|
||||
if button == 1 then
|
||||
-- initiate dragging if not currently dragging
|
||||
if not dragging and self.hover and self.draggable then
|
||||
local topcol
|
||||
@ -626,7 +626,7 @@ function newobject:mousepressed(x, y, button)
|
||||
end
|
||||
end
|
||||
end
|
||||
if self.hover and button == "l" then
|
||||
if self.hover and button == 1 then
|
||||
self:MakeTop()
|
||||
end
|
||||
end
|
||||
|
@ -163,7 +163,7 @@ function newobject:mousepressed(x, y, button)
|
||||
local children = self.children
|
||||
local hover = self.hover
|
||||
|
||||
if hover and button == "l" then
|
||||
if hover and button == 1 then
|
||||
local baseparent = self:GetBaseParent()
|
||||
if baseparent and baseparent.type == "frame" then
|
||||
baseparent:MakeTop()
|
||||
|
@ -144,7 +144,7 @@ function newobject:mousepressed(x, y, button)
|
||||
|
||||
local hover = self.hover
|
||||
|
||||
if hover and button == "l" then
|
||||
if hover and button == 1 then
|
||||
local baseparent = self:GetBaseParent()
|
||||
if baseparent and baseparent.type == "frame" then
|
||||
baseparent:MakeTop()
|
||||
@ -180,7 +180,7 @@ function newobject:mousereleased(x, y, button)
|
||||
local enabled = self.enabled
|
||||
local onclick = self.OnClick
|
||||
|
||||
if hover and down and clickable and button == "l" then
|
||||
if hover and down and clickable and button == 1 then
|
||||
if enabled then
|
||||
if onclick then
|
||||
onclick(self, x, y)
|
||||
|
@ -128,7 +128,7 @@ function newobject:mousepressed(x, y, button)
|
||||
|
||||
local hover = self.hover
|
||||
|
||||
if hover and button == "l" then
|
||||
if hover and button == 1 then
|
||||
local baseparent = self:GetBaseParent()
|
||||
if baseparent and baseparent.type == "frame" then
|
||||
baseparent:MakeTop()
|
||||
@ -155,7 +155,7 @@ function newobject:mousereleased(x, y, button)
|
||||
local onclick = self.OnClick
|
||||
|
||||
if hover and self.down then
|
||||
if button == "l" then
|
||||
if button == 1 then
|
||||
onclick(x, y, self)
|
||||
end
|
||||
end
|
||||
|
@ -161,7 +161,7 @@ function newobject:mousepressed(x, y, button)
|
||||
|
||||
local scrollamount = self.mousewheelscrollamount
|
||||
|
||||
if self.hover and button == "l" then
|
||||
if self.hover and button == 1 then
|
||||
local baseparent = self:GetBaseParent()
|
||||
if baseparent and baseparent.type == "frame" then
|
||||
baseparent:MakeTop()
|
||||
|
@ -167,9 +167,9 @@ function newobject:mousepressed(x, y, button)
|
||||
end
|
||||
end
|
||||
|
||||
if self.hover and button == "l" then
|
||||
if self.hover and button == 1 then
|
||||
local baseparent = self:GetBaseParent()
|
||||
if baseparent and baseparent.type == "frame" and button == "l" then
|
||||
if baseparent and baseparent.type == "frame" and button == 1 then
|
||||
baseparent:MakeTop()
|
||||
end
|
||||
self.down = true
|
||||
@ -194,7 +194,7 @@ function newobject:mousereleased(x, y, button)
|
||||
local enabled = self.enabled
|
||||
local onclick = self.OnClick
|
||||
|
||||
if hover and down and clickable and button == "l" then
|
||||
if hover and down and clickable and button == 1 then
|
||||
if enabled then
|
||||
onclick(self, x, y)
|
||||
end
|
||||
|
@ -107,7 +107,7 @@ function newobject:mousepressed(x, y, button)
|
||||
return
|
||||
end
|
||||
|
||||
if self.hover and button == "l" then
|
||||
if self.hover and button == 1 then
|
||||
local baseparent = self:GetBaseParent()
|
||||
if baseparent and baseparent.type == "frame" then
|
||||
baseparent:MakeTop()
|
||||
@ -129,12 +129,12 @@ function newobject:mousereleased(x, y, button)
|
||||
|
||||
if self.hover then
|
||||
local parent = self:GetParent():GetParent()
|
||||
if button == "l" then
|
||||
if button == 1 then
|
||||
local onrowclicked = parent.OnRowClicked
|
||||
if onrowclicked then
|
||||
onrowclicked(parent, self, self.columndata)
|
||||
end
|
||||
elseif button == "r" then
|
||||
elseif button == 2 then
|
||||
local onrowrightclicked = parent.OnRowRightClicked
|
||||
if onrowrightclicked then
|
||||
onrowrightclicked(parent, self, self.columndata)
|
||||
|
@ -134,7 +134,7 @@ function newobject:mousepressed(x, y, button)
|
||||
|
||||
local hover = self.hover
|
||||
|
||||
if hover and button == "l" then
|
||||
if hover and button == 1 then
|
||||
local baseparent = self:GetBaseParent()
|
||||
if baseparent and baseparent.type == "frame" then
|
||||
baseparent:MakeTop()
|
||||
|
@ -188,7 +188,7 @@ function newobject:mousereleased(x, y, button)
|
||||
|
||||
local hover = self.hover
|
||||
local option_type = self.option_type
|
||||
if hover and option_type ~= "divider" and button == "l" then
|
||||
if hover and option_type ~= "divider" and button == 1 then
|
||||
local func = self.func
|
||||
if func then
|
||||
local text = self.text
|
||||
|
@ -215,7 +215,7 @@ function newobject:mousepressed(x, y, button)
|
||||
local children = self.children
|
||||
local scrollamount = self.mousewheelscrollamount
|
||||
|
||||
if not selfcol and self.canremove and button == "l" then
|
||||
if not selfcol and self.canremove and button == 1 then
|
||||
self:Close()
|
||||
end
|
||||
|
||||
|
@ -120,7 +120,7 @@ function newobject:mousepressed(x, y, button)
|
||||
|
||||
local hover = self.hover
|
||||
|
||||
if hover and button == "l" then
|
||||
if hover and button == 1 then
|
||||
self.down = true
|
||||
loveframes.downobject = self
|
||||
end
|
||||
@ -141,7 +141,7 @@ function newobject:mousereleased(x, y, button)
|
||||
|
||||
local text = self.text
|
||||
|
||||
if self.hover and self.down and self.canclick and button == "l" then
|
||||
if self.hover and self.down and self.canclick and button == 1 then
|
||||
self.parent.list:SelectChoice(text)
|
||||
end
|
||||
|
||||
|
@ -175,7 +175,7 @@ function newobject:mousepressed(x, y, button)
|
||||
local hover = self.hover
|
||||
local delayamount = self.delayamount
|
||||
|
||||
if hover and button == "l" then
|
||||
if hover and button == 1 then
|
||||
self.down = true
|
||||
self.scrolldelay = time + delayamount + 0.5
|
||||
local baseparent = self:GetBaseParent()
|
||||
@ -218,7 +218,7 @@ function newobject:mousereleased(x, y, button)
|
||||
|
||||
local internals = self.internals
|
||||
|
||||
if button == "l" then
|
||||
if button == 1 then
|
||||
self.down = false
|
||||
end
|
||||
|
||||
|
@ -247,7 +247,7 @@ function newobject:mousepressed(x, y, button)
|
||||
local dragging = self.dragging
|
||||
|
||||
if not dragging then
|
||||
if button == "l" then
|
||||
if button == 1 then
|
||||
self.starty = self.staticy
|
||||
self.startx = self.staticx
|
||||
self.clickx = x
|
||||
|
@ -121,7 +121,7 @@ function newobject:mousepressed(x, y, button)
|
||||
|
||||
local hover = self.hover
|
||||
|
||||
if hover and button == "l" then
|
||||
if hover and button == 1 then
|
||||
local baseparent = self:GetBaseParent()
|
||||
if baseparent.type == "frame" then
|
||||
baseparent:MakeTop()
|
||||
@ -149,7 +149,7 @@ function newobject:mousereleased(x, y, button)
|
||||
local onclick = self.OnClick
|
||||
|
||||
if hover and down then
|
||||
if button == "l" then
|
||||
if button == 1 then
|
||||
onclick(x, y, self)
|
||||
end
|
||||
end
|
||||
|
@ -193,7 +193,7 @@ function newobject:mousepressed(x, y, button)
|
||||
|
||||
local hover = self.hover
|
||||
|
||||
if hover and button == "l" then
|
||||
if hover and button == 1 then
|
||||
local baseparent = self:GetBaseParent()
|
||||
if baseparent and baseparent.type == "frame" then
|
||||
baseparent:MakeTop()
|
||||
|
@ -131,7 +131,7 @@ function newobject:mousepressed(x, y, button)
|
||||
local hover = self.hover
|
||||
local internals = self.internals
|
||||
|
||||
if hover and button == "l" then
|
||||
if hover and button == 1 then
|
||||
local baseparent = self:GetBaseParent()
|
||||
if baseparent and baseparent.type == "frame" then
|
||||
baseparent:MakeTop()
|
||||
@ -158,8 +158,8 @@ function newobject:mousereleased(x, y, button)
|
||||
local parent = self.parent
|
||||
local tabnumber = self.tabnumber
|
||||
|
||||
if hover and button == "l" then
|
||||
if button == "l" then
|
||||
if hover and button == 1 then
|
||||
if button == 1 then
|
||||
local tab = parent.tab
|
||||
local internals = parent.internals
|
||||
local onopened = self.OnOpened
|
||||
|
@ -157,7 +157,7 @@ function newobject:mousepressed(x, y, button)
|
||||
v:mousepressed(x, y, button)
|
||||
end
|
||||
|
||||
if self.hover and button == "l" then
|
||||
if self.hover and button == 1 then
|
||||
local time = os.time()
|
||||
if self.lastclick + 0.40 > time then
|
||||
self.open = not self.open
|
||||
|
@ -123,7 +123,7 @@ function newobject:mousepressed(x, y, button)
|
||||
|
||||
local hover = self.hover
|
||||
|
||||
if hover and button == "l" then
|
||||
if hover and button == 1 then
|
||||
local bool = not self.parent.open
|
||||
if bool then
|
||||
local onopen = self.parent.OnOpen
|
||||
|
@ -211,7 +211,7 @@ function newobject:mousepressed(x, y, button)
|
||||
local children = self.children
|
||||
local internals = self.internals
|
||||
|
||||
if hover and button == "l" then
|
||||
if hover and button == 1 then
|
||||
local baseparent = self:GetBaseParent()
|
||||
if baseparent and baseparent.type == "frame" then
|
||||
baseparent:MakeTop()
|
||||
|
@ -137,7 +137,7 @@ function newobject:mousepressed(x, y, button)
|
||||
local haslist = self.haslist
|
||||
local enabled = self.enabled
|
||||
|
||||
if hover and not haslist and enabled and button == "l" then
|
||||
if hover and not haslist and enabled and button == 1 then
|
||||
local baseparent = self:GetBaseParent()
|
||||
if baseparent and baseparent.type == "frame" then
|
||||
baseparent:MakeTop()
|
||||
|
@ -253,7 +253,7 @@ function newobject:mousepressed(x, y, button)
|
||||
local internals = self.internals
|
||||
local hover = self.hover
|
||||
|
||||
if hover and button == "l" then
|
||||
if hover and button == 1 then
|
||||
local baseparent = self:GetBaseParent()
|
||||
if baseparent and baseparent.type == "frame" then
|
||||
baseparent:MakeTop()
|
||||
|
@ -136,7 +136,7 @@ function newobject:mousepressed(x, y, button)
|
||||
local children = self.children
|
||||
local hover = self.hover
|
||||
|
||||
if hover and button == "l" then
|
||||
if hover and button == 1 then
|
||||
local baseparent = self:GetBaseParent()
|
||||
if baseparent and baseparent.type == "frame" then
|
||||
baseparent:MakeTop()
|
||||
|
@ -174,7 +174,7 @@ function newobject:mousepressed(x, y, button)
|
||||
|
||||
local hover = self.hover
|
||||
|
||||
if hover and button == "l" then
|
||||
if hover and button == 1 then
|
||||
local baseparent = self:GetBaseParent()
|
||||
if baseparent and baseparent.type == "frame" then
|
||||
baseparent:MakeTop()
|
||||
@ -199,7 +199,7 @@ function newobject:mousereleased(x, y, button)
|
||||
return
|
||||
end
|
||||
|
||||
if self.hover and self.down and self.enabled and button == "l" then
|
||||
if self.hover and self.down and self.enabled and button == 1 then
|
||||
if not self.checked then
|
||||
-- a radio button can only be unchecked by checking another radio button
|
||||
self:SetChecked(true)
|
||||
|
@ -177,7 +177,7 @@ function newobject:mousepressed(x, y, button)
|
||||
local slidetype = self.slidetype
|
||||
local scrollable = self.scrollable
|
||||
|
||||
if hover and button == "l" then
|
||||
if hover and button == 1 then
|
||||
if slidetype == "horizontal" then
|
||||
local xpos = x - self.x
|
||||
local button = internals[1]
|
||||
|
@ -211,7 +211,7 @@ function newobject:mousepressed(x, y, button)
|
||||
local tab = self.tab
|
||||
local hover = self.hover
|
||||
|
||||
if hover and button == "l" then
|
||||
if hover and button == 1 then
|
||||
local baseparent = self:GetBaseParent()
|
||||
if baseparent and baseparent.type == "frame" then
|
||||
baseparent:MakeTop()
|
||||
|
@ -195,7 +195,7 @@ function newobject:mousepressed(x, y, button)
|
||||
end
|
||||
|
||||
local hover = self.hover
|
||||
if hover and button == "l" then
|
||||
if hover and button == 1 then
|
||||
local baseparent = self:GetBaseParent()
|
||||
if baseparent and baseparent.type == "frame" then
|
||||
baseparent:MakeTop()
|
||||
|
@ -354,7 +354,7 @@ function newobject:mousepressed(x, y, button)
|
||||
local inputobject = loveframes.inputobject
|
||||
|
||||
if hover then
|
||||
if button == "l" then
|
||||
if button == 1 then
|
||||
if inputobject ~= self then
|
||||
loveframes.inputobject = self
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user