when refreshing sprite, keep it blue
This commit is contained in:
@@ -13,6 +13,7 @@
|
|||||||
(.onComplete (BitmapData.loadFromFile (joinPath archive.archiveDir "files" (nth images.imageFiles images.pinnedImageIndex)))
|
(.onComplete (BitmapData.loadFromFile (joinPath archive.archiveDir "files" (nth images.imageFiles images.pinnedImageIndex)))
|
||||||
->bitmapData {
|
->bitmapData {
|
||||||
(loadGraphic bitmapData)
|
(loadGraphic bitmapData)
|
||||||
|
(updateColor)
|
||||||
(when (hasComponent e Scale)
|
(when (hasComponent e Scale)
|
||||||
(let [:Float scale (readComponent archive e Scale)]
|
(let [:Float scale (readComponent archive e Scale)]
|
||||||
(this.scale.set scale scale)
|
(this.scale.set scale scale)
|
||||||
@@ -21,20 +22,23 @@
|
|||||||
(enableMouseDrag)
|
(enableMouseDrag)
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
// TODO add onEntrySelected(), onEntryDeselected() callback to ArchiveUI and use these to change color if SelectByName or SelectByTags are used on an Entry that has a sprite in the entryspritesystem's dictionary
|
||||||
(set mousePressedCallback
|
(set mousePressedCallback
|
||||||
->[self _x _y]
|
->[self _x _y]
|
||||||
{
|
{
|
||||||
(controller.ToggleEntrySelection e)
|
(controller.ToggleEntrySelection e)
|
||||||
(set selected !selected)
|
(updateColor)
|
||||||
(if selected
|
|
||||||
{
|
|
||||||
(set color FlxColor.BLUE)
|
|
||||||
}
|
|
||||||
{
|
|
||||||
(set color FlxColor.WHITE)
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
(set mouseStopDragCallback
|
(set mouseStopDragCallback
|
||||||
->[self _dx _dy]
|
->[self _dx _dy]
|
||||||
(withWritableComponents archive e [positions Positions]
|
(withWritableComponents archive e [positions Positions]
|
||||||
(dictSet positions positionKey (object x (cast this.x Float) y (cast this.y Float) z 0.0)))))
|
(dictSet positions positionKey (object x (cast this.x Float) y (cast this.y Float) z 0.0)))))
|
||||||
|
|
||||||
|
(method updateColor []
|
||||||
|
(if !(= -1 (controller.selectedEntries.indexOf e))
|
||||||
|
{
|
||||||
|
(set color FlxColor.BLUE)
|
||||||
|
}
|
||||||
|
{
|
||||||
|
(set color FlxColor.WHITE)
|
||||||
|
}))
|
||||||
@@ -167,10 +167,10 @@
|
|||||||
|
|
||||||
(method handleChanges [:Archive archive :ChangeSet changeSet]
|
(method handleChanges [:Archive archive :ChangeSet changeSet]
|
||||||
(doFor e changeSet
|
(doFor e changeSet
|
||||||
// refresh the sprites for entries that changed data.
|
|
||||||
// Entries whose data changed to remove them from the sprite pool will already have been removed
|
// Entries whose data changed to remove them from the sprite pool will already have been removed
|
||||||
// by refreshEntry()
|
// by refreshEntry()
|
||||||
(when (spriteSystem.entries.exists e.id)
|
(when (spriteSystem.entries.exists e.id)
|
||||||
|
// refresh the sprites for entries that changed data but still should have sprites
|
||||||
(when (spriteSystem.sprites.exists e.id)
|
(when (spriteSystem.sprites.exists e.id)
|
||||||
(spriteSystem.onRemoveEntry archive e))
|
(spriteSystem.onRemoveEntry archive e))
|
||||||
(spriteSystem.processEntry archive e))))
|
(spriteSystem.processEntry archive e))))
|
||||||
|
|||||||
Reference in New Issue
Block a user