Skip to content

Commit 097128b

Browse files
authored
fix(google-maps): ios tap events for polygon, polyline and circle (#351)
closes #350
1 parent 2e51a2f commit 097128b

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

packages/google-maps/index.ios.ts

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Color, EventData, ImageSource, Utils, View } from '@nativescript/core';
22
import { isNullOrUndefined } from '@nativescript/core/utils/types';
3-
import { ActiveBuildingEvent, ActiveLevelEvent, CameraPositionEvent, CameraPositionStartEvent, CircleOptions, Coordinate, CoordinateBounds, GroundOverlayOptions, GroundOverlayTapEvent, ICameraPosition, ICameraUpdate, ICircle, IGoogleMap, IGroundOverlay, IIndoorBuilding, IIndoorLevel, IMarker, InfoWindowEvent, IPatternItem, ICap, IPoi, IPolygon, IPolyline, IProjection, ITileOverlay, ITileProvider, IUISettings, IVisibleRegion, MapTapEvent, MarkerDragEvent, MarkerInfoEvent, MarkerOptions, MarkerTapEvent, PoiTapEvent, PolygonOptions, PolylineOptions, Style, TileOverlayOptions } from '.';
3+
import { ActiveBuildingEvent, ActiveLevelEvent, CameraPositionEvent, CameraPositionStartEvent, CircleOptions, Coordinate, CoordinateBounds, GroundOverlayOptions, CircleTapEvent, PolygonTapEvent, PolylineTapEvent, GroundOverlayTapEvent, ICameraPosition, ICameraUpdate, ICircle, IGoogleMap, IGroundOverlay, IIndoorBuilding, IIndoorLevel, IMarker, InfoWindowEvent, IPatternItem, ICap, IPoi, IPolygon, IPolyline, IProjection, ITileOverlay, ITileProvider, IUISettings, IVisibleRegion, MapTapEvent, MarkerDragEvent, MarkerInfoEvent, MarkerOptions, MarkerTapEvent, PoiTapEvent, PolygonOptions, PolylineOptions, Style, TileOverlayOptions } from '.';
44
import { bearingProperty, JointType, latProperty, lngProperty, MapType, MapViewBase, tiltProperty, zoomProperty } from './common';
55
import { deserialize, intoNativeCircleOptions, intoNativeGroundOverlayOptions, intoNativeMarkerOptions, intoNativePolygonOptions, intoNativePolylineOptions, serialize } from './utils';
66

@@ -298,7 +298,25 @@ class GMSMapViewDelegateImpl extends NSObject implements GMSMapViewDelegate {
298298
}
299299

300300
mapViewDidTapOverlay(mapView: GMSMapView, overlay: GMSOverlay): void {
301-
if (overlay instanceof GMSGroundOverlay) {
301+
if (overlay instanceof GMSCircle) {
302+
this._owner?.get?.().notify?.(<CircleTapEvent>{
303+
eventName: MapView.circleTapEvent,
304+
object: this._owner?.get?.(),
305+
circle: Circle.fromNative(overlay),
306+
});
307+
} else if (overlay instanceof GMSPolygon) {
308+
this._owner?.get?.().notify?.(<PolygonTapEvent>{
309+
eventName: MapView.polygonTapEvent,
310+
object: this._owner?.get?.(),
311+
polygon: Polygon.fromNative(overlay),
312+
});
313+
} else if (overlay instanceof GMSPolyline) {
314+
this._owner?.get?.().notify?.(<PolylineTapEvent>{
315+
eventName: MapView.polylineTapEvent,
316+
object: this._owner?.get?.(),
317+
polyline: Polyline.fromNative(overlay),
318+
});
319+
} else if (overlay instanceof GMSGroundOverlay) {
302320
this._owner?.get?.().notify?.(<GroundOverlayTapEvent>{
303321
eventName: MapView.groundOverlayTapEvent,
304322
object: this._owner?.get?.(),

0 commit comments

Comments
 (0)