Skip to content
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

Fix For Markers #10

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion lib/src/geo/point.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import 'package:mapbox_gl_dart/src/interop/interop.dart';
class Point extends JsObjectWrapper<PointJsImpl> {
num get x => jsObject.x;
num get y => jsObject.y;

factory Point(
num x,
num y,
Expand All @@ -14,6 +13,7 @@ class Point extends JsObjectWrapper<PointJsImpl> {
x: x,
y: y,
));
Point mult(k) => Point.fromJsObject(jsObject.mult(k));

/// Creates a new LngLat from a [jsObject].
Point.fromJsObject(PointJsImpl jsObject) : super.fromJsObject(jsObject);
Expand Down
2 changes: 1 addition & 1 deletion lib/src/interop/geo/point_interop.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import 'package:js/js.dart';
class PointJsImpl {
external num get x;
external num get y;

external factory PointJsImpl({
num x,
num y,
});
external PointJsImpl mult(num k);
}
4 changes: 3 additions & 1 deletion lib/src/interop/ui/marker_interop.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import 'package:mapbox_gl_dart/src/interop/interop.dart';
/// @see [Create a draggable Marker](https://www.mapbox.com/mapbox-gl-js/example/drag-a-marker/)
@JS('Marker')
class MarkerJsImpl extends EventedJsImpl {
external factory MarkerJsImpl([MarkerOptionsJsImpl options]);
external factory MarkerJsImpl([Object options]);

/// Attaches the marker to a map
/// @param {MapboxMap} map
Expand Down Expand Up @@ -118,10 +118,12 @@ class MarkerJsImpl extends EventedJsImpl {
@JS()
@anonymous
class MarkerOptionsJsImpl {
external static String get scale;
external factory MarkerOptionsJsImpl({
HtmlElement element,
PointJsImpl offset,
String anchor,
num scale,
String color,
bool draggable,
num rotation,
Expand Down
6 changes: 4 additions & 2 deletions lib/src/ui/marker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import 'package:mapbox_gl_dart/src/interop/interop.dart';
/// @see [Create a draggable Marker](https://www.mapbox.com/mapbox-gl-js/example/drag-a-marker/)
class Marker extends Evented {
final MarkerJsImpl jsObject;
factory Marker([MarkerOptions options]) =>
Marker.fromJsObject(MarkerJsImpl(options.jsObject));
factory Marker([Object options]) =>
Marker.fromJsObject(MarkerJsImpl(options));

/// Attaches the marker to a map
/// @param {MapboxMap} map
Expand Down Expand Up @@ -133,6 +133,7 @@ class MarkerOptions extends JsObjectWrapper<MarkerOptionsJsImpl> {
String anchor,
String color,
bool draggable,
num scale,
num rotation,
String rotationAlignment,
String pitchAlignment,
Expand All @@ -142,6 +143,7 @@ class MarkerOptions extends JsObjectWrapper<MarkerOptionsJsImpl> {
offset: offset.jsObject,
anchor: anchor,
color: color,
scale: scale,
draggable: draggable,
rotation: rotation,
rotationAlignment: rotationAlignment,
Expand Down