Baseflow / Baseflow/PhotoView

displayRect is not adjusted for padding. Tap event gives wrong coordinates when padding is set.

Open
#605 0 comments 2 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
18.8k
Forks
3.9k
PR merge metrics
No merged PRs in 30d

Description

When adding padding to the view, I noticed the tap coordinates are wrong. When diving into the source code I noticed that it is because the `displayRect` is not adjusted for padding.

This can easily be tested by overriding `onDraw` and painting the `displayRect` directly on the canvas. The image with padding and the rect painted are the same size and scale at all times one is translated with the padding.

To fix the tap issue, I forked the library and translated the displayRect in the `onSingleTapConfirmed` callback before calculating the coordinates. I could do a pull request but I only hot-fixed the tap and I'm pretty sure that padding has other implications that would need to be fixed.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.