Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hover icon on linked text #288

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import androidx.compose.foundation.gestures.waitForUpOrCancellation
import androidx.compose.foundation.text.InlineTextContent
import androidx.compose.runtime.*
import androidx.compose.ui.Modifier
import androidx.compose.ui.input.pointer.PointerIcon
import androidx.compose.ui.input.pointer.pointerHoverIcon
import androidx.compose.ui.input.pointer.pointerInput
import androidx.compose.ui.layout.onPlaced
import androidx.compose.ui.platform.LocalUriHandler
Expand Down Expand Up @@ -102,7 +104,7 @@ fun MarkdownText(
val imageState = rememberMarkdownImageState()

val hasUrl = content.getStringAnnotations(MARKDOWN_TAG_URL, 0, content.length).any()
val textModifier = if (hasUrl) modifier.pointerInput(Unit) {
val textModifier = if (hasUrl) modifier.pointerHoverIcon(PointerIcon.Hand, true).pointerInput(Unit) {
awaitEachGesture {
val pointer = awaitFirstDown()
val pos = pointer.position // current position
Expand Down