-
Notifications
You must be signed in to change notification settings - Fork 1.3k
#2151 MGLAnnotation centerOffset and calloutOffset properties #3220
Conversation
ios/app/MBXViewController.mm
Outdated
[self.mapView removeAnnotations:self.mapView.annotations]; | ||
NSInteger settingChoice = buttonIndex - 1; // cancel is index 0 | ||
switch (settingChoice) { | ||
case settingIndexResetNorth: |
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.
Thanks, the switch statement is a good idea here.
Getting the annotation image for an annotation is a couple simple lookups (first get the metadata dictionary for the annotation, then "dequeue" the annotation's reusable image). Since the callout is an iOS-specific implementation, it doesn't seem necessary to add a parallel field in mbgl code. @incanus, would that be desirable anyways? |
all callout offset update is only within iOS code. The only update needed was to take into account the annotation image center offset to position by default the callout y on the top of the image. |
Ah, makes sense then. 👍 Although I wonder what should happen if the UIImage has an alignment rect set. (On OS X, I’m using the alignment rect to help determine the hit target and callout offset.) |
You're right. The offset reveal a conception problem: the annotation touch event is not "really" linked to the image but to an arbitrary area around the geographical position. It's mostly working, but will fail if the offset is too hight or left/right. |
the tap issue is #1504 |
Correcting the hit testing will require #3159. It’s a big change, but I’ve done it before on the iOS side as part of #1496, which unfortunately went stale. I may have time either today or tomorrow to work on it, depending on how my other active PRs progress. Once that’s done, either of us can implement the approach taken in 05b039e for #3135. (See |
Ok, feel free to ask me when you need help on iOS / Core, I'm dedicated by Mappy company to help on that part. |
SpriteImage assumes that images can only have integral width and height. I attempted to introduce the concept of floating-point width and height in #3008, but it turns out that we need to refactor more of mbgl to always work with pixel dimensions (which would be integral regardless) instead of point dimensions. We’re tracking this work in #3164. /cc @jfirebaugh |
Once #3561 lands, |
@jfirebaugh pointed out that we should take better advantage of the GL style system for the center offset functionality:
The callout offset functionality doesn’t fit into the style system, and it’s implemented entirely within the iOS SDK, so that isn’t a concern. But I think I’d still like to see it expressed as a |
…fset is now working for the annotations.
I updated the pull request to work on v3.2.0 |
|
Stale. |
Add centerOffset and calloutOffset properties to MGLAnnotation
for issue #2151