From db6116de42dffd0c81b9188bad6c49dc3ca737da Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20BRISON?=
 <ext.sopra.jbrison@grandlyon.com>
Date: Fri, 27 Nov 2020 17:31:08 +0100
Subject: [PATCH] fix: map marker hover, pop-up width

---
 src/app/map/components/map.component.scss | 3 +++
 src/app/map/components/map.component.ts   | 2 ++
 src/assets/ico/sprite.svg                 | 2 +-
 3 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/app/map/components/map.component.scss b/src/app/map/components/map.component.scss
index fbe4d0c10..a0b56f0dc 100644
--- a/src/app/map/components/map.component.scss
+++ b/src/app/map/components/map.component.scss
@@ -112,6 +112,9 @@
   border-radius: 6px;
   border: 1px solid $grey-4;
 }
+::ng-deep .leaflet-popup-content {
+  width: 240px;
+}
 ::ng-deep .leaflet-popup-tip-container {
   display: none;
 }
diff --git a/src/app/map/components/map.component.ts b/src/app/map/components/map.component.ts
index 84a68b693..da2b10cac 100644
--- a/src/app/map/components/map.component.ts
+++ b/src/app/map/components/map.component.ts
@@ -81,8 +81,10 @@ export class MapComponent implements OnChanges {
     }
     // Handle map marker selection
     if (changes.selectedMarkerId) {
+      this.map.closePopup();
       if (changes.selectedMarkerId.currentValue === undefined) {
         this.mapService.setDefaultMarker(changes.selectedMarkerId.previousValue);
+        this.map.setView(this.mapOptions.center, this.mapOptions.zoom);
       } else {
         this.mapService.setSelectedMarker(changes.selectedMarkerId.currentValue);
         this.centerLeafletMapOnMarker(changes.selectedMarkerId.currentValue);
diff --git a/src/assets/ico/sprite.svg b/src/assets/ico/sprite.svg
index cd608f880..af9782587 100644
--- a/src/assets/ico/sprite.svg
+++ b/src/assets/ico/sprite.svg
@@ -1,6 +1,6 @@
 <svg xmlns="http://www.w3.org/2000/svg">
 <symbol id="map-marker" viewBox="0 0 50 50" xmlns="http://www.w3.org/2000/svg"><path d="M19.72 43.73l.706.66.683-.683c2.038-2.04 4.04-3.864 5.934-5.588l.179-.163c6.32-5.755 11.624-10.585 11.624-18.493C38.846 9.267 30.59 1 20.402 1 10.214 1 1.957 9.267 1.957 19.463c0 4.152 1.08 7.233 3.179 10.152 2.04 2.84 5.05 5.523 8.833 8.899l.078.07c1.717 1.531 3.607 3.217 5.672 5.147zm6.508-24.267a5.83 5.83 0 01-5.826 5.833 5.83 5.83 0 01-5.826-5.833 5.83 5.83 0 015.826-5.833 5.83 5.83 0 015.826 5.833z"/></symbol>
-<symbol id="map-marker-locate" viewBox="0 0 50 50" xmlns="http://www.w3.org/2000/svg"><path d="M19.72 43.73l.706.66.683-.683c2.038-2.04 4.04-3.864 5.934-5.588l.179-.163c6.32-5.755 11.624-10.585 11.624-18.493C38.846 9.267 30.59 1 20.402 1 10.214 1 1.957 9.267 1.957 19.463c0 4.152 1.08 7.233 3.179 10.152 2.04 2.84 5.05 5.523 8.833 8.899l.078.07c1.717 1.531 3.607 3.217 5.672 5.147zm6.508-24.267a5.83 5.83 0 01-5.826 5.833 5.83 5.83 0 01-5.826-5.833 5.83 5.83 0 015.826-5.833 5.83 5.83 0 015.826 5.833z" fill="#D50000" stroke="#fff" stroke-width="2"/></symbol>
+<symbol id="map-marker-locate" viewBox="0 0 50 50" xmlns="http://www.w3.org/2000/svg"><path d="M19.72 43.73l.706.66.683-.683c2.038-2.04 4.04-3.864 5.934-5.588l.179-.163c6.32-5.755 11.624-10.585 11.624-18.493C38.846 9.267 30.59 1 20.402 1 10.214 1 1.957 9.267 1.957 19.463c0 4.152 1.08 7.233 3.179 10.152 2.04 2.84 5.05 5.523 8.833 8.899l.078.07c1.717 1.531 3.607 3.217 5.672 5.147zm6.508-24.267a5.83 5.83 0 01-5.826 5.833 5.83 5.83 0 01-5.826-5.833 5.83 5.83 0 015.826-5.833 5.83 5.83 0 015.826 5.833z" fill="#117083" stroke="#fff" stroke-width="2"/></symbol>
 
 <symbol id="adress" viewBox="0 0 22 22" xmlns="http://www.w3.org/2000/svg">
 <path fill-rule="evenodd" clip-rule="evenodd" d="M11 2C12.6055 2.0145 14.1397 2.68885 15.265 3.87463C16.3902 5.06042 17.0142 6.66048 16.9998 8.32269C16.9998 11.8208 12.1242 19 11 19C9.87584 19 5.00025 11.8208 5.00025 8.32269C4.98578 6.66048 5.60982 5.06042 6.73504 3.87463C7.86026 2.68885 9.39446 2.0145 11 2ZM10.9999 5.55695C12.0865 5.53677 13.0768 6.19906 13.5059 7.23274C13.9349 8.26643 13.7173 9.4661 12.9553 10.2683C12.1933 11.0704 11.0384 11.3157 10.0329 10.8888C9.02744 10.4619 8.37129 9.44779 8.37266 8.32272C8.36215 6.80858 9.53743 5.57133 10.9999 5.55695Z" fill="#333333"/>
-- 
GitLab