TP-57318 | configurable peak aspect ratio for tooltip (#525)

This commit is contained in:
Prakhar Saxena
2024-08-01 16:09:35 +05:30
committed by GitHub
parent 5fc519b9c9
commit dff52bd75d

View File

@@ -42,7 +42,8 @@ class ToolTipShape(
private val peakRadiusDp: Dp = 0.dp,
private val bottomPeakRadiusDp: Dp = 0.dp,
private val offsetPercentage: Float = 0.0f,
private val offset: Dp? = null
private val offset: Dp? = null,
private val peakAspectRatio: Float = RATIO
) : Cloneable, Shape {
companion object {
@@ -80,7 +81,7 @@ class ToolTipShape(
peakHeight = with(density) { peakHeightDp.toPx() }
defaultCornerRadius = with(density) { defaultCornerRadiusDp.toPx() }
if (defaultCornerRadius > maxCornerRadius) defaultCornerRadius = maxCornerRadius
peakWidth = peakHeight * RATIO
peakWidth = peakHeight * peakAspectRatio
peakRadius = with(density) { peakRadiusDp.toPx() }
bottomPeakRadius = with(density) { bottomPeakRadiusDp.toPx() }
offsetPx = with(density) { offset?.toPx() }