-
Notifications
You must be signed in to change notification settings - Fork 1
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
fix: Vertically center the map on mobile when opening it #149
Conversation
BundleMonFiles updated (1)
Unchanged files (3)
Total files change +21B 0% Final result: ✅ View report in BundleMon website ➡️ |
Do you have a ref on this component? Or can you add one? Something like: |
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.
ça me paraît bizarre qu'en changeant la valeur de mapPanRatio ça fonctionne toujours pour les trajets "horizontaux" 🤔 c'est le fait d'avoir remplacer le panBy par paddingBottomRight qui fait que ??
I can likely get a ref to the
Voici ce que dit la documentation à propos de l'option
C'est typiquement notre cas de figure. Ça permet de réserver un certain espace et de centrer le trajet au sein de l'espace restant. Exemple si la taille medium de la Exemple si la taille medium de À noter que si on rétracte la |
There is still a small initial vertical shift when opening the map that disappears once the viewport is resized. This seems to be due to how we observe the toolbar height (replacing the variable with a magic number fixes the issue), but I did not manage to find any strategy with the right hooks to measure it at the right time. This might require changes to |
@PolariTOON ok merci pour le retour. Je pense qu'on peut valider ici et ouvrir une issue en parallèle sur cozy-ui 👍 Je te laisse gérer ça ? |
src/components/Trip/TripMap.jsx
Outdated
mapL.fitBounds(geojsonL.getBounds(), { | ||
paddingBottomRight: [0, mapL.getSize().y * mapPanRatio] | ||
const bounds = geojsonL.getBounds() | ||
const padding = 16 |
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 peut sortir le const padding = 16 en constant hors du composant
- si c'est en fix en rapport à l'issue cozy-ui, on peut créer l'issue et ajouter le lien vers l'issue ici en
// TODO:
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.
Non, c'est pas en fix, c'est juste par rapport à ta revue précédente, ça permet de compenser l'épaisseur du trait du trajet et de ses marqueurs au début et à la fin
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.
Le seul fix que j'ai trouvé pour l'instant ça serait de précalculer la hauteur :
mapContainer: {
- height: `calc(100vh - ${toolbarHeight}px - env(safe-area-inset-bottom))`
+ height: "calc(100vh - 47px - env(safe-area-inset-bottom))"
}
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.
J'ai ouvert un ticket à ce propos ici : cozy/cozy-ui#2185
7a15845
to
d7672e7
Compare
This prevents the route to reach the edges of the map when it is opened
d7672e7
to
92bb171
Compare
This is an approximation. This would likely need to take into account the minimum height of the bottom sheet to be perfect, but it's not exposed by the component.