forked from androidx/androidx
-
Notifications
You must be signed in to change notification settings - Fork 81
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
Fix LayoutCoordinates.localToWindow
coordinates conversion for non-full Compose components
#956
Merged
Conversation
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
igordmn
reviewed
Dec 19, 2023
compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/awt/ComposeBridge.desktop.kt
Outdated
Show resolved
Hide resolved
igordmn
approved these changes
Dec 19, 2023
dima-avdeev-jb
approved these changes
Dec 19, 2023
MatkovIvan
added a commit
that referenced
this pull request
Dec 19, 2023
MatkovIvan
added a commit
that referenced
this pull request
Jan 11, 2024
## Proposed Changes - Use root coordinates for interop instead of window ones - it's different after #956 ## Testing Test: run app from the issue or open "UIKitViewMatryoshka" in mpp Before | After ---|--- ![Simulator Screenshot - iPhone 15 Pro - 2024-01-11 at 13 00 20](https://github.com/JetBrains/compose-multiplatform-core/assets/1836384/0035c206-1f1c-40d6-a59a-f6f3c9d01617) | ![Simulator Screenshot - iPhone 15 Pro - 2024-01-11 at 13 06 04](https://github.com/JetBrains/compose-multiplatform-core/assets/1836384/cf679f2a-0c35-41c2-ac1a-66c18feced8c) ## Issues Fixed Fixes JetBrains/compose-multiplatform#4095
MatkovIvan
added a commit
that referenced
this pull request
Jan 13, 2024
## Proposed Changes - Use window coordinates to check if it's in bounds - it's different after #956 ## Testing Test: run added unit test or the next sample: ```kt fun main() = SwingUtilities.invokeLater { SwingComposeWindow() } fun SwingComposeWindow() { val window = JFrame() window.defaultCloseOperation = WindowConstants.EXIT_ON_CLOSE val panel = JPanel() panel.layout = GridLayout(2, 1) panel.add(JPanel()) panel.add(ComposePanel().apply { setContent { ComposeContent(background = Color.Green) } }) window.contentPane.add(panel, BorderLayout.CENTER) window.setSize(800, 600) window.isVisible = true } @OptIn(ExperimentalFoundationApi::class) @composable fun ComposeContent(background: Color) { Box( modifier = Modifier.fillMaxSize().background(color = background), contentAlignment = Alignment.Center ) { TooltipArea({ BasicText("Tooltip", Modifier.background(Color.Magenta).padding(8.dp)) }) { BasicText("Hover here", Modifier.background(Color.Gray).padding(8.dp)) } } } ``` ## Issues Fixed Fixes JetBrains/compose-multiplatform#4123
igordmn
changed the title
Fix
Fix Jan 24, 2024
localToWindow
coordinates conversionLayoutCoordinates.localToWindow
coordinates conversion for non-full Compose componets
igordmn
changed the title
Fix
Fix Jan 24, 2024
LayoutCoordinates.localToWindow
coordinates conversion for non-full Compose componetsLayoutCoordinates.localToWindow
coordinates conversion for non-full Compose components
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Proposed Changes
size
toboundsInWindow
inComposeScene
calculatePositionInWindow
inOwner