Skip to content

Fix Popup appearance for pointer input #1906

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

Merged
merged 1 commit into from
Mar 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ internal class UIKitComposeSceneLayer(
internal fun dispose() {
mediator.dispose()
view.removeFromSuperview()
view.dispose()
}

@Composable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import platform.CoreGraphics.CGPoint
import platform.CoreGraphics.CGPointMake
import platform.CoreGraphics.CGRectZero
import platform.UIKit.UIEvent
import platform.UIKit.UIEventTypeTouches
import platform.UIKit.UITouch
import platform.UIKit.UIView
import platform.UIKit.UIWindow
Expand All @@ -39,8 +40,8 @@ import platform.UIKit.UIWindow
*/
internal class UIKitComposeSceneLayerView(
private var onDidMoveToWindow: (UIWindow?) -> Unit,
val isInsideInteractionBounds: (point: CValue<CGPoint>) -> Boolean,
val isInterceptingOutsideEvents: () -> Boolean
private var isInsideInteractionBounds: (point: CValue<CGPoint>) -> Boolean,
private var isInterceptingOutsideEvents: () -> Boolean
): UIView(frame = CGRectZero.readValue()) {
private var touchesCount: Int = 0
private var previousSuccessHitTestTimestamp: Double? = null
Expand Down Expand Up @@ -105,7 +106,9 @@ internal class UIKitComposeSceneLayerView(
val result = super.hitTest(point, withEvent)

if (isOutsideBounds && result == this) {
touchStartedOutside(withEvent)
if (withEvent?.type == UIEventTypeTouches) {
touchStartedOutside(withEvent)
}

return if (isInterceptingOutsideEvents()) {
this
Expand All @@ -117,6 +120,13 @@ internal class UIKitComposeSceneLayerView(
return result
}

fun dispose() {
onDidMoveToWindow = {}
isInsideInteractionBounds = { false }
isInterceptingOutsideEvents = { false }
onOutsidePointerEvent = {}
}

override fun didMoveToWindow() {
super.didMoveToWindow()
onDidMoveToWindow(window)
Expand Down