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
Copy file name to clipboardExpand all lines: src/Map/src/Bridge/Leaflet/README.md
+18-4Lines changed: 18 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -87,7 +87,7 @@ export default class extends Controller
87
87
88
88
_onMarkerBeforeCreate(event) {
89
89
// You can access the marker definition and the Leaflet object
90
-
// Note: `definition.rawOptions` is the raw options object that will be passed to the `L.marker` constructor.
90
+
// Note: `definition.rawOptions` is the raw options object that will be passed to the `L.marker` constructor.
91
91
const { definition, L } =event.detail;
92
92
93
93
// Use a custom icon for the marker
@@ -101,14 +101,28 @@ export default class extends Controller
101
101
shadowAnchor: [4, 62], // the same for the shadow
102
102
popupAnchor: [-3, -76] // point from which the popup should open relative to the iconAnchor
103
103
})
104
-
104
+
105
105
definition.rawOptions= {
106
106
icon: redIcon,
107
107
}
108
108
}
109
109
}
110
110
```
111
111
112
+
### Disable the default tile layer
113
+
114
+
If you need to use a custom tiles layer rendering engine that is not compatible with the `L.tileLayer().addTo(map)` method
115
+
(e.g. e.g.: [Esri/esri-leaflet-vector](https://github.com/Esri/esri-leaflet-vector)), you can disable the default tile layer by passing `tileLayer: false` to the `LeafletOptions`:
116
+
117
+
```php
118
+
use Symfony\UX\Map\Bridge\Leaflet\LeafletOptions;
119
+
120
+
$leafletOptions = new LeafletOptions(tileLayer: false);
121
+
// or
122
+
$leafletOptions = (new LeafletOptions())
123
+
->tileLayer(false);
124
+
```
125
+
112
126
## Known issues
113
127
114
128
### Unable to find `leaflet/dist/leaflet.min.css` file when using Webpack Encore
@@ -124,10 +138,10 @@ webpack compiled with 1 error
124
138
ELIFECYCLE Command failed with exit code 1.
125
139
```
126
140
127
-
That's because the Leaflet's Stimulus controller references the `leaflet/dist/leaflet.min.css` file,
141
+
That's because the Leaflet's Stimulus controller references the `leaflet/dist/leaflet.min.css` file,
128
142
which exists on [jsDelivr](https://www.jsdelivr.com/package/npm/leaflet) (used by the Symfony AssetMapper component),
129
143
but does not in the [`leaflet` npm package](https://www.npmjs.com/package/leaflet).
130
-
The correct path is `leaflet/dist/leaflet.css`, but it is not possible to fix it because it would break compatibility
144
+
The correct path is `leaflet/dist/leaflet.css`, but it is not possible to fix it because it would break compatibility
131
145
with the Symfony AssetMapper component.
132
146
133
147
As a workaround, you can configure Webpack Encore to add an alias for the `leaflet/dist/leaflet.min.css` file:
0 commit comments