Adjust chip placement

hh
Laurent 5 years ago
parent 0961a74c15
commit eb9f435b8b
  1. 14
      app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/replayer/ReplayerConfiguration.kt
  2. 2
      app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/replayer/TableDrawer.kt

@ -119,6 +119,7 @@ class ReplayerConfiguration(var handHistory: HandHistory) {
var rectCenterY: Float var rectCenterY: Float
var chipXOffset: Float var chipXOffset: Float
var chipYOffset: Float var chipYOffset: Float
var chipTextYOffsetCoef = 0f
var circleOffset = playerItemsHeight * 1.75f var circleOffset = playerItemsHeight * 1.75f
for (i in 1..count) { for (i in 1..count) {
@ -140,13 +141,15 @@ class ReplayerConfiguration(var handHistory: HandHistory) {
rectCenterY = height - this.tableVPadding rectCenterY = height - this.tableVPadding
circleOffset *= -1 circleOffset *= -1
chipXOffset = cornerDirection * chipsHorizontalOffsetFromStackCenter chipXOffset = cornerDirection * chipsHorizontalOffsetFromStackCenter
chipYOffset = -1.25f * chipsVerticalOffsetFromStackCenter chipYOffset = -1 * chipsVerticalOffsetFromStackCenter
chipTextYOffsetCoef = 1f
} }
1 -> { // left 1 -> { // left
rectCenterX = this.tableHPadding rectCenterX = this.tableHPadding
rectCenterY = height - y * i rectCenterY = height - y * i
chipXOffset = 1 * chipsHorizontalOffsetFromStackCenter chipXOffset = 1 * chipsHorizontalOffsetFromStackCenter
chipYOffset = cornerDirection * -1 * chipsVerticalOffsetFromStackCenter chipYOffset = cornerDirection * -1 * chipsVerticalOffsetFromStackCenter
chipTextYOffsetCoef = 1f * (i - 1) / count
} }
2 -> { // top 2 -> { // top
rectCenterX = x * i rectCenterX = x * i
@ -159,6 +162,7 @@ class ReplayerConfiguration(var handHistory: HandHistory) {
rectCenterY = y * i rectCenterY = y * i
chipXOffset = -1 * chipsHorizontalOffsetFromStackCenter chipXOffset = -1 * chipsHorizontalOffsetFromStackCenter
chipYOffset = cornerDirection * chipsVerticalOffsetFromStackCenter chipYOffset = cornerDirection * chipsVerticalOffsetFromStackCenter
chipTextYOffsetCoef = 1f * (count - i - 1) / count
} }
else -> throw PAIllegalStateException("can't happen") else -> throw PAIllegalStateException("can't happen")
} }
@ -170,9 +174,13 @@ class ReplayerConfiguration(var handHistory: HandHistory) {
this.playerStackRects.add(RectF(left, top, right, bottom)) this.playerStackRects.add(RectF(left, top, right, bottom))
val chipRadius = this.playerItemsHeight / 4 val chipRadius = this.playerItemsHeight / 4
this.chipCircles.add(Circle(rectCenterX + chipXOffset, rectCenterY + chipYOffset, chipRadius))
val chipCircleY = rectCenterY + chipYOffset - chipTextYOffsetCoef * chipRadius
this.chipCircles.add(Circle(rectCenterX + chipXOffset, chipCircleY, chipRadius))
val chipTextSize = chipRadius val chipTextSize = chipRadius
this.chipTextPoints.add(TextPoint(rectCenterX + chipXOffset, rectCenterY + chipYOffset + 2 * chipTextSize, chipTextSize))
this.chipTextPoints.add(TextPoint(rectCenterX + chipXOffset, chipCircleY + 2 * chipTextSize, chipTextSize))
// we give each text zone 1/3rd of the box height, leaving 1/3 for space // we give each text zone 1/3rd of the box height, leaving 1/3 for space
// the y given is the bottom of the text rect, giving 1/18th as the offset // the y given is the bottom of the text rect, giving 1/18th as the offset

@ -23,7 +23,7 @@ class TableDrawer(bitmap: Bitmap) : Canvas(bitmap) {
private const val tableStrokeWidth = 30f private const val tableStrokeWidth = 30f
private const val playerStrokeWidth = 8f private const val playerStrokeWidth = 8f
private const val cardStrokeWidth = 6f private const val cardStrokeWidth = 8f
private val strokePaint = Paint() private val strokePaint = Paint()
private val fillPaint = Paint() private val fillPaint = Paint()

Loading…
Cancel
Save