Skip to content

Commit

Permalink
Simplify selected when expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickmichalik committed Jul 30, 2023
1 parent 9500f06 commit 722c9f3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -217,16 +217,9 @@ public class HorizontalAxis<Position : AxisPosition.Horizontal>(
): Float =
when {
itemPlacer.getShiftExtremeTicks(this).not() -> 0f
else -> {
val isFirstLine = entryX == fullXRange.start
val isLastLine = entryX == fullXRange.endInclusive

when {
isFirstLine -> -tickThickness.half
isLastLine -> tickThickness.half
else -> 0f
}
}
entryX == fullXRange.start -> -tickThickness.half
entryX == fullXRange.endInclusive -> tickThickness.half
else -> 0f
}

override fun drawAboveChart(context: ChartDrawContext): Unit = Unit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,8 @@ public class VerticalAxis<Position : AxisPosition.Vertical>(
return when {
onLeft && horizontalLabelPosition == Outside -> base - axisThickness - tickLength
onLeft && horizontalLabelPosition == Inside -> base - axisThickness
onLeft.not() && horizontalLabelPosition == Outside -> base
onLeft.not() && horizontalLabelPosition == Inside -> base - tickLength
horizontalLabelPosition == Outside -> base
horizontalLabelPosition == Inside -> base - tickLength
else -> error("Unexpected combination of axis position and label position")
}
}
Expand Down

0 comments on commit 722c9f3

Please sign in to comment.