Skip to content

Commit

Permalink
dart format
Browse files Browse the repository at this point in the history
  • Loading branch information
mootw committed Dec 3, 2024
1 parent f3c2132 commit d726a5e
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 23 deletions.
3 changes: 1 addition & 2 deletions lib/src/layer/polyline_layer/painter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,7 @@ base class _PolylinePainter<R extends Object>
paint = Paint();
}

final origin =
camera.project(camera.center) - camera.size / 2;
final origin = camera.project(camera.center) - camera.size / 2;

for (final projectedPolyline in polylines) {
final polyline = projectedPolyline.polyline;
Expand Down
3 changes: 2 additions & 1 deletion lib/src/layer/polyline_layer/polyline_layer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,8 @@ class _PolylineLayerState<R extends Object> extends State<PolylineLayer<R>>
final p1 = projectedPolyline.points[i];
final p2 = projectedPolyline.points[i + 1];

containsSegment = projBounds.aabbContainsLine(p1.dx, p1.dy, p2.dx, p2.dy);
containsSegment =
projBounds.aabbContainsLine(p1.dx, p1.dy, p2.dx, p2.dy);
if (containsSegment) {
if (start == -1) {
start = i;
Expand Down
28 changes: 16 additions & 12 deletions lib/src/layer/tile_layer/tile_bounds/tile_bounds.dart
Original file line number Diff line number Diff line change
Expand Up @@ -138,23 +138,27 @@ class WrappedTileBounds extends TileBounds {

(int, int)? wrapX;
if (crs.wrapLng case final wrapLng?) {
final wrapXMin = (crs.latLngToPoint(LatLng(0, wrapLng.$1), zoomDouble).dx /
_tileDimension)
.floor();
final wrapXMax = (crs.latLngToPoint(LatLng(0, wrapLng.$2), zoomDouble).dx /
_tileDimension)
.ceil();
final wrapXMin =
(crs.latLngToPoint(LatLng(0, wrapLng.$1), zoomDouble).dx /
_tileDimension)
.floor();
final wrapXMax =
(crs.latLngToPoint(LatLng(0, wrapLng.$2), zoomDouble).dx /
_tileDimension)
.ceil();
wrapX = (wrapXMin, wrapXMax - 1);
}

(int, int)? wrapY;
if (crs.wrapLat case final wrapLat?) {
final wrapYMin = (crs.latLngToPoint(LatLng(wrapLat.$1, 0), zoomDouble).dy /
_tileDimension)
.floor();
final wrapYMax = (crs.latLngToPoint(LatLng(wrapLat.$2, 0), zoomDouble).dy /
_tileDimension)
.ceil();
final wrapYMin =
(crs.latLngToPoint(LatLng(wrapLat.$1, 0), zoomDouble).dy /
_tileDimension)
.floor();
final wrapYMax =
(crs.latLngToPoint(LatLng(wrapLat.$2, 0), zoomDouble).dy /
_tileDimension)
.ceil();
wrapY = (wrapYMin, wrapYMax - 1);
}

Expand Down
8 changes: 4 additions & 4 deletions lib/src/map/camera/camera_fit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -435,8 +435,8 @@ class FitCoordinates extends CameraFit {
final projectedPoints =
coordinates.map((coord) => camera.project(coord, newZoom));

final rotatedPoints = projectedPoints
.map((point) => point.rotate(-camera.rotationRad));
final rotatedPoints =
projectedPoints.map((point) => point.rotate(-camera.rotationRad));

final rotatedBounds = Bounds.containing(rotatedPoints);

Expand Down Expand Up @@ -467,8 +467,8 @@ class FitCoordinates extends CameraFit {
for (final coord in coordinates) camera.project(coord)
];

final rotatedPoints = projectedPoints
.map((point) => point.rotate(-camera.rotationRad));
final rotatedPoints =
projectedPoints.map((point) => point.rotate(-camera.rotationRad));
final rotatedBounds = Bounds.containing(rotatedPoints);

final boundsSize = rotatedBounds.size;
Expand Down
5 changes: 1 addition & 4 deletions lib/src/misc/extensions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,11 @@ extension PointExtension<T extends num> on Point<T> {
}

/// Converts to offset
Offset toOffset () => Offset(x.toDouble(), y.toDouble());

Offset toOffset() => Offset(x.toDouble(), y.toDouble());
}

/// Extension methods for [Offset]
extension OffsetToPointExtension on Offset {

/// Creates a [Point] representation of this offset. This is ONLY used for backwards compatibility
@Deprecated('Only used for backwards compatibility')
Point<double> toPoint() => Point(dx, dy);
Expand All @@ -50,5 +48,4 @@ extension OffsetToPointExtension on Offset {

/// returns new [Offset] where roundToDouble() is called on [dx] and [dy] independently
Offset round() => Offset(dx.roundToDouble(), dy.roundToDouble());

}

0 comments on commit d726a5e

Please sign in to comment.