Skip to content

Commit 7285e68

Browse files
committed
Change sidebar functionality
1. Force it to consume all pointerInput, meaning there cannot be interactino with any objects shadowed by it. 2. Hoist alignment into App.kt instead of forcing it to the right with a full Spacer
1 parent f946bcf commit 7285e68

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,11 @@ public fun App(
6060
modifier = Modifier.align(Alignment.TopCenter)
6161
)
6262

63-
RightInfoPanel(selectedNode)
63+
RightInfoPanel(
64+
selectedNode = selectedNode,
65+
modifier = Modifier
66+
.align(Alignment.TopEnd)
67+
)
6468

6569
// The states are reset when a new file is selected.
6670
UploadFile(

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

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
package com.squareup.workflow1.traceviewer.ui
22

33
import androidx.compose.foundation.background
4+
import androidx.compose.foundation.gestures.detectTapGestures
45
import androidx.compose.foundation.layout.Column
56
import androidx.compose.foundation.layout.Row
6-
import androidx.compose.foundation.layout.Spacer
77
import androidx.compose.foundation.layout.fillMaxHeight
88
import androidx.compose.foundation.layout.fillMaxWidth
99
import androidx.compose.foundation.layout.padding
@@ -22,6 +22,7 @@ import androidx.compose.runtime.setValue
2222
import androidx.compose.ui.Alignment
2323
import androidx.compose.ui.Modifier
2424
import androidx.compose.ui.graphics.Color
25+
import androidx.compose.ui.input.pointer.pointerInput
2526
import androidx.compose.ui.text.TextStyle
2627
import androidx.compose.ui.text.style.TextAlign
2728
import androidx.compose.ui.unit.dp
@@ -40,9 +41,9 @@ public fun RightInfoPanel(
4041
modifier: Modifier = Modifier
4142
) {
4243
// This row is aligned to the right of the screen.
43-
Row {
44-
Spacer(modifier = Modifier.weight(1f))
45-
44+
Row(
45+
modifier = modifier
46+
) {
4647
var panelOpen by remember { mutableStateOf(false) }
4748

4849
IconButton(
@@ -62,7 +63,7 @@ public fun RightInfoPanel(
6263
if (panelOpen) {
6364
NodePanelDetails(
6465
selectedNode,
65-
Modifier.fillMaxWidth(.35f)
66+
Modifier.fillMaxWidth(.30f)
6667
)
6768
}
6869
}
@@ -77,7 +78,10 @@ private fun NodePanelDetails(
7778
modifier = modifier
7879
.fillMaxHeight()
7980
.background(Color.LightGray)
80-
.padding(8.dp),
81+
.padding(8.dp)
82+
.pointerInput(Unit) {
83+
detectTapGestures { }
84+
},
8185
horizontalAlignment = Alignment.CenterHorizontally
8286
) {
8387
if (node == null) {

0 commit comments

Comments
 (0)