destroy the sprite if we were doing a preview

This commit is contained in:
Tim Young 2017-09-19 13:22:25 -05:00
parent 6e2661a648
commit 0389b3a759

View File

@ -432,6 +432,7 @@ namespace SpriteLibrary
private void WeHaveNewItem() private void WeHaveNewItem()
{ {
if (PreviewSprite != null) PreviewSprite.Destroy();
TempInformation.CopyFrom(SpriteInformation[CurrentSIIndex]); TempInformation.CopyFrom(SpriteInformation[CurrentSIIndex]);
SpriteInformationToForm(); SpriteInformationToForm();
UpdateMenu(); UpdateMenu();
@ -441,7 +442,9 @@ namespace SpriteLibrary
if (nindex < 0) return; if (nindex < 0) return;
if (nindex >= SpriteInformation.Count) return; if (nindex >= SpriteInformation.Count) return;
CurrentSIIndex = nindex; CurrentSIIndex = nindex;
if (PreviewSprite != null) PreviewSprite.Destroy();
TempInformation = SpriteInformation[nindex].Clone(); TempInformation = SpriteInformation[nindex].Clone();
CurrentSIAnimation = 0; //always start at animation 0
WeHaveNewItem(); WeHaveNewItem();
UpdateMenu(); UpdateMenu();
} }