@@ -148,7 +148,7 @@ export class Leaflet {
148148 'lat' in options . initialValue &&
149149 'lng' in options . initialValue
150150 ) {
151- L . marker ( options . initialValue as any , {
151+ const marker = L . marker ( options . initialValue as any , {
152152 icon : L . icon ( {
153153 iconUrl :
154154 'https://unpkg.com/leaflet@1.9.4/dist/images/marker-icon.png' ,
@@ -160,6 +160,12 @@ export class Leaflet {
160160
161161 this . map . setView ( options . initialValue , 5 )
162162
163+ // Dispatch draw event for initial point so components can react
164+ this . dispatch ( 'draw' , {
165+ geoJson : marker . toGeoJSON ( ) ,
166+ latLng : options . initialValue ,
167+ } )
168+
163169 return
164170 }
165171
@@ -168,7 +174,7 @@ export class Leaflet {
168174 ( ( options . initialValue as LatLngBoundsLiteral ) ?. length > 0 ||
169175 'getNorthEast' in options . initialValue )
170176 ) {
171- L . rectangle ( options . initialValue as LatLngBoundsExpression , {
177+ const rectangle = L . rectangle ( options . initialValue as LatLngBoundsExpression , {
172178 stroke : true ,
173179 color : '#3388ff' ,
174180 weight : 4 ,
@@ -178,6 +184,12 @@ export class Leaflet {
178184 } ) . addTo ( this . editableLayers )
179185
180186 this . map . fitBounds ( options . initialValue )
187+
188+ // Dispatch draw event for initial bounds so components can react
189+ this . dispatch ( 'draw' , {
190+ geoJson : rectangle . toGeoJSON ( ) ,
191+ bounds : rectangle . getBounds ( ) ,
192+ } )
181193 }
182194 } )
183195 }
@@ -237,14 +249,14 @@ export class Leaflet {
237249 marker : options ?. hidePointSelectionDrawTool
238250 ? false
239251 : {
240- icon : L . icon ( {
241- iconUrl :
242- 'https://unpkg.com/leaflet@1.9.4/dist/images/marker-icon.png' ,
243- iconAnchor : [ 15 , 40 ] ,
244- shadowUrl :
245- 'https://unpkg.com/leaflet@1.9.4/dist/images/marker-shadow.png' ,
246- } ) ,
247- } ,
252+ icon : L . icon ( {
253+ iconUrl :
254+ 'https://unpkg.com/leaflet@1.9.4/dist/images/marker-icon.png' ,
255+ iconAnchor : [ 15 , 40 ] ,
256+ shadowUrl :
257+ 'https://unpkg.com/leaflet@1.9.4/dist/images/marker-shadow.png' ,
258+ } ) ,
259+ } ,
248260 } ,
249261 edit : {
250262 featureGroup : this . editableLayers , //REQUIRED!!
0 commit comments