Skip to content

Commit e964c42

Browse files
committed
fix bug that limited the area for .pointerInput
1 parent 46f2f20 commit e964c42

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

workflow-trace-viewer/src/jvmMain/kotlin/com/squareup/workflow1/traceviewer/SandboxBackground.kt

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package com.squareup.workflow1.traceviewer
22

33
import androidx.compose.foundation.gestures.awaitEachGesture
44
import androidx.compose.foundation.layout.Box
5+
import androidx.compose.foundation.layout.fillMaxSize
56
import androidx.compose.foundation.layout.wrapContentSize
67
import androidx.compose.runtime.Composable
78
import androidx.compose.runtime.getValue
@@ -29,12 +30,9 @@ public fun SandboxBackground(
2930
var scale by remember { mutableStateOf(1f) }
3031
var offset by remember { mutableStateOf(Offset.Zero) }
3132

32-
Box(
33+
Box (
3334
modifier = Modifier
34-
.wrapContentSize(
35-
unbounded = true,
36-
align = Alignment.TopStart
37-
) // this allows the content to be larger than the initial screen of the app
35+
.fillMaxSize()
3836
.pointerInput(Unit) { // this allows for user's panning to view different parts of content
3937
awaitEachGesture {
4038
val event = awaitPointerEvent()
@@ -64,13 +62,18 @@ public fun SandboxBackground(
6462
}
6563
}
6664
}
67-
.graphicsLayer {
68-
translationX = offset.x
69-
translationY = offset.y
70-
scaleX = scale
71-
scaleY = scale
72-
}
73-
) {
74-
content()
65+
){
66+
Box(
67+
modifier = Modifier
68+
.wrapContentSize(unbounded = true, align = Alignment.Center)
69+
.graphicsLayer {
70+
translationX = offset.x
71+
translationY = offset.y
72+
scaleX = scale
73+
scaleY = scale
74+
}
75+
) {
76+
content()
77+
}
7578
}
7679
}

0 commit comments

Comments
 (0)