diff --git a/projects/nat-archive-tool/src/nat/ArchiveController.kiss b/projects/nat-archive-tool/src/nat/ArchiveController.kiss index 0f56b4d9..24e998cd 100644 --- a/projects/nat-archive-tool/src/nat/ArchiveController.kiss +++ b/projects/nat-archive-tool/src/nat/ArchiveController.kiss @@ -328,4 +328,10 @@ (defCommand SwitchPlayground [name (Text null)] (archive.changePlaygrounds ->:Void [:DynamicAccess p] (dictSet p "default" name)) - (when playgroundSystem (playgroundSystem.switchPlaygroundKey name)))) + (when playgroundSystem (playgroundSystem.switchPlaygroundKey name))) + + (defCommand RemoveFromPlayground [entries (SelectedEntries 1 null)] + (for e entries + (when (hasComponent e Positions) + (withWritableComponents archive e [positions Positions] + (positions.remove (dictGet archive.playgrounds "default")))) e))) diff --git a/projects/nat-archive-tool/src/nat/systems/PlaygroundSystem.kiss b/projects/nat-archive-tool/src/nat/systems/PlaygroundSystem.kiss index 34ef278c..f1418e3c 100644 --- a/projects/nat-archive-tool/src/nat/systems/PlaygroundSystem.kiss +++ b/projects/nat-archive-tool/src/nat/systems/PlaygroundSystem.kiss @@ -5,7 +5,8 @@ (defNew [&prop :ArchiveUI ui :EntryChecker canProcess - &prop :PlaygroundEntryProcessor processor] + &prop :PlaygroundEntryProcessor processor + :EntryProcessor onRemoveEntry] (super ->[archive e] @@ -21,7 +22,8 @@ (return null)))) (whenLet [pos (dictGet (readComponent e Positions) _playgroundKey)] (processor archive e pos ui)) - })) + }) + (set this.onRemoveEntry onRemoveEntry)) (method switchPlaygroundKey [key] (when _playgroundKey diff --git a/projects/nat-flixel-desktop-playground/source/EntrySpriteSystem.kiss b/projects/nat-flixel-desktop-playground/source/EntrySpriteSystem.kiss index c31dd56d..489af55f 100644 --- a/projects/nat-flixel-desktop-playground/source/EntrySpriteSystem.kiss +++ b/projects/nat-flixel-desktop-playground/source/EntrySpriteSystem.kiss @@ -16,12 +16,11 @@ (unless (sprites.exists e.id) (let [sprite (new EntrySprite this _playgroundKey pos archive e controller)] (playState.entryGroup.add sprite) - (dictSet sprites e.id sprite)))) - - (set onRemoveEntry + (dictSet sprites e.id sprite))) ->[archive e &opt ui] { (.kill (dictGet sprites e.id)) + (playState.entryGroup.remove (dictGet sprites e.id)) (sprites.remove e.id) // When an Entry is hidden, we can bet the user doesn't want it selected anymore (controller.DeSelectEntry e) diff --git a/projects/nat-flixel-desktop-playground/source/PlayState.kiss b/projects/nat-flixel-desktop-playground/source/PlayState.kiss index 4e910845..cd5df342 100644 --- a/projects/nat-flixel-desktop-playground/source/PlayState.kiss +++ b/projects/nat-flixel-desktop-playground/source/PlayState.kiss @@ -1,9 +1,5 @@ (loadFrom "nat-archive-tool" "src/nat/Lib.kiss") -// TODO handleChanges() will need to kill every changed Entry's sprite and make a new one - -// make interactible sprites for entries that have images - (var TEXT_SIZE 16) (prop &mut :EntrySpriteSystem spriteSystem) @@ -251,9 +247,7 @@ // process the WikipediaImageSystem and run spriteSystem process on newly created entries that get one (archive.processSystems this) // Do a second loop through the systems, so Playground systems that trigger Core systems have their effects processed - (archive.processSystems this) - - (FlxG.camera.calculateScrollBounds entryGroup SCROLL_BOUND_MARGIN)) + (archive.processSystems this)) (doFor e changeSet // Entries whose data changed to remove them from the sprite pool will already have been removed @@ -262,7 +256,9 @@ // refresh the sprites for entries that changed data but still should have sprites (when (spriteSystem.sprites.exists e.id) (spriteSystem.onRemoveEntry archive e)) - (spriteSystem.processEntry archive e)))) + (spriteSystem.processEntry archive e))) + + (FlxG.camera.calculateScrollBounds entryGroup SCROLL_BOUND_MARGIN)) (prop &mut :Int uiY 0)