Skip to content

Commit bd8824a

Browse files
committed
feat: add compatible constructor for marker DragEndEvent
1 parent 03bd74d commit bd8824a

1 file changed

Lines changed: 29 additions & 1 deletion

File tree

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

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,10 +261,38 @@ public static class DragEndEvent extends ComponentEvent<GoogleMapMarker> {
261261
private final double lat;
262262
private final double lon;
263263

264+
/**
265+
* Creates a new event with the drag end coordinates as separate lat/lon values.
266+
*
267+
* @param source the marker that was dragged
268+
* @param fromClient whether the event originated on the client side
269+
* @param lat the latitude of the drag end
270+
* @param lon the longitude of the drag end
271+
*/
272+
public DragEndEvent(
273+
GoogleMapMarker source,
274+
boolean fromClient,
275+
@EventData("event.detail.latLng.lat()") double lat,
276+
@EventData("event.detail.latLng.lng()") double lon) {
277+
super(source, fromClient);
278+
this.lat = lat;
279+
this.lon = lon;
280+
}
281+
282+
/**
283+
* Creates a new event with the drag end coordinates as a JSON value.
284+
*
285+
* @param source the marker that was dragged
286+
* @param fromClient whether the event originated on the client side
287+
* @param latLng a JSON object containing {@code lat} and {@code lng} properties
288+
* @deprecated since 2.6.0, for removal. Use
289+
* {@link #DragEndEvent(GoogleMapMarker, boolean, double, double)} instead.
290+
*/
291+
@Deprecated
264292
public DragEndEvent(
265293
GoogleMapMarker source,
266294
boolean fromClient,
267-
@EventData(value = "event.detail.latLng") JsonValue latLng) {
295+
JsonValue latLng) {
268296
super(source, fromClient);
269297
this.lat = ((JsonObject) latLng).getNumber("lat");
270298
this.lon = ((JsonObject) latLng).getNumber("lng");

0 commit comments

Comments
 (0)