mirror of
https://github.com/linux-man/LoveFrames.git
synced 2024-11-26 05:14:21 +00:00
Version 0.9.1.2 - Alpha (see changelog.txt)
This commit is contained in:
parent
546700a0a3
commit
e41d70aa27
@ -1,3 +1,17 @@
|
||||
================================================
|
||||
Version 0.9.1.2 - Alpha (May 12 - 2012)
|
||||
================================================
|
||||
[ADDED] a system for preventing objects from being hovered over when another object is being pressed or is "down"
|
||||
[ADDED] "down" property for the checkbox object
|
||||
[ADDED] "down" property for the collapsible category object
|
||||
[ADDED] a new method for the tabs object: SetToolTipFont(font)
|
||||
|
||||
[FIXED] list:GetScrollBar() crashing when the list had no scroll bar
|
||||
[FIXED] not being able to move the text input blinker to the front or end of the it's text by clicking on it's whitespace
|
||||
[FIXED] the multichoice row object being "down" when mouse buttons other than the left mouse button were pressed
|
||||
|
||||
[CHANGED] collapsible category opening and closing system (will now only open or close when "down")
|
||||
|
||||
================================================
|
||||
Version 0.9.1 - Alpha (May 8 - 2012)
|
||||
================================================
|
||||
|
8
init.lua
8
init.lua
@ -9,7 +9,7 @@ loveframes = {}
|
||||
-- library info
|
||||
loveframes.info = {}
|
||||
loveframes.info.author = "Nikolai Resokav"
|
||||
loveframes.info.version = "0.9.1"
|
||||
loveframes.info.version = "0.9.1.2"
|
||||
loveframes.info.stage = "Alpha"
|
||||
|
||||
-- library configurations
|
||||
@ -20,8 +20,8 @@ loveframes.config["ACTIVESKIN"] = "Blue"
|
||||
loveframes.config["INDEXSKINIMAGES"] = true
|
||||
loveframes.config["DEBUG"] = true
|
||||
|
||||
-- drawcount
|
||||
loveframes.drawcount = 0
|
||||
loveframes.hoverobject = false
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: load()
|
||||
@ -115,6 +115,10 @@ function loveframes.mousereleased(x, y, button)
|
||||
|
||||
object:mousereleased(x, y, button)
|
||||
|
||||
if button == "l" then
|
||||
loveframes.hoverobject = false
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
|
@ -577,6 +577,7 @@ function base:CheckHover()
|
||||
|
||||
local x, y = love.mouse.getPosition()
|
||||
local selfcol = loveframes.util.BoundingBox(x, self.x, y, self.y, 1, self.width, 1, self.height)
|
||||
local hoverobject = loveframes.hoverobject
|
||||
|
||||
-- is the mouse inside the object?
|
||||
if selfcol == true then
|
||||
@ -584,7 +585,15 @@ function base:CheckHover()
|
||||
local top = self:IsTopCollision()
|
||||
|
||||
if top == true then
|
||||
self.hover = true
|
||||
if hoverobject == false then
|
||||
self.hover = true
|
||||
else
|
||||
if hoverobject == self then
|
||||
self.hover = true
|
||||
else
|
||||
self.hover = false
|
||||
end
|
||||
end
|
||||
else
|
||||
self.hover = false
|
||||
end
|
||||
|
@ -39,6 +39,18 @@ function button:update(dt)
|
||||
|
||||
self:CheckHover()
|
||||
|
||||
if self.hover == false then
|
||||
self.down = false
|
||||
elseif self.hover == true then
|
||||
if loveframes.hoverobject == self then
|
||||
self.down = true
|
||||
end
|
||||
end
|
||||
|
||||
if self.down == false and loveframes.hoverobject == self then
|
||||
self.hover = true
|
||||
end
|
||||
|
||||
-- move to parent if there is a parent
|
||||
if self.parent ~= loveframes.base then
|
||||
self.x = self.parent.x + self.staticx
|
||||
@ -97,6 +109,7 @@ function button:mousepressed(x, y, button)
|
||||
end
|
||||
|
||||
self.down = true
|
||||
loveframes.hoverobject = self
|
||||
|
||||
end
|
||||
|
||||
|
@ -22,6 +22,7 @@ function checkbox:initialize()
|
||||
self.checked = false
|
||||
self.lastvalue = false
|
||||
self.internal = false
|
||||
self.down = true
|
||||
self.internals = {}
|
||||
self.OnChanged = nil
|
||||
|
||||
@ -41,6 +42,18 @@ function checkbox:update(dt)
|
||||
|
||||
self:CheckHover()
|
||||
|
||||
if self.hover == false then
|
||||
self.down = false
|
||||
elseif self.hover == true then
|
||||
if loveframes.hoverobject == self then
|
||||
self.down = true
|
||||
end
|
||||
end
|
||||
|
||||
if self.down == false and loveframes.hoverobject == self then
|
||||
self.hover = true
|
||||
end
|
||||
|
||||
-- move to parent if there is a parent
|
||||
if self.parent ~= loveframes.base then
|
||||
self.x = self.parent.x + self.staticx
|
||||
@ -127,6 +140,9 @@ function checkbox:mousepressed(x, y, button)
|
||||
baseparent:MakeTop()
|
||||
end
|
||||
|
||||
self.down = true
|
||||
loveframes.hoverobject = self
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -21,6 +21,7 @@ function collapsiblecategory:initialize()
|
||||
self.padding = 5
|
||||
self.internal = false
|
||||
self.open = false
|
||||
self.down = false
|
||||
self.children = {}
|
||||
self.OnOpenedClosed = nil
|
||||
|
||||
@ -116,6 +117,9 @@ function collapsiblecategory:mousepressed(x, y, button)
|
||||
baseparent:MakeTop()
|
||||
end
|
||||
|
||||
self.down = true
|
||||
loveframes.hoverobject = self
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
@ -147,7 +151,7 @@ function collapsiblecategory:mousereleased(x, y, button)
|
||||
local open = self.open
|
||||
local col = loveframes.util.BoundingBox(self.x, x, self.y, y, self.width, 1, self.closedheight, 1)
|
||||
|
||||
if hover == true and button == "l" and col == true then
|
||||
if hover == true and button == "l" and col == true and self.down == true then
|
||||
|
||||
if open == true then
|
||||
self:SetOpen(false)
|
||||
@ -155,6 +159,8 @@ function collapsiblecategory:mousereleased(x, y, button)
|
||||
self:SetOpen(true)
|
||||
end
|
||||
|
||||
self.down = false
|
||||
|
||||
end
|
||||
|
||||
if self.open == true then
|
||||
|
@ -40,6 +40,18 @@ function imagebutton:update(dt)
|
||||
|
||||
self:CheckHover()
|
||||
|
||||
if self.hover == false then
|
||||
self.down = false
|
||||
elseif self.hover == true then
|
||||
if loveframes.hoverobject == self then
|
||||
self.down = true
|
||||
end
|
||||
end
|
||||
|
||||
if self.down == false and loveframes.hoverobject == self then
|
||||
self.hover = true
|
||||
end
|
||||
|
||||
-- move to parent if there is a parent
|
||||
if self.parent ~= loveframes.base then
|
||||
self.x = self.parent.x + self.staticx
|
||||
@ -98,6 +110,7 @@ function imagebutton:mousepressed(x, y, imagebutton)
|
||||
end
|
||||
|
||||
self.down = true
|
||||
loveframes.hoverobject = self
|
||||
|
||||
end
|
||||
|
||||
|
@ -37,6 +37,18 @@ function closebutton:update(dt)
|
||||
|
||||
self:CheckHover()
|
||||
|
||||
if self.hover == false then
|
||||
self.down = false
|
||||
elseif self.hover == true then
|
||||
if loveframes.hoverobject == self then
|
||||
self.down = true
|
||||
end
|
||||
end
|
||||
|
||||
if self.down == false and loveframes.hoverobject == self then
|
||||
self.hover = true
|
||||
end
|
||||
|
||||
-- move to parent if there is a parent
|
||||
if self.parent ~= loveframes.base then
|
||||
self.x = self.parent.x + self.staticx
|
||||
@ -95,6 +107,8 @@ function closebutton:mousepressed(x, y, button)
|
||||
end
|
||||
|
||||
self.down = true
|
||||
loveframes.hoverobject = self
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -60,6 +60,18 @@ function columnlistheader:update(dt)
|
||||
|
||||
self:CheckHover()
|
||||
|
||||
if self.hover == false then
|
||||
self.down = false
|
||||
elseif self.hover == true then
|
||||
if loveframes.hoverobject == self then
|
||||
self.down = true
|
||||
end
|
||||
end
|
||||
|
||||
if self.down == false and loveframes.hoverobject == self then
|
||||
self.hover = true
|
||||
end
|
||||
|
||||
-- move to parent if there is a parent
|
||||
if self.parent ~= loveframes.base then
|
||||
self.x = self.parent.x + self.staticx
|
||||
@ -114,6 +126,7 @@ function columnlistheader:mousepressed(x, y, button)
|
||||
end
|
||||
|
||||
self.down = true
|
||||
loveframes.hoverobject = self
|
||||
|
||||
end
|
||||
|
||||
|
@ -21,7 +21,6 @@ function multichoicerow:initialize()
|
||||
self.internal = true
|
||||
self.down = false
|
||||
self.canclick = false
|
||||
self.OnClick = nil
|
||||
|
||||
end
|
||||
|
||||
@ -39,6 +38,18 @@ function multichoicerow:update(dt)
|
||||
|
||||
self:CheckHover()
|
||||
|
||||
if self.hover == false then
|
||||
self.down = false
|
||||
elseif self.hover == true then
|
||||
if loveframes.hoverobject == self then
|
||||
self.down = true
|
||||
end
|
||||
end
|
||||
|
||||
if self.down == false and loveframes.hoverobject == self then
|
||||
self.hover = true
|
||||
end
|
||||
|
||||
-- move to parent if there is a parent
|
||||
if self.parent ~= loveframes.base then
|
||||
self.x = self.parent.x + self.staticx
|
||||
@ -84,7 +95,12 @@ function multichoicerow:mousepressed(x, y, button)
|
||||
return
|
||||
end
|
||||
|
||||
self.down = true
|
||||
if self.hover == true and button == "l" then
|
||||
|
||||
self.down = true
|
||||
loveframes.hoverobject = self
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@ -107,6 +123,10 @@ function multichoicerow:mousereleased(x, y, button)
|
||||
|
||||
end
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: SetText(text)
|
||||
- desc: sets the object's text
|
||||
--]]---------------------------------------------------------
|
||||
function multichoicerow:SetText(text)
|
||||
|
||||
self.text = text
|
||||
|
@ -218,6 +218,7 @@ function scrollbar:mousepressed(x, y, button)
|
||||
self.clickx = x
|
||||
self.clicky = y
|
||||
self.dragging = true
|
||||
loveframes.hoverobject = self
|
||||
|
||||
end
|
||||
|
||||
|
@ -37,6 +37,18 @@ function scrollbutton:update(dt)
|
||||
|
||||
self:CheckHover()
|
||||
|
||||
if self.hover == false then
|
||||
self.down = false
|
||||
elseif self.hover == true then
|
||||
if loveframes.hoverobject == self then
|
||||
self.down = true
|
||||
end
|
||||
end
|
||||
|
||||
if self.down == false and loveframes.hoverobject == self then
|
||||
self.hover = true
|
||||
end
|
||||
|
||||
-- move to parent if there is a parent
|
||||
if self.parent ~= loveframes.base then
|
||||
self.x = self.parent.x + self.staticx
|
||||
@ -96,6 +108,7 @@ function scrollbutton:mousepressed(x, y, scrollbutton)
|
||||
end
|
||||
|
||||
self.down = true
|
||||
loveframes.hoverobject = self
|
||||
|
||||
end
|
||||
|
||||
|
@ -47,6 +47,18 @@ function sliderbutton:update(dt)
|
||||
|
||||
self:CheckHover()
|
||||
|
||||
if self.hover == false then
|
||||
self.down = false
|
||||
elseif self.hover == true then
|
||||
if loveframes.hoverobject == self then
|
||||
self.down = true
|
||||
end
|
||||
end
|
||||
|
||||
if self.down == false and loveframes.hoverobject == self then
|
||||
self.hover = true
|
||||
end
|
||||
|
||||
-- move to parent if there is a parent
|
||||
if self.parent ~= loveframes.base then
|
||||
self.x = self.parent.x + self.staticx
|
||||
@ -131,6 +143,8 @@ function sliderbutton:mousepressed(x, y, button)
|
||||
self.dragging = true
|
||||
self.startx = self.staticx
|
||||
self.clickx = x
|
||||
loveframes.hoverobject = self
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -26,8 +26,8 @@ function tabbutton:initialize(parent, text, tabnumber, tip, image)
|
||||
self.image = nil
|
||||
|
||||
if tip then
|
||||
local tooltip = tooltip:new(self, tip)
|
||||
tooltip:SetFollowCursor(false)
|
||||
self.tooltip = tooltip:new(self, tip)
|
||||
self.tooltip:SetFollowCursor(false)
|
||||
end
|
||||
|
||||
if image then
|
||||
@ -121,6 +121,7 @@ function tabbutton:mousepressed(x, y, button)
|
||||
end
|
||||
|
||||
self.down = true
|
||||
loveframes.hoverobject = self
|
||||
|
||||
end
|
||||
|
||||
|
@ -259,8 +259,9 @@ function list:CalculateSize()
|
||||
self.extra = self.itemheight - height
|
||||
|
||||
if vbar == false then
|
||||
table.insert(self.internals, scrollbody:new(self, display))
|
||||
self:GetScrollBar().autoscroll = self.autoscroll
|
||||
local scrollbar = scrollbody:new(self, display)
|
||||
scrollbar.autoscroll = self.autoscroll
|
||||
table.insert(self.internals, scrollbar)
|
||||
self.vbar = true
|
||||
end
|
||||
|
||||
@ -287,8 +288,9 @@ function list:CalculateSize()
|
||||
self.extra = self.itemwidth - width
|
||||
|
||||
if hbar == false then
|
||||
table.insert(self.internals, scrollbody:new(self, display))
|
||||
self:GetScrollBar().autoscroll = self.autoscroll
|
||||
local scrollbar = scrollbody:new(self, display)
|
||||
scrollbar.autoscroll = self.autoscroll
|
||||
table.insert(self.internals, scrollbar)
|
||||
self.hbar = true
|
||||
end
|
||||
|
||||
@ -501,7 +503,17 @@ end
|
||||
--]]---------------------------------------------------------
|
||||
function list:GetScrollBar()
|
||||
|
||||
return self.internals[1].internals[1].internals[1]
|
||||
if self.vbar == true or self.hbar == true then
|
||||
|
||||
local scrollbar = self.internals[1].internals[1].internals[1]
|
||||
|
||||
return scrollbar
|
||||
|
||||
else
|
||||
|
||||
return false
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
@ -100,6 +100,7 @@ function multichoice:mousepressed(x, y, button)
|
||||
|
||||
self.haslist = true
|
||||
self.list = multichoicelist:new(self)
|
||||
loveframes.hoverobject = self
|
||||
|
||||
end
|
||||
|
||||
|
@ -25,6 +25,7 @@ function tabs:initialize()
|
||||
self.tabheight = 25
|
||||
self.autosize = true
|
||||
self.internal = false
|
||||
self.tooltipfont = love.graphics.newFont(10)
|
||||
self.tabs = {}
|
||||
self.internals = {}
|
||||
self.children = {}
|
||||
@ -405,3 +406,19 @@ function tabs:SetTabHeight(height)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: SetToolTipFont(font)
|
||||
- desc: sets the height of the tab buttons
|
||||
--]]---------------------------------------------------------
|
||||
function tabs:SetToolTipFont(font)
|
||||
|
||||
for k, v in ipairs(self.internals) do
|
||||
|
||||
if v.type == "tabbutton" and v.tooltip then
|
||||
v.tooltip:SetFont(font)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
@ -395,6 +395,14 @@ function textinput:GetTextCollisions(x, y)
|
||||
break
|
||||
end
|
||||
|
||||
if x < tx then
|
||||
self:MoveBlinker(0, true)
|
||||
end
|
||||
|
||||
if x > (tx + width) then
|
||||
self:MoveBlinker(#self.text, true)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user