question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Option to have arrow point at (center of) anchor view

See original GitHub issue

Is your feature request related to a problem?

From what I can tell, by default the arrow of the balloon is rendered in the center of the balloon, and the balloon is center aligned with the anchor view when shown. This means that normally, the arrow points at the center of the anchor view. However, if there is not enough space to display the balloon this way (because the balloon reaches the edge of the screen), the balloon is automatically shifted, which also shifts the arrow, causing it to no longer point at the center of the anchor view. While it is possible to change where on the balloon the arrow is displayed by specifying a ratio other than the default 0.5, it is currently not possible to tell the balloon to render the arrow so that it always points at the anchor view. This results in the problem that, if the balloon is too big and the anchor view is small, the arrow does not point at the anchor view at all.

Describe the solution you’d like:

I would love to have an option to, instead of specifying a ratio of where the arrow should be, to specify that the arrow should point at the center of the anchor view (or optionally at a certain offset from the anchor view’s center).

Something like

enum class ArrowPositionMode {
    ALIGN_WITH_BALLOON, // this will place the arrow in the center of the balloon, or shifted if setArrowPosition is used
    ALIGN_WITH_ANCHOR // this will place the arrow in the center of the anchor view, or shifted if setArrowPosition is used
}

Balloon.Builder(context)
    .setArrowPositionMode(ArrowPositionMode.ALIGN_WITH_ANCHOR)

Describe alternatives you’ve considered:

I tried to dynamically compute the arrow ratio when showing the balloon based on where the anchor view is, but for that I’d first have to create the balloon to measure its width, calculate what the arrow position should be, then destroy the balloon again and create a new one with the calculated arrow position (because the arrow position cannot be changed once the balloon is created).

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:5
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
Waboodoocommented, Jun 14, 2020

Cool. I tried 1.1.8-alpha02 and it seems to fix my issue 👍. Thanks

1reaction
Waboodoocommented, Jun 16, 2020

Thanks. I will try it out in my app once I have the time 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

Edit connector lines, arrows, or points - Microsoft Support
Select a connector. On the Home tab, in the Shape group, select Line, and then select Arrows. Select More Arrows, in the Line...
Read more >
Rotating a view using another view's center as the anchor point
I have two image views. The first is the blueish arrow, and the second is the white circle, with a black dot drawn...
Read more >
Setting anchor/pivot point to layer features (point and text) by ...
Click the point symbol in your Table of Contents, choose the arrow symbol you'd like to use, then click Edit Symbol to bring...
Read more >
Edit paths in Adobe Photoshop
Anchor points mark the end points of the path segments. On curved segments, each selected anchor point displays one or two direction lines, ......
Read more >
Move a layer's anchor point in Motion - Apple Support
Layers rotate around the anchor point. The anchor point also affects resizing operations. For example, the default anchor point for any layer is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found