diff --git a/components/SplitPane/demo/src/jvmMain/kotlin/org/jetbrains/compose/splitpane/demo/Main.kt b/components/SplitPane/demo/src/jvmMain/kotlin/org/jetbrains/compose/splitpane/demo/Main.kt index 4054da5b87..62e61a641b 100644 --- a/components/SplitPane/demo/src/jvmMain/kotlin/org/jetbrains/compose/splitpane/demo/Main.kt +++ b/components/SplitPane/demo/src/jvmMain/kotlin/org/jetbrains/compose/splitpane/demo/Main.kt @@ -12,7 +12,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.SolidColor import androidx.compose.ui.input.pointer.PointerIcon -import androidx.compose.ui.input.pointer.pointerIcon +import androidx.compose.ui.input.pointer.pointerHoverIcon import androidx.compose.ui.unit.dp import androidx.compose.ui.window.singleWindowApplication import org.jetbrains.compose.splitpane.ExperimentalSplitPaneApi @@ -23,53 +23,51 @@ import java.awt.Cursor @OptIn(ExperimentalComposeUiApi::class) private fun Modifier.cursorForHorizontalResize(): Modifier = - pointerIcon(PointerIcon(Cursor(Cursor.E_RESIZE_CURSOR))) + pointerHoverIcon(PointerIcon(Cursor(Cursor.E_RESIZE_CURSOR))) @OptIn(ExperimentalSplitPaneApi::class) fun main() = singleWindowApplication( title = "SplitPane demo" ) { MaterialTheme { - DesktopTheme { - val splitterState = rememberSplitPaneState() - val hSplitterState = rememberSplitPaneState() - HorizontalSplitPane( - splitPaneState = splitterState - ) { - first(20.dp) { - Box(Modifier.background(Color.Red).fillMaxSize()) - } - second(50.dp) { - VerticalSplitPane(splitPaneState = hSplitterState) { - first(50.dp) { - Box(Modifier.background(Color.Blue).fillMaxSize()) - } - second(20.dp) { - Box(Modifier.background(Color.Green).fillMaxSize()) - } - } - } - splitter { - visiblePart { - Box( - Modifier - .width(1.dp) - .fillMaxHeight() - .background(MaterialTheme.colors.background) - ) + val splitterState = rememberSplitPaneState() + val hSplitterState = rememberSplitPaneState() + HorizontalSplitPane( + splitPaneState = splitterState + ) { + first(20.dp) { + Box(Modifier.background(Color.Red).fillMaxSize()) + } + second(50.dp) { + VerticalSplitPane(splitPaneState = hSplitterState) { + first(50.dp) { + Box(Modifier.background(Color.Blue).fillMaxSize()) } - handle { - Box( - Modifier - .markAsHandle() - .cursorForHorizontalResize() - .background(SolidColor(Color.Gray), alpha = 0.50f) - .width(9.dp) - .fillMaxHeight() - ) + second(20.dp) { + Box(Modifier.background(Color.Green).fillMaxSize()) } } } + splitter { + visiblePart { + Box( + Modifier + .width(1.dp) + .fillMaxHeight() + .background(MaterialTheme.colors.background) + ) + } + handle { + Box( + Modifier + .markAsHandle() + .cursorForHorizontalResize() + .background(SolidColor(Color.Gray), alpha = 0.50f) + .width(9.dp) + .fillMaxHeight() + ) + } + } } } } \ No newline at end of file diff --git a/components/SplitPane/library/src/desktopMain/kotlin/org/jetbrains/compose/splitpane/DesktopSplitter.kt b/components/SplitPane/library/src/desktopMain/kotlin/org/jetbrains/compose/splitpane/DesktopSplitter.kt index ff4927c1a0..c0ae71f661 100644 --- a/components/SplitPane/library/src/desktopMain/kotlin/org/jetbrains/compose/splitpane/DesktopSplitter.kt +++ b/components/SplitPane/library/src/desktopMain/kotlin/org/jetbrains/compose/splitpane/DesktopSplitter.kt @@ -8,16 +8,13 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color -import androidx.compose.ui.input.pointer.PointerIcon -import androidx.compose.ui.input.pointer.consumeAllChanges -import androidx.compose.ui.input.pointer.pointerIcon -import androidx.compose.ui.input.pointer.pointerInput +import androidx.compose.ui.input.pointer.* import androidx.compose.ui.unit.dp import java.awt.Cursor @OptIn(ExperimentalComposeUiApi::class) private fun Modifier.cursorForHorizontalResize(isHorizontal: Boolean): Modifier = - pointerIcon(PointerIcon(Cursor(if (isHorizontal) Cursor.E_RESIZE_CURSOR else Cursor.S_RESIZE_CURSOR))) + pointerHoverIcon(PointerIcon(Cursor(if (isHorizontal) Cursor.E_RESIZE_CURSOR else Cursor.S_RESIZE_CURSOR))) @Composable private fun DesktopSplitPaneSeparator( diff --git a/components/gradle.properties b/components/gradle.properties index 2bebda45ca..74d745f324 100644 --- a/components/gradle.properties +++ b/components/gradle.properties @@ -4,4 +4,4 @@ android.enableJetifier=true kotlin.code.style=official # __LATEST_COMPOSE_RELEASE_VERSION__ -compose.version=1.0.0-alpha4-build362 +compose.version=0.0.0-sync-2010-10-01-build393 diff --git a/tutorials/Mouse_Events/README.md b/tutorials/Mouse_Events/README.md index a23f18548e..c5f1d26c1d 100644 --- a/tutorials/Mouse_Events/README.md +++ b/tutorials/Mouse_Events/README.md @@ -78,11 +78,13 @@ import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment +import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.input.pointer.pointerMoveFilter import androidx.compose.ui.window.singleWindowApplication +@OptIn(ExperimentalComposeUiApi::class) fun main() = singleWindowApplication { var color by remember { mutableStateOf(Color(0, 0, 0)) } Box( @@ -115,6 +117,7 @@ import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue +import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.input.pointer.pointerMoveFilter @@ -123,6 +126,7 @@ import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import androidx.compose.ui.window.singleWindowApplication +@OptIn(ExperimentalComposeUiApi::class) fun main() = singleWindowApplication { Column( Modifier.background(Color.White), diff --git a/tutorials/Window_API_new/README.md b/tutorials/Window_API_new/README.md index e04116a3fd..0ee87259ca 100644 --- a/tutorials/Window_API_new/README.md +++ b/tutorials/Window_API_new/README.md @@ -160,7 +160,7 @@ fun main() = application { if (!isVisible) { Tray( TrayIcon, - hint = "Counter", + tooltip = "Counter", onAction = { isVisible = true }, menu = { Item("Exit", onClick = ::exitApplication) @@ -386,9 +386,9 @@ Reading the state in composition is useful when you need to update UI, but there ```kotlin import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.snapshotFlow +import androidx.compose.ui.unit.DpSize import androidx.compose.ui.window.Window import androidx.compose.ui.window.WindowPosition -import androidx.compose.ui.window.WindowSize import androidx.compose.ui.window.application import androidx.compose.ui.window.rememberWindowState import kotlinx.coroutines.flow.filterNot @@ -414,7 +414,7 @@ fun main() = application { } } -private fun onWindowResize(size: WindowSize) { +private fun onWindowResize(size: DpSize) { println("onWindowResize $size") }