Skip to content

Commit 8d0b855

Browse files
authored
fix: DisappearingScaleBar do not disappear after specified visibilityDurationMillis (#168)
1 parent 5dac3d9 commit 8d0b855

File tree

1 file changed

+5
-8
lines changed
  • maps-compose-widgets/src/main/java/com/google/maps/android/compose/widgets

1 file changed

+5
-8
lines changed

maps-compose-widgets/src/main/java/com/google/maps/android/compose/widgets/ScaleBar.kt

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -213,14 +213,11 @@ public fun DisappearingScaleBar(
213213
}
214214

215215
LaunchedEffect(key1 = cameraPositionState.position.zoom) {
216-
if (visible.isIdle && !visible.currentState) {
217-
// Show ScaleBar
218-
visible.targetState = true
219-
} else if (visible.isIdle && visible.currentState) {
220-
// Hide ScaleBar after timeout period
221-
delay(visibilityDurationMillis.toLong())
222-
visible.targetState = false
223-
}
216+
// Show ScaleBar
217+
visible.targetState = true
218+
delay(visibilityDurationMillis.toLong())
219+
// Hide ScaleBar after timeout period
220+
visible.targetState = false
224221
}
225222

226223
AnimatedVisibility(

0 commit comments

Comments
 (0)