From 9d6b17774d6e9954c52653418ab6fd1ce238baae Mon Sep 17 00:00:00 2001 From: Saket Narayan Date: Sat, 13 Jul 2024 00:58:01 -0400 Subject: [PATCH] Add some class documentation for HardwareShortcutsSpec --- .../zoomable/HardwareShortcutsSpec.kt | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/zoomable/src/commonMain/kotlin/me/saket/telephoto/zoomable/HardwareShortcutsSpec.kt b/zoomable/src/commonMain/kotlin/me/saket/telephoto/zoomable/HardwareShortcutsSpec.kt index 7eea2a22..7fbdcf31 100644 --- a/zoomable/src/commonMain/kotlin/me/saket/telephoto/zoomable/HardwareShortcutsSpec.kt +++ b/zoomable/src/commonMain/kotlin/me/saket/telephoto/zoomable/HardwareShortcutsSpec.kt @@ -1,8 +1,27 @@ package me.saket.telephoto.zoomable import androidx.compose.runtime.Immutable +import androidx.compose.ui.focus.FocusRequester import dev.drewhamilton.poko.Poko +/** + * Describes how keyboard and mouse shortcuts are handled. When [enabled], [Modifier.zoomable][zoomable]'s + * content will participate in the focus system to receive hardware events. + * + * Keep in mind that hardware shortcuts will not work until your zoomable content is focused. + * To do this automatically, use a [FocusRequester]: + * + * ``` + * val focusRequester = remember { FocusRequester() } + * LaunchedEffect(Unit) { + * focusRequester.requestFocus() + * } + * + * ZoomableImage( + * modifier = Modifier.focusRequester(focusRequester), + * ) + * ``` + */ @Poko @Immutable class HardwareShortcutsSpec(