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: README.md
+9-7
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,9 @@ A tiny wrapper for [react-leaflet](https://react-leaflet.js.org/)'s `<Marker />`
16
16
17
17
The approach this library uses differs from other approaches that use `renderToString` in that it instead uses React's [Portal](https://react.dev/reference/react-dom/createPortal) functionality to achieve the effect. That means the component is not static, but a full first-class component that can have its own state, event handlers & lifecycle.
18
18
19
-
I struggled to find something that worked in this way I could drop something in from a design system in there and have all the context available such that it works, and all the interactions working as they should.
19
+
I struggled to find something that worked in a way where I could simply drop something in from a design system, and have all the context available such that it works, as well as all the interactions working as they should.
20
+
21
+
Many existing packages exist but they use techniques that mean they are very limited.
20
22
21
23
# Installation
22
24
@@ -88,14 +90,14 @@ The `componentIconOpts` prop can be passed, which is an object with additional o
88
90
89
91
Below is a list of properties this object can be provided.
90
92
91
-
### `layoutMode`
93
+
####`layoutMode`
92
94
93
95
The `layoutMode` controls how the bounding box of the React component marker behaves. It accepts two options:
94
96
95
97
-`fit-content`_(default)_. In this mode, the React component itself defines the dimensions of the marker. The component can shrink and expand at will. Logic internally to this library centers the component on its coordinates to match Leaflets default positioning; however, Leaflet itself is effectively no longer in control of this.
96
98
-`fit-parent`. In this mode, the dimensions of the React component marker are bound by the `iconSize` passed to `componentIconOpts.rootDivOpts`. Leaflet is therefore in control of the dimensions and positioning. Component markers should use elements with 100% width & height to fill the available size if needed.
97
99
98
-
## `rootDivOpts`
100
+
####`rootDivOpts`
99
101
100
102
> [!NOTE]
101
103
> Some options are not supported since they do not apply or make sense in the case of a React component marker. The unsupported options are `html`, `bgPos`, `shadowUrl`, `shadowSize`, `shadowAnchor`, `shadowRetinaUrl`, `iconUrl` and `iconRetinaUrl`.
@@ -104,25 +106,25 @@ An object containing properties from the supported subset of the underlying Leaf
104
106
105
107
If using `fit-parent`, you must set `iconSize` here.
106
108
107
-
## `disableScrollPropagation`
109
+
####`disableScrollPropagation`
108
110
109
111
`false` by default.
110
112
111
113
If set to `true`, panning/scrolling the map will not be possible "through" the component marker.
112
114
113
-
## `disableClickPropagation`
115
+
####`disableClickPropagation`
114
116
115
117
`false` by default.
116
118
117
119
If set to `true`, clicking on the component marker will not be captured by the underlying map.
118
120
119
-
## `unusedOptsWarning`
121
+
####`unusedOptsWarning`
120
122
121
123
`true` by default.
122
124
123
125
Can be set to `false` in order to not warn in console about cases where `componentIconOpts` was set but `icon` was not a React component.
0 commit comments