Skip to content

Instantly share code, notes, and snippets.

@SeongUgJung
Created October 5, 2019 11:43
Show Gist options
  • Save SeongUgJung/efcbf061f389f08feca655a43769e335 to your computer and use it in GitHub Desktop.
Save SeongUgJung/efcbf061f389f08feca655a43769e335 to your computer and use it in GitHub Desktop.
class LatLongSnapInteractor : MapBehavior {
private var latLong = ObservableField<LatLong>(LatLong.DEFAULT)
fun setLatLong(latLong: LatLong) {
this.latLong.set(latLong)
}
// will activate during resume-pause
fun onVisible(map:Map): Completable {
return latLong.asObservable()
.filter { it != LatLong.DEFAULT }
.switchMap { latLong -> map.snapLatLong(latLong) }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment