Use numeric mouse button constants

This commit is contained in:
Raman Varabets 2015-10-31 21:40:19 +08:00
parent da48c48965
commit a5fd850adb
33 changed files with 49 additions and 49 deletions

View File

@ -237,7 +237,7 @@ function loveframes.mousereleased(x, y, button)
base:mousereleased(x, y, button) base:mousereleased(x, y, button)
-- reset the hover object -- reset the hover object
if button == "l" then if button == 1 then
loveframes.downobject = false loveframes.downobject = false
loveframes.selectedobject = false loveframes.selectedobject = false
end end

View File

@ -144,7 +144,7 @@ function newobject:mousepressed(x, y, button)
local hover = self.hover local hover = self.hover
if hover and button == "l" then if hover and button == 1 then
local baseparent = self:GetBaseParent() local baseparent = self:GetBaseParent()
if baseparent and baseparent.type == "frame" then if baseparent and baseparent.type == "frame" then
baseparent:MakeTop() baseparent:MakeTop()
@ -180,7 +180,7 @@ function newobject:mousereleased(x, y, button)
local enabled = self.enabled local enabled = self.enabled
local onclick = self.OnClick 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 enabled then
if onclick then if onclick then
onclick(self, x, y) onclick(self, x, y)

View File

@ -173,7 +173,7 @@ function newobject:mousepressed(x, y, button)
local hover = self.hover local hover = self.hover
if hover and button == "l" then if hover and button == 1 then
local baseparent = self:GetBaseParent() local baseparent = self:GetBaseParent()
if baseparent and baseparent.type == "frame" then if baseparent and baseparent.type == "frame" then
baseparent:MakeTop() baseparent:MakeTop()
@ -209,7 +209,7 @@ function newobject:mousereleased(x, y, button)
local checked = self.checked local checked = self.checked
local onchanged = self.OnChanged 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 if checked then
self.checked = false self.checked = false
else else

View File

@ -154,7 +154,7 @@ function newobject:mousepressed(x, y, button)
if hover then if hover then
local col = loveframes.util.BoundingBox(self.x, x, self.y, y, self.width, 1, self.closedheight, 1) 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() local baseparent = self:GetBaseParent()
if baseparent and baseparent.type == "frame" then if baseparent and baseparent.type == "frame" then
baseparent:MakeTop() baseparent:MakeTop()
@ -198,7 +198,7 @@ function newobject:mousereleased(x, y, button)
local children = self.children local children = self.children
local curobject = children[1] 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 if open then
self:SetOpen(false) self:SetOpen(false)
else else

View File

@ -187,7 +187,7 @@ function newobject:mousepressed(x, y, button)
local children = self.children local children = self.children
local internals = self.internals local internals = self.internals
if hover and button == "l" then if hover and button == 1 then
local baseparent = self:GetBaseParent() local baseparent = self:GetBaseParent()
if baseparent and baseparent.type == "frame" then if baseparent and baseparent.type == "frame" then
baseparent:MakeTop() baseparent:MakeTop()

View File

@ -141,7 +141,7 @@ function newobject:mousepressed(x, y, button)
local children = self.children local children = self.children
local hover = self.hover local hover = self.hover
if hover and button == "l" then if hover and button == 1 then
local baseparent = self:GetBaseParent() local baseparent = self:GetBaseParent()
if baseparent and baseparent.type == "frame" then if baseparent and baseparent.type == "frame" then
baseparent:MakeTop() baseparent:MakeTop()

View File

@ -488,7 +488,7 @@ function newobject:mousepressed(x, y, button)
local parent = self.parent local parent = self.parent
local base = loveframes.base local base = loveframes.base
if button == "l" then if button == 1 then
-- initiate dragging if not currently dragging -- initiate dragging if not currently dragging
if not dragging and self.hover and self.draggable then if not dragging and self.hover and self.draggable then
local topcol local topcol
@ -626,7 +626,7 @@ function newobject:mousepressed(x, y, button)
end end
end end
end end
if self.hover and button == "l" then if self.hover and button == 1 then
self:MakeTop() self:MakeTop()
end end
end end

View File

@ -163,7 +163,7 @@ function newobject:mousepressed(x, y, button)
local children = self.children local children = self.children
local hover = self.hover local hover = self.hover
if hover and button == "l" then if hover and button == 1 then
local baseparent = self:GetBaseParent() local baseparent = self:GetBaseParent()
if baseparent and baseparent.type == "frame" then if baseparent and baseparent.type == "frame" then
baseparent:MakeTop() baseparent:MakeTop()

View File

@ -144,7 +144,7 @@ function newobject:mousepressed(x, y, button)
local hover = self.hover local hover = self.hover
if hover and button == "l" then if hover and button == 1 then
local baseparent = self:GetBaseParent() local baseparent = self:GetBaseParent()
if baseparent and baseparent.type == "frame" then if baseparent and baseparent.type == "frame" then
baseparent:MakeTop() baseparent:MakeTop()
@ -180,7 +180,7 @@ function newobject:mousereleased(x, y, button)
local enabled = self.enabled local enabled = self.enabled
local onclick = self.OnClick 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 enabled then
if onclick then if onclick then
onclick(self, x, y) onclick(self, x, y)

View File

@ -128,7 +128,7 @@ function newobject:mousepressed(x, y, button)
local hover = self.hover local hover = self.hover
if hover and button == "l" then if hover and button == 1 then
local baseparent = self:GetBaseParent() local baseparent = self:GetBaseParent()
if baseparent and baseparent.type == "frame" then if baseparent and baseparent.type == "frame" then
baseparent:MakeTop() baseparent:MakeTop()
@ -155,7 +155,7 @@ function newobject:mousereleased(x, y, button)
local onclick = self.OnClick local onclick = self.OnClick
if hover and self.down then if hover and self.down then
if button == "l" then if button == 1 then
onclick(x, y, self) onclick(x, y, self)
end end
end end

View File

@ -161,7 +161,7 @@ function newobject:mousepressed(x, y, button)
local scrollamount = self.mousewheelscrollamount local scrollamount = self.mousewheelscrollamount
if self.hover and button == "l" then if self.hover and button == 1 then
local baseparent = self:GetBaseParent() local baseparent = self:GetBaseParent()
if baseparent and baseparent.type == "frame" then if baseparent and baseparent.type == "frame" then
baseparent:MakeTop() baseparent:MakeTop()

View File

@ -167,9 +167,9 @@ function newobject:mousepressed(x, y, button)
end end
end end
if self.hover and button == "l" then if self.hover and button == 1 then
local baseparent = self:GetBaseParent() 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() baseparent:MakeTop()
end end
self.down = true self.down = true
@ -194,7 +194,7 @@ function newobject:mousereleased(x, y, button)
local enabled = self.enabled local enabled = self.enabled
local onclick = self.OnClick 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 enabled then
onclick(self, x, y) onclick(self, x, y)
end end

View File

@ -107,7 +107,7 @@ function newobject:mousepressed(x, y, button)
return return
end end
if self.hover and button == "l" then if self.hover and button == 1 then
local baseparent = self:GetBaseParent() local baseparent = self:GetBaseParent()
if baseparent and baseparent.type == "frame" then if baseparent and baseparent.type == "frame" then
baseparent:MakeTop() baseparent:MakeTop()
@ -129,12 +129,12 @@ function newobject:mousereleased(x, y, button)
if self.hover then if self.hover then
local parent = self:GetParent():GetParent() local parent = self:GetParent():GetParent()
if button == "l" then if button == 1 then
local onrowclicked = parent.OnRowClicked local onrowclicked = parent.OnRowClicked
if onrowclicked then if onrowclicked then
onrowclicked(parent, self, self.columndata) onrowclicked(parent, self, self.columndata)
end end
elseif button == "r" then elseif button == 2 then
local onrowrightclicked = parent.OnRowRightClicked local onrowrightclicked = parent.OnRowRightClicked
if onrowrightclicked then if onrowrightclicked then
onrowrightclicked(parent, self, self.columndata) onrowrightclicked(parent, self, self.columndata)

View File

@ -134,7 +134,7 @@ function newobject:mousepressed(x, y, button)
local hover = self.hover local hover = self.hover
if hover and button == "l" then if hover and button == 1 then
local baseparent = self:GetBaseParent() local baseparent = self:GetBaseParent()
if baseparent and baseparent.type == "frame" then if baseparent and baseparent.type == "frame" then
baseparent:MakeTop() baseparent:MakeTop()

View File

@ -188,7 +188,7 @@ function newobject:mousereleased(x, y, button)
local hover = self.hover local hover = self.hover
local option_type = self.option_type 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 local func = self.func
if func then if func then
local text = self.text local text = self.text

View File

@ -215,7 +215,7 @@ function newobject:mousepressed(x, y, button)
local children = self.children local children = self.children
local scrollamount = self.mousewheelscrollamount 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() self:Close()
end end

View File

@ -120,7 +120,7 @@ function newobject:mousepressed(x, y, button)
local hover = self.hover local hover = self.hover
if hover and button == "l" then if hover and button == 1 then
self.down = true self.down = true
loveframes.downobject = self loveframes.downobject = self
end end
@ -141,7 +141,7 @@ function newobject:mousereleased(x, y, button)
local text = self.text 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) self.parent.list:SelectChoice(text)
end end

View File

@ -175,7 +175,7 @@ function newobject:mousepressed(x, y, button)
local hover = self.hover local hover = self.hover
local delayamount = self.delayamount local delayamount = self.delayamount
if hover and button == "l" then if hover and button == 1 then
self.down = true self.down = true
self.scrolldelay = time + delayamount + 0.5 self.scrolldelay = time + delayamount + 0.5
local baseparent = self:GetBaseParent() local baseparent = self:GetBaseParent()
@ -218,7 +218,7 @@ function newobject:mousereleased(x, y, button)
local internals = self.internals local internals = self.internals
if button == "l" then if button == 1 then
self.down = false self.down = false
end end

View File

@ -247,7 +247,7 @@ function newobject:mousepressed(x, y, button)
local dragging = self.dragging local dragging = self.dragging
if not dragging then if not dragging then
if button == "l" then if button == 1 then
self.starty = self.staticy self.starty = self.staticy
self.startx = self.staticx self.startx = self.staticx
self.clickx = x self.clickx = x

View File

@ -121,7 +121,7 @@ function newobject:mousepressed(x, y, button)
local hover = self.hover local hover = self.hover
if hover and button == "l" then if hover and button == 1 then
local baseparent = self:GetBaseParent() local baseparent = self:GetBaseParent()
if baseparent.type == "frame" then if baseparent.type == "frame" then
baseparent:MakeTop() baseparent:MakeTop()
@ -149,7 +149,7 @@ function newobject:mousereleased(x, y, button)
local onclick = self.OnClick local onclick = self.OnClick
if hover and down then if hover and down then
if button == "l" then if button == 1 then
onclick(x, y, self) onclick(x, y, self)
end end
end end

View File

@ -193,7 +193,7 @@ function newobject:mousepressed(x, y, button)
local hover = self.hover local hover = self.hover
if hover and button == "l" then if hover and button == 1 then
local baseparent = self:GetBaseParent() local baseparent = self:GetBaseParent()
if baseparent and baseparent.type == "frame" then if baseparent and baseparent.type == "frame" then
baseparent:MakeTop() baseparent:MakeTop()

View File

@ -131,7 +131,7 @@ function newobject:mousepressed(x, y, button)
local hover = self.hover local hover = self.hover
local internals = self.internals local internals = self.internals
if hover and button == "l" then if hover and button == 1 then
local baseparent = self:GetBaseParent() local baseparent = self:GetBaseParent()
if baseparent and baseparent.type == "frame" then if baseparent and baseparent.type == "frame" then
baseparent:MakeTop() baseparent:MakeTop()
@ -158,8 +158,8 @@ function newobject:mousereleased(x, y, button)
local parent = self.parent local parent = self.parent
local tabnumber = self.tabnumber local tabnumber = self.tabnumber
if hover and button == "l" then if hover and button == 1 then
if button == "l" then if button == 1 then
local tab = parent.tab local tab = parent.tab
local internals = parent.internals local internals = parent.internals
local onopened = self.OnOpened local onopened = self.OnOpened

View File

@ -157,7 +157,7 @@ function newobject:mousepressed(x, y, button)
v:mousepressed(x, y, button) v:mousepressed(x, y, button)
end end
if self.hover and button == "l" then if self.hover and button == 1 then
local time = os.time() local time = os.time()
if self.lastclick + 0.40 > time then if self.lastclick + 0.40 > time then
self.open = not self.open self.open = not self.open

View File

@ -123,7 +123,7 @@ function newobject:mousepressed(x, y, button)
local hover = self.hover local hover = self.hover
if hover and button == "l" then if hover and button == 1 then
local bool = not self.parent.open local bool = not self.parent.open
if bool then if bool then
local onopen = self.parent.OnOpen local onopen = self.parent.OnOpen

View File

@ -211,7 +211,7 @@ function newobject:mousepressed(x, y, button)
local children = self.children local children = self.children
local internals = self.internals local internals = self.internals
if hover and button == "l" then if hover and button == 1 then
local baseparent = self:GetBaseParent() local baseparent = self:GetBaseParent()
if baseparent and baseparent.type == "frame" then if baseparent and baseparent.type == "frame" then
baseparent:MakeTop() baseparent:MakeTop()

View File

@ -137,7 +137,7 @@ function newobject:mousepressed(x, y, button)
local haslist = self.haslist local haslist = self.haslist
local enabled = self.enabled 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() local baseparent = self:GetBaseParent()
if baseparent and baseparent.type == "frame" then if baseparent and baseparent.type == "frame" then
baseparent:MakeTop() baseparent:MakeTop()

View File

@ -253,7 +253,7 @@ function newobject:mousepressed(x, y, button)
local internals = self.internals local internals = self.internals
local hover = self.hover local hover = self.hover
if hover and button == "l" then if hover and button == 1 then
local baseparent = self:GetBaseParent() local baseparent = self:GetBaseParent()
if baseparent and baseparent.type == "frame" then if baseparent and baseparent.type == "frame" then
baseparent:MakeTop() baseparent:MakeTop()

View File

@ -136,7 +136,7 @@ function newobject:mousepressed(x, y, button)
local children = self.children local children = self.children
local hover = self.hover local hover = self.hover
if hover and button == "l" then if hover and button == 1 then
local baseparent = self:GetBaseParent() local baseparent = self:GetBaseParent()
if baseparent and baseparent.type == "frame" then if baseparent and baseparent.type == "frame" then
baseparent:MakeTop() baseparent:MakeTop()

View File

@ -174,7 +174,7 @@ function newobject:mousepressed(x, y, button)
local hover = self.hover local hover = self.hover
if hover and button == "l" then if hover and button == 1 then
local baseparent = self:GetBaseParent() local baseparent = self:GetBaseParent()
if baseparent and baseparent.type == "frame" then if baseparent and baseparent.type == "frame" then
baseparent:MakeTop() baseparent:MakeTop()
@ -199,7 +199,7 @@ function newobject:mousereleased(x, y, button)
return return
end 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 if not self.checked then
-- a radio button can only be unchecked by checking another radio button -- a radio button can only be unchecked by checking another radio button
self:SetChecked(true) self:SetChecked(true)

View File

@ -177,7 +177,7 @@ function newobject:mousepressed(x, y, button)
local slidetype = self.slidetype local slidetype = self.slidetype
local scrollable = self.scrollable local scrollable = self.scrollable
if hover and button == "l" then if hover and button == 1 then
if slidetype == "horizontal" then if slidetype == "horizontal" then
local xpos = x - self.x local xpos = x - self.x
local button = internals[1] local button = internals[1]

View File

@ -211,7 +211,7 @@ function newobject:mousepressed(x, y, button)
local tab = self.tab local tab = self.tab
local hover = self.hover local hover = self.hover
if hover and button == "l" then if hover and button == 1 then
local baseparent = self:GetBaseParent() local baseparent = self:GetBaseParent()
if baseparent and baseparent.type == "frame" then if baseparent and baseparent.type == "frame" then
baseparent:MakeTop() baseparent:MakeTop()

View File

@ -195,7 +195,7 @@ function newobject:mousepressed(x, y, button)
end end
local hover = self.hover local hover = self.hover
if hover and button == "l" then if hover and button == 1 then
local baseparent = self:GetBaseParent() local baseparent = self:GetBaseParent()
if baseparent and baseparent.type == "frame" then if baseparent and baseparent.type == "frame" then
baseparent:MakeTop() baseparent:MakeTop()

View File

@ -354,7 +354,7 @@ function newobject:mousepressed(x, y, button)
local inputobject = loveframes.inputobject local inputobject = loveframes.inputobject
if hover then if hover then
if button == "l" then if button == 1 then
if inputobject ~= self then if inputobject ~= self then
loveframes.inputobject = self loveframes.inputobject = self
end end