-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed Annotations HitTesting & Added annotation anchor v2 #38
Conversation
self.invalidateIntrinsicContentSize() | ||
|
||
if let anchor = mapAnnotation.anchor { | ||
centerOffset = .init(x: anchor.x * intrinsicContentFrame.width / 2, y: anchor.y * intrinsicContentFrame.height / 2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On iOS 16 you can just assign anchorPoint
rather than calculating the centerOffset
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know why, but anchorPoint
does not really work in this case... I guess it may happen because of some size issues.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed another issue with anchorPoint
- in the original implementation, the default anchorPoint is at (0.5, 0.5) whereas your implementation seems to use (0.0, 0.0) as default - could you please change that according to the original implementation to not cause confusion?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pauljohanneskraft
Thank you for your response!
I changed my implementation according to the original SwiftUI version. Now, default anchorPoint is at (0.5, 0.5). Also, I renamed the anchor
parameter to the anchorPoint
as in original version.
I have some findings I'd like to share on the front of keeping the frames the way they're supposed to be that might provide some insights for your ongoing investigation here @iakov-kaiumov . With my solution, anchorPoint works as expected. I'm going to try to create a branch to show what I'd propose. |
@iakov-kaiumov Here's what I had come up with on this front: https://github.com/pauljohanneskraft/Map/pull/40/files |
UPD: I reopen #35. I removed directions implementation and returned WatchOS 6.0 support.
This pull request implements several fixes and enchantments:
Clickable SwiftUI Annotations! Handle annotation selection #4
Added anchor parameter to the ViewMapAnnotation similar to the default SwiftUI Map approach.
Fixed annotations centering problem MapAnnotations not centered properly #14. Thanks to @rderimay (I took solution from Integrated proposed code to center MapAnnotations properly #25