Skip to content
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

Added logic that manages the scroll wheel click on the tabs #133

Merged
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
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