Improvements to quest event create/delete behavior.

This commit is contained in:
Daan Vanden Bosch 2021-06-19 16:31:44 +02:00
parent 88421d894c
commit f228fda979
3 changed files with 9 additions and 1 deletions

View File

@ -11,7 +11,7 @@ class CreateEventAction(
private val index: Int,
private val event: QuestEventModel,
) : Action {
override val description: String = "Add event ${event.id.value}"
override val description: String = "Add event"
override fun execute() {
change {

View File

@ -192,6 +192,12 @@ class QuestEditorStore(
setSelectedEntity(null)
}
}
val quest = currentQuest.value
if (quest != null && _currentArea.value?.id != event.areaId) {
_currentArea.value = areaStore.getArea(quest.episode, event.areaId)
}
}
_selectedEvent.value = event

View File

@ -38,6 +38,8 @@ class EventsControllerTests : WebTestSuite {
store.redo()
assertEquals(1, quest.events.value.size)
assertTrue(store.canUndo.value)
assertFalse(store.canRedo.value)
}
@Test