Skip to content

Commit c27dbc9

Browse files
javier-godoypaodb
authored andcommitted
fix: add compatible constructor for GoogleMapPolyClickEvent
Close #180
1 parent 1514273 commit c27dbc9

2 files changed

Lines changed: 30 additions & 2 deletions

File tree

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<groupId>com.flowingcode.vaadin.addons</groupId>
66
<artifactId>google-maps</artifactId>
7-
<version>2.4.1-SNAPSHOT</version>
7+
<version>2.5.0-SNAPSHOT</version>
88
<name>Google Maps Addon</name>
99
<description>Integration of google-map for Vaadin platform</description>
1010

src/main/java/com/flowingcode/vaadin/addons/googlemaps/GoogleMapPoly.java

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,38 @@ public static class GoogleMapPolyClickEvent extends ClickEvent<GoogleMapPolygon>
160160
private final double lat;
161161
private final double lon;
162162

163+
/**
164+
* Creates a new event with the click coordinates as separate lat/lon values.
165+
*
166+
* @param source the polygon that was clicked
167+
* @param fromClient whether the event originated on the client side
168+
* @param lat the latitude of the click
169+
* @param lon the longitude of the click
170+
*/
163171
public GoogleMapPolyClickEvent(
164172
GoogleMapPoly source,
165173
boolean fromClient,
166-
@EventData(value = "event.detail.latLng") JsonValue latLng) {
174+
@EventData("event.detail.latLng.lat()") double lat,
175+
@EventData("event.detail.latLng.lng()") double lon) {
176+
super(source);
177+
this.lat = lat;
178+
this.lon = lon;
179+
}
180+
181+
/**
182+
* Creates a new event with the click coordinates as a JSON value.
183+
*
184+
* @param source the polygon that was clicked
185+
* @param fromClient whether the event originated on the client side
186+
* @param latLng a JSON object containing {@code lat} and {@code lng} properties
187+
* @deprecated since 2.5.0, for removal. Use
188+
* {@link #GoogleMapPolyClickEvent(GoogleMapPoly, boolean, double, double)} instead.
189+
*/
190+
@Deprecated
191+
public GoogleMapPolyClickEvent(
192+
GoogleMapPoly source,
193+
boolean fromClient,
194+
JsonValue latLng) {
167195
super(source);
168196
lat = ((JsonObject) latLng).getNumber("lat");
169197
lon = ((JsonObject) latLng).getNumber("lng");

0 commit comments

Comments
 (0)