Skip to content

Aspect ratio menu popover is horizontally offset on iPhone in 3.1.1 glass toolbar layout #644

@larryisthere

Description

@larryisthere

Hi, thanks for the recent iOS 26 toolbar work.

I am seeing a remaining positioning issue with the aspect ratio menu on iPhone after upgrading to TOCropViewController 3.1.1 (via image_cropper 12.1.1).

What I see

  • On a narrow iPhone device (reproduced on iPhone SE), tapping the aspect ratio button opens the menu at roughly the correct vertical position.
  • The popover is shifted to the left horizontally instead of being centered on the aspect ratio button.
  • This is most obvious on narrow devices because the shift is visually large.

Repro steps

  1. Present TOCropViewController with the standard bottom toolbar.
  2. Keep the aspect ratio picker button visible.
  3. On iPhone, tap the aspect ratio button.
  4. Observe that the menu arrow/anchor is horizontally offset to the left.

Suspected root cause
From reading 3.1.1 source, this looks like a coordinate-space mismatch in the new glass toolbar path:

  • In TOCropToolbar setup, the middle toolbar buttons are added to a containerView that becomes _glassView.contentView on the iOS 26 path.
  • clampButton is added to that container view.
  • clampButtonFrame returns self.clampButton.frame.
  • showAspectRatioDialog uses:
    • presentationController.sourceView = self.toolbar
    • presentationController.sourceRect = self.toolbar.clampButtonFrame

That means sourceRect is in the clamp button superview's coordinate space, but sourceView is the toolbar. If the glass container is centered inside the toolbar, the rect will be shifted left by the container's origin.x.

Relevant code paths

  • TOCropToolbar.m: containerView = _glassView.contentView, then [_clampButton addSubview:containerView]
  • TOCropToolbar.m: clampButtonFrame returns self.clampButton.frame
  • TOCropViewController.m: showAspectRatioDialog sets sourceView = self.toolbar and sourceRect = self.toolbar.clampButtonFrame

Possible fix
One option would be to convert the rect before returning/using it, for example:

  • return [self convertRect:self.clampButton.frame fromView:self.clampButton.superview];

Or equivalently, anchor the popover to a sourceView/sourceRect pair that uses the same coordinate space.

If helpful, I can also provide a screenshot from the app using TOCropViewController through image_cropper.

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