@nativescript-community/ui-mapbox 7.0.3 → 7.0.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.
- package/CHANGELOG.md +10 -0
- package/common.js +0 -9
- package/index.android.d.ts +1 -6
- package/index.android.js +19 -35
- package/index.d.ts +0 -3
- package/index.ios.d.ts +1 -2
- package/index.ios.js +26 -18
- package/markers/Marker.android.js +0 -3
- package/markers/MarkerManager.android.js +12 -8
- package/package.json +2 -2
- package/platforms/ios/src/MapboxBridge.swift +4 -3
- package/typings/mapbox.bridge.ios.d.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,16 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [7.0.5](https://github.com/nativescript-community/ui-mapbox/compare/v7.0.4...v7.0.5) (2025-10-30)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @nativescript-community/ui-mapbox
|
|
9
|
+
|
|
10
|
+
## [7.0.4](https://github.com/nativescript-community/ui-mapbox/compare/v7.0.3...v7.0.4) (2025-10-30)
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
* **ios:** working marker image and other fixes ([3ec0f75](https://github.com/nativescript-community/ui-mapbox/commit/3ec0f75f72708a03cafb2a0a1cd847cea8e74206))
|
|
15
|
+
|
|
6
16
|
## [7.0.3](https://github.com/nativescript-community/ui-mapbox/compare/v7.0.2...v7.0.3) (2025-10-29)
|
|
7
17
|
|
|
8
18
|
**Note:** Version bump only for package @nativescript-community/ui-mapbox
|
package/common.js
CHANGED
|
@@ -269,18 +269,9 @@ export class MapboxViewCommonBase extends ContentView {
|
|
|
269
269
|
onStart() {
|
|
270
270
|
return this.mapbox?.onStart(this.getNativeMapView());
|
|
271
271
|
}
|
|
272
|
-
// onResume(nativeMap?: any): Promise<any> {
|
|
273
|
-
// return this.mapbox && this.mapbox.onResume(this.getNativeMapView());
|
|
274
|
-
// }
|
|
275
|
-
// onPause(nativeMap?: any): Promise<any> {
|
|
276
|
-
// return this.mapbox && this.mapbox.onPause(this.getNativeMapView());
|
|
277
|
-
// }
|
|
278
272
|
onStop(nativeMap) {
|
|
279
273
|
return this.mapbox?.onStop(this.getNativeMapView());
|
|
280
274
|
}
|
|
281
|
-
// onLowMemory(nativeMap?: any): Promise<any> {
|
|
282
|
-
// return this.mapbox.onLowMemory(this.getNativeMapView());
|
|
283
|
-
// }
|
|
284
275
|
onDestroy(nativeMap) {
|
|
285
276
|
return this.mapbox?.onDestroy(this.getNativeMapView());
|
|
286
277
|
}
|
package/index.android.d.ts
CHANGED
|
@@ -65,6 +65,7 @@ export declare class MapboxView extends MapboxViewBase {
|
|
|
65
65
|
*/
|
|
66
66
|
createNativeView(): object;
|
|
67
67
|
onLoaded(): void;
|
|
68
|
+
onUnloaded(): void;
|
|
68
69
|
initNativeView(): void;
|
|
69
70
|
/**
|
|
70
71
|
* when the view is destroyed.
|
|
@@ -160,12 +161,6 @@ export declare class Mapbox extends MapboxCommon implements MapboxApi {
|
|
|
160
161
|
*/
|
|
161
162
|
hide(): Promise<void>;
|
|
162
163
|
unhide(): Promise<void>;
|
|
163
|
-
/**
|
|
164
|
-
* destroy the map programmatically
|
|
165
|
-
*
|
|
166
|
-
* Destroy the map instance.
|
|
167
|
-
*/
|
|
168
|
-
clear(nativeMap?: any): void;
|
|
169
164
|
destroy(nativeMap?: any): Promise<void>;
|
|
170
165
|
/**
|
|
171
166
|
* Clear Event Listeners
|
package/index.android.js
CHANGED
|
@@ -174,16 +174,22 @@ export class MapboxView extends MapboxViewBase {
|
|
|
174
174
|
onLoaded() {
|
|
175
175
|
super.onLoaded();
|
|
176
176
|
if (Trace.isEnabled()) {
|
|
177
|
-
CLog(CLogTypes.info, 'onLoaded()');
|
|
177
|
+
CLog(CLogTypes.info, 'onLoaded()', this);
|
|
178
178
|
}
|
|
179
179
|
if (!this.initialized) {
|
|
180
180
|
this.initMap();
|
|
181
181
|
this.initialized = true;
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
|
+
onUnloaded() {
|
|
185
|
+
super.onUnloaded();
|
|
186
|
+
if (Trace.isEnabled()) {
|
|
187
|
+
CLog(CLogTypes.info, 'onUnloaded()', this);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
184
190
|
initNativeView() {
|
|
185
191
|
if (Trace.isEnabled()) {
|
|
186
|
-
CLog(CLogTypes.info, 'initNativeView(): top');
|
|
192
|
+
CLog(CLogTypes.info, 'initNativeView(): top', this);
|
|
187
193
|
}
|
|
188
194
|
this.nativeView.owner = this;
|
|
189
195
|
// Application.android.on(AndroidApplication.activityStartedEvent, this.onStart, this);
|
|
@@ -202,13 +208,13 @@ export class MapboxView extends MapboxViewBase {
|
|
|
202
208
|
* @link https://docs.nativescript.org/plugins/ui-plugin-custom
|
|
203
209
|
*/
|
|
204
210
|
disposeNativeView() {
|
|
211
|
+
super.disposeNativeView();
|
|
205
212
|
if (Trace.isEnabled()) {
|
|
206
|
-
CLog(CLogTypes.info, 'disposeNativeView(): top');
|
|
213
|
+
CLog(CLogTypes.info, 'disposeNativeView(): top', this);
|
|
207
214
|
}
|
|
208
215
|
this.nativeView.owner = null;
|
|
209
216
|
this.mapbox?.destroy();
|
|
210
217
|
this.mapbox = null;
|
|
211
|
-
super.disposeNativeView();
|
|
212
218
|
}
|
|
213
219
|
/**
|
|
214
220
|
* initialize the map
|
|
@@ -455,7 +461,7 @@ export class Mapbox extends MapboxCommon {
|
|
|
455
461
|
logoPlugin.setEnabled(!settings.hideLogo);
|
|
456
462
|
logoPlugin.setPosition(Mapbox.mapPositionToGravity(settings.logoPosition));
|
|
457
463
|
if (Trace.isEnabled()) {
|
|
458
|
-
CLog(CLogTypes.info, 'show(): onMapReady() with instance:', this._mapboxMapInstance);
|
|
464
|
+
CLog(CLogTypes.info, 'show(): onMapReady() with instance:', this._mapboxMapInstance, this._mapboxViewInstance);
|
|
459
465
|
}
|
|
460
466
|
// Android SDK 7.0.0 and on requires that the style be set separately after the map
|
|
461
467
|
// is initialized. We do not consider the map ready until the style has successfully
|
|
@@ -614,16 +620,11 @@ export class Mapbox extends MapboxCommon {
|
|
|
614
620
|
throw ex;
|
|
615
621
|
}
|
|
616
622
|
}
|
|
617
|
-
|
|
618
|
-
* destroy the map programmatically
|
|
619
|
-
*
|
|
620
|
-
* Destroy the map instance.
|
|
621
|
-
*/
|
|
622
|
-
clear(nativeMap) {
|
|
623
|
+
async destroy(nativeMap) {
|
|
623
624
|
this.clearEventListeners();
|
|
624
625
|
this._markerIconDownloadCache = {};
|
|
625
626
|
if (Trace.isEnabled()) {
|
|
626
|
-
CLog(CLogTypes.info, 'destroy(): destroying mapbox view.');
|
|
627
|
+
CLog(CLogTypes.info, 'destroy(): destroying mapbox view.', this.view, this._mapboxViewInstance);
|
|
627
628
|
}
|
|
628
629
|
if (this.lineManager) {
|
|
629
630
|
this.lineManager.onDestroy();
|
|
@@ -660,7 +661,7 @@ export class Mapbox extends MapboxCommon {
|
|
|
660
661
|
const viewGroup = this._mapboxViewInstance.getParent();
|
|
661
662
|
if (viewGroup !== null) {
|
|
662
663
|
if (Trace.isEnabled()) {
|
|
663
|
-
CLog(CLogTypes.info, 'destroy(): removing _mapboxViewInstance view.');
|
|
664
|
+
CLog(CLogTypes.info, 'destroy(): removing _mapboxViewInstance view.', this._mapboxViewInstance);
|
|
664
665
|
}
|
|
665
666
|
viewGroup.removeView(this._mapboxViewInstance);
|
|
666
667
|
}
|
|
@@ -673,9 +674,6 @@ export class Mapbox extends MapboxCommon {
|
|
|
673
674
|
this._mapboxMapInstance = null;
|
|
674
675
|
}
|
|
675
676
|
}
|
|
676
|
-
async destroy(nativeMap) {
|
|
677
|
-
this.clear();
|
|
678
|
-
}
|
|
679
677
|
// private enableUserLocationPlugin() {
|
|
680
678
|
// if (!this.map) {
|
|
681
679
|
// return;
|
|
@@ -794,30 +792,12 @@ export class Mapbox extends MapboxCommon {
|
|
|
794
792
|
}
|
|
795
793
|
this._mapboxViewInstance.onStart();
|
|
796
794
|
}
|
|
797
|
-
// async onResume(nativeMapViewInstance?: any) {
|
|
798
|
-
// if (Trace.isEnabled()) {
|
|
799
|
-
// CLog(CLogTypes.info, 'onResume()');
|
|
800
|
-
// }
|
|
801
|
-
// this._mapboxViewInstance.onResume();
|
|
802
|
-
// }
|
|
803
|
-
// async onPause(nativeMapViewInstance?: any) {
|
|
804
|
-
// if (Trace.isEnabled()) {
|
|
805
|
-
// CLog(CLogTypes.info, 'onPause()');
|
|
806
|
-
// }
|
|
807
|
-
// this._mapboxViewInstance.onPause();
|
|
808
|
-
// }
|
|
809
795
|
async onStop(nativeMap) {
|
|
810
796
|
if (Trace.isEnabled()) {
|
|
811
797
|
CLog(CLogTypes.info, 'onStop()');
|
|
812
798
|
}
|
|
813
799
|
this._mapboxViewInstance.onStop();
|
|
814
800
|
}
|
|
815
|
-
// async onLowMemory(nativeMap?: any) {
|
|
816
|
-
// if (Trace.isEnabled()) {
|
|
817
|
-
// CLog(CLogTypes.info, 'onLowMemory()');
|
|
818
|
-
// }
|
|
819
|
-
// this._mapboxViewInstance.onLowMemory();
|
|
820
|
-
// }
|
|
821
801
|
async onDestroy(nativeMap) {
|
|
822
802
|
if (Trace.isEnabled()) {
|
|
823
803
|
CLog(CLogTypes.info, 'onDestroy()');
|
|
@@ -2621,7 +2601,11 @@ export class Mapbox extends MapboxCommon {
|
|
|
2621
2601
|
return 'file://' + path.join(knownFolders.currentApp().path, input.replace('~/', ''));
|
|
2622
2602
|
}
|
|
2623
2603
|
else {
|
|
2624
|
-
|
|
2604
|
+
let key = Object.keys(MapStyle)[Object.values(MapStyle).indexOf(input)];
|
|
2605
|
+
// on android STREETS is defined as MAPBOX_STREETS field
|
|
2606
|
+
if (key === 'STREETS') {
|
|
2607
|
+
key = 'MAPBOX_STREETS';
|
|
2608
|
+
}
|
|
2625
2609
|
// fix because MAPBOX_STREETS and others are not exposed by the
|
|
2626
2610
|
const field = Style.class.getDeclaredField(key) || Style.class.getDeclaredField('MAPBOX_STREETS');
|
|
2627
2611
|
field.setAccessible(true);
|
package/index.d.ts
CHANGED
|
@@ -67,10 +67,7 @@ export declare class Mapbox extends MapboxCommon implements MapboxApi {
|
|
|
67
67
|
unhide(): Promise<void>;
|
|
68
68
|
destroy(nativeMap?: any): Promise<void>;
|
|
69
69
|
onStart(nativeMap?: any): Promise<void>;
|
|
70
|
-
onResume(nativeMap?: any): Promise<void>;
|
|
71
|
-
onPause(nativeMap?: any): Promise<void>;
|
|
72
70
|
onStop(nativeMap?: any): Promise<void>;
|
|
73
|
-
onLowMemory(nativeMap?: any): Promise<void>;
|
|
74
71
|
onDestroy(nativeMap?: any): Promise<void>;
|
|
75
72
|
setMapStyle(style: string | MapStyle, nativeMap?: any): Promise<void>;
|
|
76
73
|
getImage(imageId: string, nativeMap?: any): Promise<ImageSource>;
|
package/index.ios.d.ts
CHANGED
|
@@ -39,6 +39,7 @@ export declare class Mapbox extends MapboxCommon implements MapboxApi {
|
|
|
39
39
|
removeImage(imageId: string, nativeMap?: any): Promise<void>;
|
|
40
40
|
addMarkers(markers: MapboxMarker[], nativeMap?: any): Promise<void>;
|
|
41
41
|
selectedMarker: MapboxMarker;
|
|
42
|
+
isMarkerSelected(marker: MapboxMarker): boolean;
|
|
42
43
|
deselectMarker(marker: MapboxMarker): Promise<void>;
|
|
43
44
|
selectMarker(marker: MapboxMarker): Promise<void>;
|
|
44
45
|
removeMarkers(ids?: any, nativeMap?: any): Promise<void>;
|
|
@@ -104,8 +105,6 @@ export declare class Mapbox extends MapboxCommon implements MapboxApi {
|
|
|
104
105
|
y: number;
|
|
105
106
|
}, nativeMap?: any): LatLng;
|
|
106
107
|
onStart(nativeMap?: any): Promise<void>;
|
|
107
|
-
onResume(nativeMap?: any): Promise<void>;
|
|
108
|
-
onPause(nativeMap?: any): Promise<void>;
|
|
109
108
|
onStop(nativeMap?: any): Promise<void>;
|
|
110
109
|
onLowMemory(nativeMap?: any): Promise<void>;
|
|
111
110
|
onDestroy(nativeMap?: any): Promise<void>;
|
package/index.ios.js
CHANGED
|
@@ -87,7 +87,7 @@ async function fetchImageIOS(imagePath) {
|
|
|
87
87
|
if (_markerIconDownloadCache[imagePath])
|
|
88
88
|
return _markerIconDownloadCache[imagePath];
|
|
89
89
|
const img = await Http.getImage(imagePath);
|
|
90
|
-
if (img
|
|
90
|
+
if (img?.ios) {
|
|
91
91
|
_markerIconDownloadCache[imagePath] = img.ios;
|
|
92
92
|
return img.ios;
|
|
93
93
|
}
|
|
@@ -403,7 +403,7 @@ export class Mapbox extends MapboxCommon {
|
|
|
403
403
|
view.addSubview(nativeMap);
|
|
404
404
|
this.setMapboxViewInstance(nativeMap);
|
|
405
405
|
if (settings.showUserLocation) {
|
|
406
|
-
this.showUserLocationMarker({});
|
|
406
|
+
this.showUserLocationMarker({ cameraMode: 'NONE' });
|
|
407
407
|
}
|
|
408
408
|
this.initEventHandlerShim(settings, this._mapboxViewInstance);
|
|
409
409
|
if (settings.onMapReady) {
|
|
@@ -559,7 +559,7 @@ export class Mapbox extends MapboxCommon {
|
|
|
559
559
|
return m;
|
|
560
560
|
}));
|
|
561
561
|
updated.forEach((m) => {
|
|
562
|
-
if (
|
|
562
|
+
if (typeof m?.icon === 'string' && m.iconDownloaded) {
|
|
563
563
|
try {
|
|
564
564
|
b.addImage(m.icon, m.iconDownloaded);
|
|
565
565
|
delete m.iconDownloaded;
|
|
@@ -598,7 +598,8 @@ export class Mapbox extends MapboxCommon {
|
|
|
598
598
|
_marker.lng = newSettings.lng;
|
|
599
599
|
b.updateMarkerPosition(_marker.id + '', newSettings.lat, newSettings.lng);
|
|
600
600
|
}
|
|
601
|
-
if (newSettings.selected) {
|
|
601
|
+
if (newSettings.selected || this.isMarkerSelected(_marker)) {
|
|
602
|
+
// this will also update callout position
|
|
602
603
|
this.selectMarker(_marker);
|
|
603
604
|
}
|
|
604
605
|
}
|
|
@@ -615,8 +616,11 @@ export class Mapbox extends MapboxCommon {
|
|
|
615
616
|
}
|
|
616
617
|
});
|
|
617
618
|
}
|
|
619
|
+
isMarkerSelected(marker) {
|
|
620
|
+
return this.selectedMarker === marker || this.selectedMarker?.id === marker.id;
|
|
621
|
+
}
|
|
618
622
|
async deselectMarker(marker) {
|
|
619
|
-
if (this.
|
|
623
|
+
if (this.isMarkerSelected(marker)) {
|
|
620
624
|
this.hideCalloutForMarkerById(marker.id + '');
|
|
621
625
|
this.selectedMarker = null;
|
|
622
626
|
}
|
|
@@ -627,10 +631,12 @@ export class Mapbox extends MapboxCommon {
|
|
|
627
631
|
if (Trace.isEnabled()) {
|
|
628
632
|
CLog(CLogTypes.info, 'selectMarker():', marker.id);
|
|
629
633
|
}
|
|
630
|
-
if (this.selectedMarker) {
|
|
634
|
+
if (this.selectedMarker && !this.isMarkerSelected(marker)) {
|
|
631
635
|
this.deselectMarker(this.selectedMarker);
|
|
632
636
|
}
|
|
633
|
-
|
|
637
|
+
if (marker.title || marker.subtitle) {
|
|
638
|
+
await this.showCalloutForMarkerById(marker.id + '');
|
|
639
|
+
}
|
|
634
640
|
resolve();
|
|
635
641
|
}
|
|
636
642
|
catch (ex) {
|
|
@@ -1313,8 +1319,6 @@ export class Mapbox extends MapboxCommon {
|
|
|
1313
1319
|
if (Trace.isEnabled()) {
|
|
1314
1320
|
CLog(CLogTypes.info, 'createCalloutView1():', marker.id, marker.title, !!this._reusableCalloutView);
|
|
1315
1321
|
}
|
|
1316
|
-
this._reusableCalloutView.removeEventListener('tap');
|
|
1317
|
-
this._reusableCalloutView.nativeViewProtected?.removeFromSuperview();
|
|
1318
1322
|
return this._reusableCalloutView;
|
|
1319
1323
|
}
|
|
1320
1324
|
async showCalloutForMarkerById(markerId) {
|
|
@@ -1325,10 +1329,12 @@ export class Mapbox extends MapboxCommon {
|
|
|
1325
1329
|
if (Trace.isEnabled()) {
|
|
1326
1330
|
CLog(CLogTypes.info, 'showCalloutForMarkerById():', typeof markerId, markerId);
|
|
1327
1331
|
}
|
|
1332
|
+
const callout = this.createCalloutView(m);
|
|
1328
1333
|
if (this.bridgeInstance.hasViewAnnotationForMarker(markerId)) {
|
|
1329
|
-
|
|
1334
|
+
// let s Update
|
|
1335
|
+
this.bridgeInstance.removeViewAnnotationForMarker(markerId);
|
|
1336
|
+
// return;
|
|
1330
1337
|
}
|
|
1331
|
-
const callout = this.createCalloutView(m);
|
|
1332
1338
|
callout.on('tap', () => {
|
|
1333
1339
|
try {
|
|
1334
1340
|
const res = m.onCalloutTap ? m.onCalloutTap(m) : undefined;
|
|
@@ -1339,6 +1345,8 @@ export class Mapbox extends MapboxCommon {
|
|
|
1339
1345
|
console.error('callout tap handler error', e);
|
|
1340
1346
|
}
|
|
1341
1347
|
});
|
|
1348
|
+
this._reusableCalloutView.removeEventListener('tap');
|
|
1349
|
+
this._reusableCalloutView.nativeViewProtected?.removeFromSuperview();
|
|
1342
1350
|
try {
|
|
1343
1351
|
const nativeView = createUIViewAutoSizeUIViewAutoSize(callout);
|
|
1344
1352
|
if (Trace.isEnabled()) {
|
|
@@ -1373,7 +1381,7 @@ export class Mapbox extends MapboxCommon {
|
|
|
1373
1381
|
}
|
|
1374
1382
|
toggleCalloutForMarkerById(markerId) {
|
|
1375
1383
|
const m = this._markers.find((x) => `${x.id}` === markerId);
|
|
1376
|
-
if (!m || !m.id)
|
|
1384
|
+
if (!m || !m.id || (!m.title && !m.subtitle))
|
|
1377
1385
|
return;
|
|
1378
1386
|
const exists = this.bridgeInstance.hasViewAnnotationForMarker(markerId);
|
|
1379
1387
|
if (exists)
|
|
@@ -1708,12 +1716,12 @@ export class Mapbox extends MapboxCommon {
|
|
|
1708
1716
|
onStart(nativeMap) {
|
|
1709
1717
|
return Promise.resolve();
|
|
1710
1718
|
}
|
|
1711
|
-
onResume(nativeMap) {
|
|
1712
|
-
|
|
1713
|
-
}
|
|
1714
|
-
onPause(nativeMap) {
|
|
1715
|
-
|
|
1716
|
-
}
|
|
1719
|
+
// onResume(nativeMap?: any): Promise<void> {
|
|
1720
|
+
// return Promise.resolve();
|
|
1721
|
+
// }
|
|
1722
|
+
// onPause(nativeMap?: any): Promise<void> {
|
|
1723
|
+
// return Promise.resolve();
|
|
1724
|
+
// }
|
|
1717
1725
|
onStop(nativeMap) {
|
|
1718
1726
|
return Promise.resolve();
|
|
1719
1727
|
}
|
|
@@ -5,9 +5,6 @@ import { CLog, CLogTypes } from '../common';
|
|
|
5
5
|
*/
|
|
6
6
|
export class AndroidMarker {
|
|
7
7
|
constructor(opts) {
|
|
8
|
-
if (!opts.title && !opts.snippet) {
|
|
9
|
-
throw new Error('Marker should have either title or snippet!');
|
|
10
|
-
}
|
|
11
8
|
this.position = opts.position;
|
|
12
9
|
this.id = opts.id;
|
|
13
10
|
this.icon = opts.icon;
|
|
@@ -181,12 +181,14 @@ export class MarkerManager {
|
|
|
181
181
|
this.deselectMarker(this.selectedMarker);
|
|
182
182
|
}
|
|
183
183
|
this.selectedMarker = marker;
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
this.
|
|
188
|
-
|
|
189
|
-
|
|
184
|
+
if (marker.title || marker.snippet) {
|
|
185
|
+
this.prepareViewAnnotation(marker, (e) => {
|
|
186
|
+
// info Window tapped.
|
|
187
|
+
if (!this.onInfoWindowTapped(marker)) {
|
|
188
|
+
this.deselectMarker(marker);
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
}
|
|
190
192
|
}
|
|
191
193
|
deselectMarker(marker) {
|
|
192
194
|
if (!this.selectedMarker || marker.pointAnnotation !== this.selectedMarker.pointAnnotation) {
|
|
@@ -217,8 +219,10 @@ export class MarkerManager {
|
|
|
217
219
|
const gesturePlugin = this.mapView.getPlugin('MAPBOX_GESTURES_PLUGIN_ID');
|
|
218
220
|
com.mapbox.maps.plugin.gestures.GesturesUtils.removeOnMapClickListener(this.map, this.onMapClickListener);
|
|
219
221
|
this.onMapClickListener = null;
|
|
220
|
-
|
|
221
|
-
|
|
222
|
+
if (this.onViewAnnotationUpdatedListener) {
|
|
223
|
+
com.nativescript.mapbox.ViewAnnotationManager.removeOnViewAnnotationUpdatedListener(this.mapView, this.onViewAnnotationUpdatedListener);
|
|
224
|
+
this.onViewAnnotationUpdatedListener = null;
|
|
225
|
+
}
|
|
222
226
|
if (this._reusableCalloutView) {
|
|
223
227
|
this._reusableCalloutView._tearDownUI();
|
|
224
228
|
this._reusableCalloutView = null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nativescript-community/ui-mapbox",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.5",
|
|
4
4
|
"description": "Interactive, thoroughly customizable maps powered by vector tiles and OpenGL.",
|
|
5
5
|
"main": "index",
|
|
6
6
|
"typings": "index.d.ts",
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"dependencies": {
|
|
56
56
|
"@nativescript-community/perms": "^3.0.4"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "c01d8e85c69b69325909a8735828c6fd60ea9c4c"
|
|
59
59
|
}
|
|
@@ -202,7 +202,7 @@ public class MapboxBridge: NSObject {
|
|
|
202
202
|
// Register this bridge for the created MapView
|
|
203
203
|
MapboxBridge.registerBridge(self, for: mv)
|
|
204
204
|
|
|
205
|
-
addImage("default_pin",
|
|
205
|
+
addImage("default_pin", UIImage(named: "default_pin"))
|
|
206
206
|
|
|
207
207
|
if let options = optionsOpt {
|
|
208
208
|
if ((options["hideLogo"] as? Bool) == true) {
|
|
@@ -409,7 +409,7 @@ public class MapboxBridge: NSObject {
|
|
|
409
409
|
return nil
|
|
410
410
|
}
|
|
411
411
|
|
|
412
|
-
@objc public func addImage(_ imageId: String, image: UIImage?) {
|
|
412
|
+
@objc public func addImage(_ imageId: String, _ image: UIImage?) {
|
|
413
413
|
guard let mv = mapView else { return }
|
|
414
414
|
if (image != nil) {
|
|
415
415
|
imageRegistry[imageId] = image!
|
|
@@ -545,7 +545,7 @@ public class MapboxBridge: NSObject {
|
|
|
545
545
|
annotation.allowOverlapWithPuck = true
|
|
546
546
|
let image = an.image
|
|
547
547
|
let imageHeight = image?.image.size.height ?? 0
|
|
548
|
-
let offsetY = imageHeight
|
|
548
|
+
let offsetY = imageHeight/2 + 5
|
|
549
549
|
// TODO: variableAnchors is broken for now if multiple
|
|
550
550
|
annotation.variableAnchors = [ViewAnnotationAnchorConfig(anchor: .bottom, offsetY: offsetY)
|
|
551
551
|
// , ViewAnnotationAnchorConfig(anchor: .bottomLeft, offsetY: offsetY), ViewAnnotationAnchorConfig(anchor: .bottomRight, offsetY: offsetY)
|
|
@@ -559,6 +559,7 @@ public class MapboxBridge: NSObject {
|
|
|
559
559
|
@objc public func updateViewAnnotationForMarker(_ markerId: String, _ lat: Double, _ lng: Double) -> Bool {
|
|
560
560
|
guard mapView != nil else { return false }
|
|
561
561
|
guard let view = viewAnnotationByMarkerId[markerId] else { return false }
|
|
562
|
+
view.view.setNeedsLayout()
|
|
562
563
|
view.annotatedFeature = .geometry(Point(CLLocationCoordinate2D(latitude: lat, longitude: lng)))
|
|
563
564
|
return true
|
|
564
565
|
}
|
|
@@ -32,7 +32,7 @@ declare class MapboxBridge extends NSObject {
|
|
|
32
32
|
|
|
33
33
|
setStyle(styleURIOrURL: string, completion: (success: boolean, error?: any) => void): void;
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
addImage(imageId: string, image: UIImage): void;
|
|
36
36
|
removeImage(imageId: string): void;
|
|
37
37
|
|
|
38
38
|
addMarkers(markers: string): void;
|