Skip to content

Scroll-Zoom breaks when trying to scroll before pressing once #2

Description

@Noshire

At PinchableScrollRect.97, the code accesses eventData.pressEventCamera. This can be null when no press happened yet (e.g. when you opened a ScrollRect through a keyboard shortcut and directly scroll). Zooming will work, but the reference point won't be set correctly, leading the zoom to jump around the screen erratically.

I fixed this for me by replacing it with eventData.enterEventCamera:

if (!RectTransformUtility.ScreenPointToLocalPointInRectangle(_content, eventData.position, eventData.enterEventCamera, out localPos)) return;

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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