Skip to content

Implement coordinateLongPress event #61

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 17, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ Event | Description
-------------- |:---------------------------------
`mapReady` | Called when Google Map is ready for use
`coordinateTapped` | Fires when coordinate is clicked on map
`coordinateLongPress` | Fires when coordinate is "long pressed"
`markerSelect` | Fires whenever a marker is selected
`markerBeginDragging` | Fires when a marker begins dragging
`markerDrag` | Fires repeatedly while a marker is being dragged
Expand Down
1 change: 1 addition & 0 deletions map-view-common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export abstract class MapView extends View implements IMapView {
public static markerEndDraggingEvent: string = "markerEndDragging";
public static markerDragEvent: string = "markerDrag";
public static coordinateTappedEvent: string = "coordinateTapped";
public static coordinateLongPressEvent: string = "coordinateLongPress";
public static cameraChangedEvent: string = "cameraChanged";

public static latitudeProperty = new Property("latitude", MAP_VIEW, new PropertyMetadata(0, PropertyMetadataSettings.None, onMapPropertyChanged));
Expand Down
7 changes: 7 additions & 0 deletions map-view.android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,13 @@ export class MapView extends MapViewCommon {
}
}));

gMap.setOnMapLongClickListener(new com.google.android.gms.maps.GoogleMap.OnMapLongClickListener({
onMapLongClick: function(gmsPoint) {
let position: Position = new Position(gmsPoint);
owner.notifyPositionEvent(MapViewCommon.coordinateLongPressEvent, position);
}
}));

gMap.setOnMarkerClickListener(new com.google.android.gms.maps.GoogleMap.OnMarkerClickListener({
onMarkerClick: function(gmsMarker) {

Expand Down
8 changes: 8 additions & 0 deletions map-view.ios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,14 @@ class MapViewDelegateImpl extends NSObject implements GMSMapViewDelegate {
}
}

public mapViewDidLongPressAtCoordinate(mapView: GMSMapView, coordinate: CLLocationCoordinate2D): void {
let owner = this._owner.get();
if (owner) {
let position: Position = Position.positionFromLatLng(coordinate.latitude, coordinate.longitude);
owner.notifyPositionEvent(MapViewCommon.coordinateLongPressEvent, position);
}
}

public mapViewDidTapMarker(mapView: GMSMapView, gmsMarker: GMSMarker): void {
let owner = this._owner.get();
if (owner) {
Expand Down
7 changes: 6 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@
"./**/*.ts",
"!./node_modules/**/*.ts"
],

"files": [
"map-view.d.ts",
"map-view-common.ts",
"map-view.android.ts",
"map-view.ios.ts"
],
"exclude": [
"./platforms/**/*.ts"
]
Expand Down