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

Adds experimental PointerIcon.fromKeyword function to change the browser cursor in Web source set #1704

Merged
merged 2 commits into from
Dec 4, 2024
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 @@ -16,10 +16,22 @@

package androidx.compose.ui.input.pointer

import androidx.compose.ui.ExperimentalComposeUiApi

object DummyPointerIcon : PointerIcon

internal data class BrowserCursor(val id: String): PointerIcon

/**
* Creates [PointerIcon] from provided cursor keyword.
* @param keyword one of the values representing the cursor appearance in a browser.
* @see <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/cursor">https://developer.mozilla.org/en-US/docs/Web/CSS/cursor</a>
*/
@ExperimentalComposeUiApi
fun PointerIcon.Companion.fromKeyword(keyword: String): PointerIcon {
return BrowserCursor(keyword)
}

internal actual val pointerIconDefault: PointerIcon = BrowserCursor("default")
internal actual val pointerIconCrosshair: PointerIcon = BrowserCursor("crosshair")
internal actual val pointerIconText: PointerIcon = BrowserCursor("text")
Expand Down