Skip to content

MinimumScaleMode.Fit and coordinates #338

@krabo0om

Description

@krabo0om

Hey,
thanks to @tsuijten and @PeterLaurence PR #318 introduced the MinimumScaleMode.Fit mode adding whitespaces when totally zoomed out.
However, this broke the coordinates of tap events. A short example:
Lets say I have an image of 1000 width * 500 height and set MinimumScaleMode.FIT. Zoomed totally in at 1.0 and tapping the lower right I get x,y of 1000,500. Fine.
Zooming out it adds the whitespaces and centres the image, also fine. However, if I tap the lower right now I get x,y of something like 1000,2500 because the added whitespace.

This offset is calculated in ZoomPanLayout.onLayout() with translateX and translateY and should be used to offset the MotionEvent the onTouchEvent() gets.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions