Skip to content

Commit

Permalink
move things around
Browse files Browse the repository at this point in the history
  • Loading branch information
josxha committed Sep 16, 2024
1 parent 2ff8918 commit 19be7f1
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 39 deletions.
39 changes: 38 additions & 1 deletion lib/src/web/interop/interop.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import 'dart:js_interop';
import 'package:maplibre/maplibre.dart';
import 'package:web/web.dart';

part 'annotations.dart';
part 'camera.dart';
part 'controls.dart';
part 'events.dart';
part 'marker.dart';
part 'map.dart';

/// A simple x/y [Point] class for JavaScript.
Expand All @@ -22,3 +22,40 @@ extension type Point._(JSObject _) implements JSObject {
external num x;
external num y;
}

/// A coordinate object
@anonymous
@JS()
extension type LngLat._(JSObject _) implements JSObject {
/// Create a new [LngLat] coordinates object.
external factory LngLat({
required num lng,
required num lat,
});

/// Create a new JS [LngLat] object from a [Position].
factory LngLat.fromPosition(Position p) => LngLat(lng: p.lng, lat: p.lat);

external num lng;
external num lat;

/// Convert the JS [LngLat] object to a dart [Position] object.
Position toPosition() => Position(lng, lat);
}

/// A [LngLatBounds] object represents a geographical bounding box,
/// defined by its southwest and northeast points in longitude and latitude.
@JS()
extension type LngLatBounds._(JSObject _) implements JSObject {
/// Returns the west edge of the bounding box.
external num getWest();

/// Returns the south edge of the bounding box.
external num getSouth();

/// Returns the east edge of the bounding box.
external num getEast();

/// Returns the north edge of the bounding box.
external num getNorth();
}
37 changes: 0 additions & 37 deletions lib/src/web/interop/map.dart
Original file line number Diff line number Diff line change
Expand Up @@ -79,43 +79,6 @@ extension type MapOptions._(JSObject _) implements JSObject {
});
}

/// A coordinate object
@anonymous
@JS()
extension type LngLat._(JSObject _) implements JSObject {
/// Create a new [LngLat] coordinates object.
external factory LngLat({
required num lng,
required num lat,
});

/// Create a new JS [LngLat] object from a [Position].
factory LngLat.fromPosition(Position p) => LngLat(lng: p.lng, lat: p.lat);

external num lng;
external num lat;

/// Convert the JS [LngLat] object to a dart [Position] object.
Position toPosition() => Position(lng, lat);
}

/// A [LngLatBounds] object represents a geographical bounding box,
/// defined by its southwest and northeast points in longitude and latitude.
@JS()
extension type LngLatBounds._(JSObject _) implements JSObject {
/// Returns the west edge of the bounding box.
external num getWest();

/// Returns the south edge of the bounding box.
external num getSouth();

/// Returns the east edge of the bounding box.
external num getEast();

/// Returns the north edge of the bounding box.
external num getNorth();
}

/// Options to specify the map bounds.
@anonymous
@JS()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ part of 'interop.dart';

/// https://maplibre.org/maplibre-gl-js/docs/API/classes/Marker/
@JS()
extension type Marker._(IControl _) implements IControl {
extension type Marker._(JSObject _) implements JSObject {
/// Create a new JS [Marker] object.
external Marker([MarkerOptions? options]);

Expand Down

0 comments on commit 19be7f1

Please sign in to comment.