3030import com .vaadin .flow .component .ComponentEventListener ;
3131import com .vaadin .flow .component .ComponentUtil ;
3232import com .vaadin .flow .component .HasSize ;
33+ import com .vaadin .flow .component .HasStyle ;
3334import com .vaadin .flow .component .Tag ;
3435import com .vaadin .flow .component .dependency .JsModule ;
3536import com .vaadin .flow .component .dependency .NpmPackage ;
4647@ NpmPackage (value = "leaflet" , version = "^1.6.0" )
4748@ Tag ("leaflet-map" )
4849@ JsModule ("./leaflet/leafletCon.js" )
49- public class LMap extends Component implements HasSize
50+ public class LMap extends Component implements HasSize , HasStyle
5051{
5152
5253 private static final String SET_VIEW_POINT_FUNCTION = "setViewPoint" ;
@@ -65,6 +66,7 @@ public LMap(final double lat, final double lon, final int zoom)
6566 super ();
6667 this .center = new LCenter (lat , lon , zoom );
6768 this .setViewPoint (this .center );
69+ this .setFixZIndexEnabled (true );
6870 }
6971
7072 public LMap ()
@@ -86,7 +88,18 @@ public void setTileLayer(final LTileLayer tl)
8688 {
8789 this .getElement ().callJsFunction (TILE_LAYER_FUNCTION , tl .toJson ());
8890 }
89-
91+
92+ /**
93+ * This fixes situations where the leafletmap overlays components like Dialogs
94+ *
95+ * @param enabled
96+ * enable or disable the fix
97+ */
98+ protected void setFixZIndexEnabled (final boolean enabled )
99+ {
100+ this .getStyle ().set ("z-index" , enabled ? "1" : null );
101+ }
102+
90103 /**
91104 * add a Leaflet Component to the map.
92105 *
0 commit comments