You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using React state to automatically change latitude and longitude, which results in a rotating globe. This works nicely, but when I add markers to the mix, they are shaking like crazy:
Cap.2023-09-09.04.02.38.-.Sizzy.Sizzy.mp4
I suspect it has something to do with how Mapbox adjusts markers to accommodate changing user's perspective.
I would appreciate any pointers or ideas on how to go about debugging this and potentially fixing it?
Relevant code bits.
My map-pin.tsx component:
'use client'import{ReactNode}from'react'import{Marker}from'react-map-gl'import{MapPinasMapPinIcon}from'lucide-react'import{Popover,PopoverContent,PopoverTrigger,}from'@/components/ui/popover'interfaceMapPinProps{lat: numberlng: numberchildren?: ReactNode}exportconstMapPin=({ lat, lng, children }: MapPinProps)=>{return(<Markerlongitude={lng}latitude={lat}anchor="bottom">{!children ? (<MapPinIconstrokeWidth={1.5}/>) : (<Popover><PopoverTrigger><MapPinIconstrokeWidth={1.5}/></PopoverTrigger><PopoverContent>{children}</PopoverContent></Popover>)}</Marker>)}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm using React state to automatically change latitude and longitude, which results in a rotating globe. This works nicely, but when I add markers to the mix, they are shaking like crazy:
Cap.2023-09-09.04.02.38.-.Sizzy.Sizzy.mp4
I suspect it has something to do with how Mapbox adjusts markers to accommodate changing user's perspective.
I would appreciate any pointers or ideas on how to go about debugging this and potentially fixing it?
Relevant code bits.
My
map-pin.tsx
component:My
map-base.tsx
component (redacted for clarity):And here is how I use the two components to display the rotating map:
Beta Was this translation helpful? Give feedback.
All reactions