|
|
@ -1,16 +1,15 @@ |
|
|
|
package org.jetbrains.compose.demo.widgets.platform |
|
|
|
package org.jetbrains.compose.demo.widgets.platform |
|
|
|
|
|
|
|
|
|
|
|
import androidx.compose.desktop.LocalAppWindow |
|
|
|
import androidx.compose.runtime.* |
|
|
|
import androidx.compose.runtime.getValue |
|
|
|
|
|
|
|
import androidx.compose.runtime.mutableStateOf |
|
|
|
|
|
|
|
import androidx.compose.runtime.remember |
|
|
|
|
|
|
|
import androidx.compose.runtime.setValue |
|
|
|
|
|
|
|
import androidx.compose.ui.Modifier |
|
|
|
import androidx.compose.ui.Modifier |
|
|
|
import androidx.compose.ui.composed |
|
|
|
import androidx.compose.ui.composed |
|
|
|
import androidx.compose.ui.geometry.Offset |
|
|
|
import androidx.compose.ui.geometry.Offset |
|
|
|
import androidx.compose.ui.input.pointer.pointerMoveFilter |
|
|
|
import androidx.compose.ui.input.pointer.pointerMoveFilter |
|
|
|
|
|
|
|
import androidx.compose.ui.window.FrameWindowScope |
|
|
|
import java.awt.Cursor |
|
|
|
import java.awt.Cursor |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
val AppFrame = staticCompositionLocalOf<FrameWindowScope> { error("Undefined repository") } |
|
|
|
|
|
|
|
|
|
|
|
actual fun Modifier.pointerMoveFilter( |
|
|
|
actual fun Modifier.pointerMoveFilter( |
|
|
|
onEnter: () -> Boolean, |
|
|
|
onEnter: () -> Boolean, |
|
|
|
onExit: () -> Boolean, |
|
|
|
onExit: () -> Boolean, |
|
|
@ -20,10 +19,11 @@ actual fun Modifier.pointerMoveFilter( |
|
|
|
actual fun Modifier.cursorForHorizontalResize(): Modifier = composed { |
|
|
|
actual fun Modifier.cursorForHorizontalResize(): Modifier = composed { |
|
|
|
var isHover by remember { mutableStateOf(false) } |
|
|
|
var isHover by remember { mutableStateOf(false) } |
|
|
|
|
|
|
|
|
|
|
|
if (isHover) { |
|
|
|
val window = AppFrame.current.window |
|
|
|
LocalAppWindow.current.window.cursor = Cursor(Cursor.E_RESIZE_CURSOR) |
|
|
|
window.cursor = if (isHover) { |
|
|
|
|
|
|
|
Cursor(Cursor.E_RESIZE_CURSOR) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
LocalAppWindow.current.window.cursor = Cursor.getDefaultCursor() |
|
|
|
Cursor.getDefaultCursor() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
pointerMoveFilter( |
|
|
|
pointerMoveFilter( |
|
|
|