Skip to content

Instantly share code, notes, and snippets.

@feresr
Last active July 8, 2021 15:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save feresr/3a59281aad254d722a447bd10dd2dc59 to your computer and use it in GitHub Desktop.
Save feresr/3a59281aad254d722a447bd10dd2dc59 to your computer and use it in GitHub Desktop.
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