diff --git a/core/src/main/kotlin/io/github/chrislo27/rhre3/editor/picker/FavouritesFilter.kt b/core/src/main/kotlin/io/github/chrislo27/rhre3/editor/picker/FavouritesFilter.kt index 9dbda8c4a..db2131902 100644 --- a/core/src/main/kotlin/io/github/chrislo27/rhre3/editor/picker/FavouritesFilter.kt +++ b/core/src/main/kotlin/io/github/chrislo27/rhre3/editor/picker/FavouritesFilter.kt @@ -8,6 +8,4 @@ class FavouritesFilter : SimpleFilter( gameFilter = { it.isFavourited || it.gameGroup.isFavourited } ) { - override val alwaysUpdate: Boolean = true - } \ No newline at end of file diff --git a/core/src/main/kotlin/io/github/chrislo27/rhre3/editor/picker/Filter.kt b/core/src/main/kotlin/io/github/chrislo27/rhre3/editor/picker/Filter.kt index 4e6e90e08..5ab0d9bae 100644 --- a/core/src/main/kotlin/io/github/chrislo27/rhre3/editor/picker/Filter.kt +++ b/core/src/main/kotlin/io/github/chrislo27/rhre3/editor/picker/Filter.kt @@ -44,7 +44,7 @@ abstract class Filter { field = value.coerceIn(0, maxGroupScroll) } val maxGroupScroll: Int - get() = (gameGroups.size / Editor.ICON_COUNT_X - Editor.ICON_COUNT_Y + 1).coerceAtLeast(0) + get() = (((gameGroups.size - 1) / Editor.ICON_COUNT_X + 1) - Editor.ICON_COUNT_Y).coerceAtLeast(0) protected fun clearAll() { gameGroups as MutableList diff --git a/core/src/main/kotlin/io/github/chrislo27/rhre3/editor/picker/SimpleFilter.kt b/core/src/main/kotlin/io/github/chrislo27/rhre3/editor/picker/SimpleFilter.kt index 2136393b2..36d4a5685 100644 --- a/core/src/main/kotlin/io/github/chrislo27/rhre3/editor/picker/SimpleFilter.kt +++ b/core/src/main/kotlin/io/github/chrislo27/rhre3/editor/picker/SimpleFilter.kt @@ -12,12 +12,11 @@ open class SimpleFilter(val groupFilter: (GameGroup) -> Boolean, ) : Filter() { var shouldUpdate: Boolean = true - open val alwaysUpdate: Boolean = false override fun update() { if (!shouldUpdate) return - shouldUpdate = alwaysUpdate + shouldUpdate = false gameGroups as MutableList gamesPerGroup as MutableMap diff --git a/core/src/main/kotlin/io/github/chrislo27/rhre3/editor/stage/EditorStage.kt b/core/src/main/kotlin/io/github/chrislo27/rhre3/editor/stage/EditorStage.kt index a664ff789..0741ff4b0 100644 --- a/core/src/main/kotlin/io/github/chrislo27/rhre3/editor/stage/EditorStage.kt +++ b/core/src/main/kotlin/io/github/chrislo27/rhre3/editor/stage/EditorStage.kt @@ -74,6 +74,7 @@ class EditorStage(parent: UIElement?, val hoverTextLabel: TextLabel val searchFilter = SearchFilter(this) + val favouritesFilter = FavouritesFilter() lateinit var playButton: PlaybackButton private set @@ -854,7 +855,7 @@ class EditorStage(parent: UIElement?, } filterButtons += tmp } - filterButtons += FilterButton(FavouritesFilter(), "editor.favourites", + filterButtons += FilterButton(favouritesFilter, "editor.favourites", palette, minimapBarStage, minimapBarStage).apply { this.location.set( screenWidth = buttonWidth, @@ -1168,7 +1169,8 @@ class EditorStage(parent: UIElement?, } Favourites.persist() - updateSelected(DirtyType.SEARCH_DIRTY) + favouritesFilter.shouldUpdate = true + updateSelected() } }