Skip to content

Instantly share code, notes, and snippets.

@feresr
Last active Jul 8, 2021
Embed
What would you like to do?
class EditorViewModel : ViewModel() {
private var appliedFilters = MutableStateFlow(sortedMapOf<FILTER, FloatArray>())
val lightContextualViewModel = SliderContextualViewModel(
onFilterChanged = ::onValueChanged,
filterFlow = appliedFilters.map {
it.filterKeys { listOf(FILTER.EXPOSURE, FILTER.GRAIN, FILTER.VIBRANCE).contains(it) }
},
onFilterCommitted = history::onCommit
)
val effectContextualViewModel = SliderContextualViewModel(
onFilterChanged = ::onValueChanged,
filterFlow = appliedFilters.map {
it.filterKeys {
listOf(FILTER.SATURATION, FILTER.CONTRAST, FILTER.HUE).contains(it)
}
},
onFilterCommitted = history::onCommit
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment