mirror of
https://github.com/linux-man/LoveFrames.git
synced 2024-11-26 05:14:21 +00:00
Open/close treenodes when they are left-clicked
This commit is contained in:
parent
3493e78813
commit
7451bd5863
@ -18,6 +18,7 @@ function newobject:initialize()
|
|||||||
self.height = 16
|
self.height = 16
|
||||||
self.level = 0
|
self.level = 0
|
||||||
self.leftpadding = 0
|
self.leftpadding = 0
|
||||||
|
self.lastclick = 0
|
||||||
self.open = false
|
self.open = false
|
||||||
self.internal = true
|
self.internal = true
|
||||||
self.internals = {}
|
self.internals = {}
|
||||||
@ -153,6 +154,11 @@ function newobject:mousepressed(x, y, button)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if self.hover and button == "l" then
|
if self.hover and button == "l" then
|
||||||
|
local time = os.time()
|
||||||
|
if self.lastclick + 0.40 > time then
|
||||||
|
self.open = not self.open
|
||||||
|
end
|
||||||
|
self.lastclick = time
|
||||||
local onselectnode = self.tree.OnSelectNode
|
local onselectnode = self.tree.OnSelectNode
|
||||||
self.tree.selectednode = self
|
self.tree.selectednode = self
|
||||||
if onselectnode then
|
if onselectnode then
|
||||||
|
Loading…
Reference in New Issue
Block a user