@lugg/maps 0.2.0-alpha.4 → 0.2.0-alpha.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14,6 +14,12 @@ import kotlin.math.min
14
14
  class PolylineAnimator {
15
15
  var polyline: Polyline? = null
16
16
  var coordinates: List<LatLng> = emptyList()
17
+ set(value) {
18
+ field = value
19
+ if (animated && animator != null) {
20
+ computeCumulativeDistances()
21
+ }
22
+ }
17
23
  var strokeColors: List<Int> = listOf(Color.BLACK)
18
24
  var strokeWidth: Float = 1f
19
25
 
@@ -316,6 +316,9 @@ using namespace luggmaps::events;
316
316
  // Build new polyline from coordinates
317
317
  NSArray<CLLocation *> *coordinates = polylineView.coordinates;
318
318
  if (coordinates.count == 0) {
319
+ if (renderer) {
320
+ renderer.animated = NO;
321
+ }
319
322
  if (oldPolyline) {
320
323
  [_mapView removeOverlay:oldPolyline];
321
324
  polylineView.polyline = nil;
@@ -337,6 +340,8 @@ using namespace luggmaps::events;
337
340
 
338
341
  // If we have an existing renderer, update it in place
339
342
  if (renderer && oldPolyline) {
343
+ [_mapView removeOverlay:oldPolyline];
344
+ [_mapView addOverlay:newPolyline];
340
345
  [renderer updatePolyline:newPolyline];
341
346
  renderer.lineWidth = polylineView.strokeWidth;
342
347
  renderer.strokeColor = polylineView.strokeColors.firstObject;
@@ -242,14 +242,14 @@ static NSString *const kDemoMapId = @"DEMO_MAP_ID";
242
242
  marker.position = markerView.coordinate;
243
243
  marker.title = markerView.title;
244
244
  marker.snippet = markerView.markerDescription;
245
- marker.groundAnchor = markerView.anchor;
246
-
247
245
  if (markerView.hasCustomView) {
248
246
  UIView *iconView = markerView.iconView;
249
247
  [iconView removeFromSuperview];
250
248
  marker.iconView = iconView;
249
+ marker.groundAnchor = markerView.anchor;
251
250
  } else {
252
251
  marker.iconView = nil;
252
+ marker.groundAnchor = CGPointMake(0.5, 1);
253
253
  }
254
254
  }
255
255
 
@@ -280,9 +280,9 @@ static NSString *const kDemoMapId = @"DEMO_MAP_ID";
280
280
 
281
281
  if (markerView.hasCustomView) {
282
282
  marker.iconView = iconView;
283
+ marker.groundAnchor = markerView.anchor;
283
284
  }
284
285
 
285
- marker.groundAnchor = markerView.anchor;
286
286
  marker.map = _mapView;
287
287
 
288
288
  markerView.marker = marker;
@@ -12,6 +12,13 @@
12
12
  [self stopAnimation];
13
13
  }
14
14
 
15
+ - (void)setCoordinates:(NSArray<CLLocation *> *)coordinates {
16
+ [super setCoordinates:coordinates];
17
+ if (_animated && _displayLink) {
18
+ [self computeCumulativeDistances];
19
+ }
20
+ }
21
+
15
22
  - (void)setAnimated:(BOOL)animated {
16
23
  if (_animated == animated) {
17
24
  return;
@@ -93,6 +93,9 @@
93
93
  _polyline = polyline;
94
94
  [self invalidatePath];
95
95
  [self createPath];
96
+ if (_animated) {
97
+ [self computeCumulativeDistances];
98
+ }
96
99
  [self setNeedsDisplay];
97
100
  }
98
101
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lugg/maps",
3
- "version": "0.2.0-alpha.4",
3
+ "version": "0.2.0-alpha.5",
4
4
  "description": "Universal maps for React Native.",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",