Skip to content

Commit 1b36d5d

Browse files
committed
feat: Added newLatLngBounds
newLatLngBounds was added to the PlatformMapsController. Closes #27.
1 parent b96fe62 commit 1b36d5d

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

lib/src/camera.dart

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ class CameraPosition {
7979
class CameraUpdate {
8080
CameraUpdate._(this._json);
8181

82+
/// Returns a camera update that moves the camera to the specified position.
8283
static newCameraPosition(CameraPosition cameraPosition) {
8384
if (Platform.isIOS) {
8485
return appleMaps.CameraUpdate.newCameraPosition(
@@ -89,6 +90,7 @@ class CameraUpdate {
8990
}
9091
}
9192

93+
/// Returns a camera update that moves the camera target to the specified geographical location.
9294
static newLatLng(LatLng latLng) {
9395
if (Platform.isIOS) {
9496
return appleMaps.CameraUpdate.newLatLng(latLng.appleLatLng);
@@ -97,6 +99,7 @@ class CameraUpdate {
9799
}
98100
}
99101

102+
/// Returns a camera update that moves the camera target to the specified geographical location and zoom level.
100103
static newLatLngZoom(LatLng latLng, double zoom) {
101104
if (Platform.isIOS) {
102105
return appleMaps.CameraUpdate.newLatLngZoom(latLng.appleLatLng, zoom);
@@ -105,6 +108,24 @@ class CameraUpdate {
105108
}
106109
}
107110

111+
/// Returns a camera update that transforms the camera so that
112+
/// the specified geographical bounding box is centered in the map
113+
/// view at the greatest possible zoom level.
114+
/// A non-zero [padding] insets the bounding box from the map view's edges.
115+
/// The camera's new tilt and bearing will both be 0.0.
116+
static newLatLngBounds(LatLngBounds bounds, double padding) {
117+
if (Platform.isIOS) {
118+
return appleMaps.CameraUpdate.newLatLngBounds(
119+
bounds.appleLatLngBounds, padding);
120+
} else if (Platform.isAndroid) {
121+
return googleMaps.CameraUpdate.newLatLngBounds(
122+
bounds.googleLatLngBounds, padding);
123+
}
124+
}
125+
126+
/// Returns a camera update that modifies the camera zoom level by the specified amount.
127+
/// The optional [focus] is a screen point whose underlying geographical location
128+
/// should be invariant, if possible, by the movement.
108129
static zoomBy(double amount) {
109130
if (Platform.isIOS) {
110131
return appleMaps.CameraUpdate.zoomBy(amount);
@@ -113,6 +134,10 @@ class CameraUpdate {
113134
}
114135
}
115136

137+
/// Returns a camera update that zooms the camera in,
138+
/// bringing the camera closer to the surface of the Earth.
139+
///
140+
/// Equivalent to the result of calling zoomBy(1.0).
116141
static zoomIn() {
117142
if (Platform.isIOS) {
118143
return appleMaps.CameraUpdate.zoomIn();
@@ -121,6 +146,10 @@ class CameraUpdate {
121146
}
122147
}
123148

149+
/// Returns a camera update that zooms the camera out,
150+
/// bringing the camera further away from the surface of the Earth.
151+
///
152+
/// Equivalent to the result of calling zoomBy(-1.0).
124153
static zoomOut() {
125154
if (Platform.isIOS) {
126155
return appleMaps.CameraUpdate.zoomOut();
@@ -129,6 +158,7 @@ class CameraUpdate {
129158
}
130159
}
131160

161+
/// Returns a camera update that sets the camera zoom level.
132162
static zoomTo(double zoom) {
133163
if (Platform.isIOS) {
134164
return appleMaps.CameraUpdate.zoomTo(zoom);

lib/src/cap.dart

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,18 @@
22
part of platform_maps_flutter;
33

44
enum Cap {
5+
/// Cap that is squared off exactly at the start or end vertex of a [Polyline] with solid stroke pattern,
6+
/// equivalent to having no additional cap beyond the start or end vertex.
7+
///
8+
/// This is the default cap type at start and end vertices of Polylines with solid stroke pattern.
59
buttCap,
10+
11+
/// Cap that is a semicircle with radius equal to half the stroke width, centered at
12+
/// the start or end vertex of a [Polyline] with solid stroke pattern.
613
roundCap,
14+
15+
/// Cap that is squared off after extending half the stroke width beyond the start
16+
/// or end vertex of a [Polyline] with solid stroke pattern.
717
squareCap,
818
}
919

0 commit comments

Comments
 (0)