1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
use Div;
use *;
use *;
use crate;
use ;
/// A tooltip component for displaying hover information on map elements.
///
/// This component supports different pane handling strategies through the `pane_strategy` parameter.
///
/// # Pane Integration
///
/// The `pane_strategy` parameter controls how the tooltip determines which pane to use:
/// - **PaneStrategy::Context** (default): Uses the pane context from parent `Pane` components
/// - **PaneStrategy::Custom(signal)**: Uses a specific pane name (can be reactive)
/// - **PaneStrategy::Default**: Uses Leaflet's default tooltip pane behavior
///
/// # Examples
///
/// Basic tooltip using pane context (default behavior):
/// ```rust,no_run
/// use leptos::prelude::*;
/// use leptos_leaflet::prelude::*;
///
/// #[component]
/// fn App() -> impl IntoView {
/// view! {
/// <MapContainer center=Position::new(51.505, -0.09) zoom=13.0>
/// <TileLayer url="https://tile.openstreetmap.org/{z}/{x}/{y}.png" />
///
/// <Pane name="custom-pane" z_index=Signal::derive(|| 650.0)>
/// <Circle center=position!(51.505, -0.09) radius=200.0 color="blue">
/// // This tooltip will automatically use "custom-pane" (default behavior)
/// <Tooltip>"Hover info in custom pane"</Tooltip>
/// </Circle>
/// </Pane>
/// </MapContainer>
/// }
/// }
/// ```
///
/// Tooltip with explicit pane strategy:
/// ```rust,no_run
/// use leptos::prelude::*;
/// use leptos_leaflet::prelude::*;
///
/// #[component]
/// fn ExplicitPaneExample() -> impl IntoView {
/// view! {
/// <MapContainer center=Position::new(51.505, -0.09) zoom=13.0>
/// <TileLayer url="https://tile.openstreetmap.org/{z}/{x}/{y}.png" />
///
/// <Pane name="background-pane" z_index=Signal::derive(|| 350.0)>
/// <Polygon positions=positions(&[(51.500, -0.086), (51.510, -0.086), (51.510, -0.096)])>
/// // This tooltip uses a custom pane, ignoring the parent pane context
/// <Tooltip pane_strategy=PaneStrategy::Custom(Signal::derive(|| "tooltip-pane".to_string()))>
/// "I'm in a different pane than my parent!"
/// </Tooltip>
/// </Polygon>
/// </Pane>
/// </MapContainer>
/// }
/// }
/// ```
///
/// Tooltip using Leaflet's default behavior:
/// ```rust,no_run
/// use leptos::prelude::*;
/// use leptos_leaflet::prelude::*;
///
/// #[component]
/// fn DefaultPaneExample() -> impl IntoView {
/// view! {
/// <MapContainer center=Position::new(51.505, -0.09) zoom=13.0>
/// <TileLayer url="https://tile.openstreetmap.org/{z}/{x}/{y}.png" />
///
/// <Pane name="custom-pane" z_index=Signal::derive(|| 650.0)>
/// <Circle center=position!(51.505, -0.09) radius=200.0 color="blue">
/// // This tooltip ignores both custom and context panes, using Leaflet's default
/// <Tooltip pane_strategy=PaneStrategy::Default>
/// "I'm in Leaflet's default tooltip pane!"
/// </Tooltip>
/// </Circle>
/// </Pane>
/// </MapContainer>
/// }
/// }
/// ```
///
/// Standalone tooltip with position:
/// ```rust,no_run
/// use leptos::prelude::*;
/// use leptos_leaflet::prelude::*;
///
/// #[component]
/// fn StandaloneTooltipExample() -> impl IntoView {
/// view! {
/// <MapContainer center=Position::new(51.505, -0.09) zoom=13.0>
/// <TileLayer url="https://tile.openstreetmap.org/{z}/{x}/{y}.png" />
///
/// <Pane name="tooltip-pane" z_index=Signal::derive(|| 650.0)>
/// // Standalone tooltip that inherits the pane context (default behavior)
/// <Tooltip position=position!(51.505, -0.09) permanent=Signal::derive(|| true)>
/// "Standalone tooltip in custom pane"
/// </Tooltip>
/// </Pane>
/// </MapContainer>
/// }
/// }
/// ```
///
/// # Props
///
/// - `pane_strategy`: Controls how the tooltip determines which pane to use
/// - Other props control tooltip behavior like position, permanence, direction, etc.
] direction: ,
sticky: ,
opacity: ,
children: Children,
)