-
-
Save oas004/1a009a45ecf4bed0b04cd777148466f1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
internal fun splitSegments( | |
indicatorColor: Color, | |
trackColor: Color, | |
range: ClosedFloatingPointRange<Float> | |
): List<CalculatedSegment> { | |
return buildList { | |
range.intersect(topRightRange)?.let { | |
if (!it.isZeroWidth()) { | |
add(CalculatedSegment(indicatorColor, trackColor, topRight, it)) | |
} | |
} | |
range.intersect(rightTopCornerRange)?.let { | |
if (!it.isZeroWidth()) { | |
add(CalculatedSegment(indicatorColor, trackColor, rightTopCorner, it)) | |
} | |
} | |
range.intersect(rightRange)?.let { | |
if (!it.isZeroWidth()) { | |
add(CalculatedSegment(indicatorColor, trackColor, right, it)) | |
} | |
} | |
range.intersect(rightBottomCornerRange)?.let { | |
if (!it.isZeroWidth()) { | |
add(CalculatedSegment(indicatorColor, trackColor, rightBottomCorner, it)) | |
} | |
} | |
range.intersect(bottomRange)?.let { | |
if (!it.isZeroWidth()) { | |
add(CalculatedSegment(indicatorColor, trackColor, bottom, it)) | |
} | |
} | |
range.intersect(leftBottomCornerRange)?.let { | |
if (!it.isZeroWidth()) { | |
add(CalculatedSegment(indicatorColor, trackColor, leftBottomCorner, it)) | |
} | |
} | |
range.intersect(leftRange)?.let { | |
if (!it.isZeroWidth()) { | |
add(CalculatedSegment(indicatorColor, trackColor, left, it)) | |
} | |
} | |
range.intersect(leftTopCornerRange)?.let { | |
if (!it.isZeroWidth()) { | |
add(CalculatedSegment(indicatorColor, trackColor, leftTopCorner, it)) | |
} | |
} | |
range.intersect(topLeftRange)?.let { | |
if (!it.isZeroWidth()) { | |
add(CalculatedSegment(indicatorColor, trackColor, topLeft, it)) | |
} | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment