click to add/remove entry from playground selection

This commit is contained in:
2021-09-18 20:41:44 -06:00
parent 4adbd7d750
commit f3d7cecd4e
6 changed files with 46 additions and 17 deletions

View File

@@ -2,7 +2,10 @@
(defNew [:String positionKey
&prop :Archive archive
&prop :Entry e]
&prop :Entry e
&prop :ArchiveController controller]
[&mut :Bool selected false]
(let [images (readComponent archive e Images)]
(case (dictGet (readComponent archive e Positions) positionKey)
((object x x y y z z)
@@ -13,6 +16,20 @@
(enableMouseClicks false)
(enableMouseDrag)
}))
(set mousePressedCallback
->[self _x _y]
{
(controller.ToggleEntrySelection e)
(set selected !selected)
(if selected
{
(set color FlxColor.BLUE)
}
{
(set color FlxColor.WHITE)
})
})
(set mouseStopDragCallback
->[self _dx _dy]
(withWritableComponents archive e [positions Positions]