Skip to content
Draft
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
4 changes: 2 additions & 2 deletions example/integration_test/controller_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ void main() {
await tester.pumpWidget(app);
final ctrl = await ctrlCompleter.future;
events.clear();
await ctrl.moveCamera(
ctrl.moveCamera(
center: const Geographic(lon: 1, lat: 1),
bearing: 1,
zoom: 1,
Expand Down Expand Up @@ -742,7 +742,7 @@ void main() {
final app = App(onMapCreated: ctrlCompleter.complete);
await tester.pumpWidget(app);
final ctrl = await ctrlCompleter.future;
await ctrl.moveCamera(
ctrl.moveCamera(
center: const Geographic(lon: 1, lat: 2),
bearing: 1,
zoom: 1,
Expand Down
2 changes: 1 addition & 1 deletion example/integration_test/map_scalebar_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ void main() {
final widths = <double>[];

for (final zoom in zoomLevels) {
await ctrl.moveCamera(zoom: zoom);
ctrl.moveCamera(zoom: zoom);
await tester.pumpAndSettle(const Duration(seconds: 2));

final size = tester.getSize(customPaintFinder);
Expand Down
2 changes: 1 addition & 1 deletion example/lib/controller_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class _ControllerPageState extends State<ControllerPage> {
OutlinedButton(
onPressed: () async {
debugPrint('moveCamera start');
await _controller.moveCamera(
_controller.moveCamera(
center: const Geographic(lon: 172.4714, lat: -42.4862),
zoom: 4,
pitch: 0,
Expand Down
14 changes: 14 additions & 0 deletions maplibre/lib/src/map_camera.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,18 @@ class MapCamera {

@override
int get hashCode => Object.hash(center, zoom, bearing, pitch);

/// Returns a copy of this [MapCamera] with the given fields replaced by the
/// new values.
MapCamera copyWith({
Geographic? center,
double? zoom,
double? bearing,
double? pitch,
}) => MapCamera(
center: center ?? this.center,
zoom: zoom ?? this.zoom,
bearing: bearing ?? this.bearing,
pitch: pitch ?? this.pitch,
);
}
2 changes: 1 addition & 1 deletion maplibre/lib/src/map_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ abstract interface class MapController {
List<Geographic> toLngLats(List<Offset> screenLocations);

/// Instantly move the map camera to a new location.
Future<void> moveCamera({
void moveCamera({
Geographic? center,
double? zoom,
double? bearing,
Expand Down
Loading
Loading