Hardware Shortcuts Spec
class HardwareShortcutsSpec(val enabled: Boolean = true, val shortcutDetector: HardwareShortcutDetector = HardwareShortcutDetector.Default)
Describes how keyboard and mouse shortcuts are handled. When enabled, Modifier.zoomable's content will participate in the focus system to receive hardware events.
Keep in mind that hardware shortcuts will only work when your zoomable content is focused. To do this automatically, use a FocusRequester:
val focusRequester = remember { FocusRequester() }
LaunchedEffect(Unit) {
// Automatically request focus when the image is displayed. This assumes there
// is only one zoomable image present in the hierarchy. If you're displaying
// multiple images in a pager, apply this only for the active page.
focusRequester.requestFocus()
}
ZoomableImage(
modifier = Modifier.focusRequester(focusRequester),
)Content copied to clipboard
Constructors
Link copied to clipboard
constructor(enabled: Boolean = true, shortcutDetector: HardwareShortcutDetector = HardwareShortcutDetector.Default)