|
23 | 23 | import com.vaadin.flow.component.Component; |
24 | 24 | import com.vaadin.flow.component.ComponentEventListener; |
25 | 25 | import com.vaadin.flow.component.DomEvent; |
| 26 | +import com.vaadin.flow.component.EventData; |
26 | 27 | import com.vaadin.flow.component.Tag; |
27 | 28 | import com.vaadin.flow.component.dependency.JsModule; |
28 | 29 | import com.vaadin.flow.component.dependency.NpmPackage; |
29 | 30 | import com.vaadin.flow.shared.Registration; |
| 31 | +import elemental.json.JsonObject; |
| 32 | +import elemental.json.JsonValue; |
30 | 33 | import java.util.Arrays; |
31 | 34 | import java.util.List; |
32 | 35 | import java.util.stream.Collectors; |
@@ -149,8 +152,25 @@ public void removePoint(GoogleMapPoint point) { |
149 | 152 |
|
150 | 153 | @DomEvent("google-map-poly-click") |
151 | 154 | public static class GoogleMapPolygonClickEvent extends ClickEvent<GoogleMapPolygon> { |
152 | | - public GoogleMapPolygonClickEvent(GoogleMapPolygon source, boolean fromClient) { |
| 155 | + |
| 156 | + private final double lat; |
| 157 | + private final double lon; |
| 158 | + |
| 159 | + public GoogleMapPolygonClickEvent( |
| 160 | + GoogleMapPolygon source, |
| 161 | + boolean fromClient, |
| 162 | + @EventData(value = "event.detail.latLng") JsonValue latLng) { |
153 | 163 | super(source); |
| 164 | + this.lat = ((JsonObject) latLng).getNumber("lat"); |
| 165 | + this.lon = ((JsonObject) latLng).getNumber("lng"); |
| 166 | + } |
| 167 | + |
| 168 | + public double getLatitude() { |
| 169 | + return this.lat; |
| 170 | + } |
| 171 | + |
| 172 | + public double getLongitude() { |
| 173 | + return this.lon; |
154 | 174 | } |
155 | 175 | } |
156 | 176 |
|
|
0 commit comments