Skip to content

Commit

Permalink
Added logic that manages the scroll wheel click on the tabs (#133)
Browse files Browse the repository at this point in the history
  • Loading branch information
edivad1999 authored Sep 26, 2023
1 parent d802a00 commit 89cc258
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion core/src/main/kotlin/org/jetbrains/jewel/Tabs.kt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.graphics.SolidColor
import androidx.compose.ui.graphics.StrokeCap
import androidx.compose.ui.graphics.drawscope.ContentDrawScope
import androidx.compose.ui.input.pointer.PointerEventType
import androidx.compose.ui.input.pointer.isTertiary
import androidx.compose.ui.input.pointer.onPointerEvent
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.semantics.Role
import androidx.compose.ui.unit.dp
Expand Down Expand Up @@ -108,7 +111,10 @@ internal fun TabImpl(
cap = StrokeCap.Round,
)
}
.padding(tabStyle.metrics.tabPadding),
.padding(tabStyle.metrics.tabPadding)
.onPointerEvent(PointerEventType.Release) {
if (it.button.isTertiary) tabData.onClose()
},
horizontalArrangement = Arrangement.spacedBy(tabStyle.metrics.closeContentGap),
verticalAlignment = Alignment.CenterVertically,
) {
Expand Down

0 comments on commit 89cc258

Please sign in to comment.