You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is related to issue:
#4258
changes
- DesktopSplitPane.kt: placable.place() -> placable.placeRelative
- SplitePaneDSL.kt: change the delta direction to follow the layout
direction
```kotlin
@composable
override fun Modifier.markAsHandle(): Modifier = this.run {
val layoutDirection = LocalLayoutDirection.current
pointerInput(containerScope.splitPaneState) {
detectDragGestures { change, _ ->
change.consume()
containerScope.splitPaneState.dispatchRawMovement(
if (containerScope.isHorizontal)
if (layoutDirection == LayoutDirection.Ltr) change.position.x else -change.position.x
else change.position.y
)
}
}
```
the problem with .onPointerEvent() Modifier, or onDrag also, is
whenever the layout direction is Ltr or Rtl:
moving to right always produce positive change, [expected negative if
dir =Rtl]
moving to left always produce negative change, [expected positive if dir
=Rtl]
the calculation of postion will fail if layoutDir is Rtl, because
positionPercentage will be out of range
```kotlin
fun dispatchRawMovement(delta: Float) {
val movableArea = maxPosition - minPosition
if (movableArea > 0) {
positionPercentage =
((movableArea * positionPercentage) + delta).coerceIn(0f, movableArea) / movableArea
}
}
```
Describe the bug
I tried compose splitpane with
CompositionLocalProvider(
LocalLayoutDirection provides LayoutDirection.Rtl
)
but nothing happened
Affected platforms
Select one of the platforms below:
*didn't checked others
Versions
To Reproduce
followin snippet is from demo
compose-multiplatform/components/SplitPane/demo/src/jvmMain/kotlin/org/jetbrains/compose/splitpane/demo/Main.kt
Line 27 in d6b8681
wrppaed by CompositionLocalProvider
Expected behavior
all content of HorizontalSplitPane to be alligned to right
SplitPaneScope.first is to right of second
Screenshots
Expected:
Actual:
Additional context
workaround:
The text was updated successfully, but these errors were encountered: