Skip to content

Commit

Permalink
When crossing window boundries on visionOS drops animate from the wro…
Browse files Browse the repository at this point in the history
…ng origin.

https://bugs.webkit.org/show_bug.cgi?id=260728
rdar://113862387

Reviewed by Aditya Keerthi and Wenson Hsieh

To cross window boundaries, we need to convert to coordinate spaces instead of
just to the view.

* Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView dropInteraction:previewForDroppingItem:withDefault:]):

Canonical link: https://commits.webkit.org/267308@main
  • Loading branch information
megangardner committed Aug 26, 2023
1 parent 6baa279 commit 2b3d23d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
Original file line number Diff line number Diff line change
Expand Up @@ -10094,7 +10094,7 @@ - (UITargetedDragPreview *)dropInteraction:(UIDropInteraction *)interaction prev
return nil;

UIView *textEffectsWindow = self.textEffectsWindow;
auto caretRectInWindowCoordinates = [self convertRect:caretRect toView:textEffectsWindow];
auto caretRectInWindowCoordinates = [self convertRect:caretRect toCoordinateSpace:textEffectsWindow];
auto caretCenterInWindowCoordinates = CGPointMake(CGRectGetMidX(caretRectInWindowCoordinates), CGRectGetMidY(caretRectInWindowCoordinates));
auto targetPreviewCenterInWindowCoordinates = CGPointMake(caretCenterInWindowCoordinates.x + defaultPreview.size.width / 2, caretCenterInWindowCoordinates.y + defaultPreview.size.height / 2);
auto target = adoptNS([[UIDragPreviewTarget alloc] initWithContainer:textEffectsWindow center:targetPreviewCenterInWindowCoordinates transform:CGAffineTransformIdentity]);
Expand Down

0 comments on commit 2b3d23d

Please sign in to comment.