Commit f41f2dc
Fix FrameViewAnnotationsExample: account for shadow in bounding box (#9555)
## Summary
- Wrap annotation view in a container with padding to account for shadow
extent
- This ensures the annotation's bounding box includes the shadow area,
preventing premature hiding during map panning
## Problem
View annotations with shadows were disappearing before the shadow
visually left the screen. This happened because `ViewAnnotation` uses
`systemLayoutSizeFitting()` to determine the bounding box, which doesn't
account for `CALayer` shadow properties.
## Solution
Wrap the card view in a transparent container with padding calculated
from shadow parameters:
```swift
let shadowPadding = shadowRadius * 2 + max(abs(shadowOffset.width), abs(shadowOffset.height))
```
This makes the bounding box large enough to include the full shadow
extent.
Related:
- mapbox/mapbox-sdk#9460
| Before | After |
|--------|--------|
| <video
src="https://github.com/user-attachments/assets/304b4b61-74b5-460f-a5b0-8638b30d6413"
/> | <video
src="https://github.com/user-attachments/assets/f50e812b-6b6a-4d87-b4c8-58e4cee27d90"
/> |
cc @mapbox/sdk-platform
cc @mapbox/maps-ios
GitOrigin-RevId: 0ef27e5c14073b9f433cded608831c14ecccb1fb1 parent 50f70e2 commit f41f2dc
2 files changed
Lines changed: 34 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
9 | 12 | | |
10 | 13 | | |
11 | 14 | | |
| |||
Lines changed: 31 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
134 | 134 | | |
135 | 135 | | |
136 | 136 | | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
143 | 153 | | |
144 | 154 | | |
145 | 155 | | |
146 | 156 | | |
147 | | - | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
148 | 161 | | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
153 | 171 | | |
154 | | - | |
| 172 | + | |
| 173 | + | |
155 | 174 | | |
156 | 175 | | |
157 | 176 | | |
| |||
0 commit comments