mirror of
https://github.com/linux-man/LoveFrames.git
synced 2024-11-18 16:04:22 +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.level = 0
|
||||
self.leftpadding = 0
|
||||
self.lastclick = 0
|
||||
self.open = false
|
||||
self.internal = true
|
||||
self.internals = {}
|
||||
@ -153,6 +154,11 @@ function newobject:mousepressed(x, y, button)
|
||||
end
|
||||
|
||||
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
|
||||
self.tree.selectednode = self
|
||||
if onselectnode then
|
||||
|
Loading…
Reference in New Issue
Block a user