skydoves / Balloon

:balloon: Modernized and sophisticated tooltips, fully customizable with an arrow and animations for Android.
https://skydoves.github.io/libraries/balloon/html/balloon/com.skydoves.balloon/index.html
Apache License 2.0
3.69k stars 289 forks source link

Compose: arrow position is wrong #514

Closed alexanderfilipzik closed 2 months ago

alexanderfilipzik commented 11 months ago

Please complete the following information:

Describe the Bug:

The arrow is not correctly pointing to the middle of anchor.

Expected Behavior:

The arrow is correctly pointing to the middle of anchor.

      val builder = rememberBalloonBuilder {
        setArrowPositionRules(ArrowPositionRules.ALIGN_ANCHOR)
        setArrowPosition(0.5f)
        setMarginHorizontal(12)
      }

      var balloonWindow1: BalloonWindow? by remember { mutableStateOf(null) }

      Column {
        Spacer(modifier = Modifier.height(300.dp))
        Box(
          modifier = Modifier
            .padding(horizontal = 12.dp) // changing this to a larger value like 36.dp will work for the arrow
        ) {
          Balloon(
            builder = builder,
            balloonContent = {
              Text(
                modifier = Modifier.fillMaxWidth(),
                text = "Now you can edit your profile1 profile2 profile3 profile4",
                color = Color.White,
              )
            },
          ) { balloonWindow ->
            LaunchedEffect(key1 = Unit) {
              balloonWindow1 = balloonWindow
            }

            Button(
              modifier = Modifier

                .padding(horizontal = 0.dp)
                .size(48.dp, 48.dp),
              onClick = { balloonWindow1?.showAlignTop(yOff = 20) },
            ) {
              Text(text = "|")
            }
          }
        }
      }

12.dp:

Bildschirmfoto 2023-10-19 um 09 54 24

36.dp:

Bildschirmfoto 2023-10-19 um 09 54 40
alexanderfilipzik commented 9 months ago

heyho @skydoves :) do you have any news on that - the impact is huge if you have more padding in the inside and have larger text and other content on the screen. Happens more often than you expect

skydoves commented 8 months ago

Hery @alexanderfilipzik, sorry for the delayed response. A new version 1.6.4 has been released, and I'm wondering if this issue still happens in that version.