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)
-- reset the hover object
if button == "l" then
if button == 1 then
loveframes.downobject = false
loveframes.selectedobject = false
end

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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()

View File

@ -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()

View File

@ -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

View File

@ -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()

View File

@ -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)

View File

@ -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

View File

@ -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()

View File

@ -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

View File

@ -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)

View File

@ -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()

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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()

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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()

View File

@ -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()

View File

@ -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()

View File

@ -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()

View File

@ -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)

View File

@ -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]

View File

@ -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()

View File

@ -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()

View File

@ -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