Skip to content

Commit

Permalink
minPosition and maxPosition are randomly chosen so they don't always …
Browse files Browse the repository at this point in the history
…give correct results. Here we tried to solve on edge case as noted in issue: skydoves#413
  • Loading branch information
nkhar committed Dec 20, 2023
1 parent 719e76c commit 1440c8c
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions balloon/src/main/kotlin/com/skydoves/balloon/Balloon.kt
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,17 @@ public class Balloon private constructor(
else -> {
val position =
(anchor.width) * builder.arrowPosition + anchorX - balloonX - builder.arrowHalfSize

val tipArrowPosition = anchorX + (anchor.width) * builder.arrowPosition
if ((tipArrowPosition - builder.arrowHalfSize) <= balloonX) {
return 0.0f // + builder.cornerRadius
}
if ((tipArrowPosition - builder.arrowHalfSize) > balloonX) {
if (anchor.width <= getMeasuredWidth() - builder.marginRight - builder.marginLeft) {
return tipArrowPosition - builder.arrowHalfSize - balloonX
}
}

when {
position <= getDoubleArrowSize() -> minPosition
position > getMeasuredWidth() - getDoubleArrowSize() -> maxPosition
Expand Down

0 comments on commit 1440c8c

Please sign in to comment.