-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 } } ```
- Loading branch information
1 parent
2b12d57
commit a8e9486
Showing
3 changed files
with
34 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters