mapping-component-package-jp 0.0.4 → 0.0.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mapping-component-package-jp",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -61,4 +61,5 @@ export class MapOverlayManager {
61
61
  // Cleanup Methods
62
62
  destroy(): void;
63
63
  map_clear(): void;
64
+ mapListeners_clear(): void;
64
65
  }
@@ -219,7 +219,7 @@ export class MapOverlayManager {
219
219
  }
220
220
  }
221
221
 
222
- function AdvancedMarker(locations, icon, markerType = 'field') {
222
+ function AdvancedMarker(locations, icon, markerType = 'field', fitBounds) {
223
223
  if (map.getMapCapabilities().isAdvancedMarkersAvailable && locations && locations.length > 0) {
224
224
  var mapBounds = new google.maps.LatLngBounds();
225
225
  locations.forEach(function(v) {
@@ -284,7 +284,7 @@ export class MapOverlayManager {
284
284
  fmarkers.push(fmarker);
285
285
  });
286
286
 
287
- if (markerType === 'farm') {
287
+ if (markerType === 'farm' && fitBounds) {
288
288
  map.fitBounds(mapBounds);
289
289
  farms_BindMarkerEvents();
290
290
  }
@@ -535,6 +535,13 @@ export class MapOverlayManager {
535
535
  mapListeners = [];
536
536
  }
537
537
 
538
+ _this.mapListeners_clear = function() {
539
+ mapListeners.forEach(function (mapListener) {
540
+ google.maps.event.removeListener(mapListener);
541
+ });
542
+ mapListeners = [];
543
+ }
544
+
538
545
  function polyLabels_clear() {
539
546
  polyLabels.forEach(function (pl) {
540
547
  pl.setMap(null);
@@ -1890,9 +1897,9 @@ export class MapOverlayManager {
1890
1897
 
1891
1898
  }
1892
1899
 
1893
- _this.RenderRegionFarms = function (locationsJson, icon) {
1900
+ _this.RenderRegionFarms = function (locationsJson, icon, fitBounds) {
1894
1901
  if(icon){
1895
- AdvancedMarker(locationsJson, icon, 'farm');
1902
+ AdvancedMarker(locationsJson, icon, 'farm', fitBounds);
1896
1903
  }
1897
1904
  }
1898
1905
 
@@ -2101,6 +2108,7 @@ export class MapOverlayManager {
2101
2108
  var polyPath = null;
2102
2109
  var path = null;
2103
2110
  fpolies = [];
2111
+ mapListeners = [];
2104
2112
  var rbounds = new google.maps.LatLngBounds();
2105
2113
 
2106
2114
  locations.forEach(function (location) {
@@ -2154,7 +2162,7 @@ export class MapOverlayManager {
2154
2162
  }
2155
2163
  });
2156
2164
 
2157
- google.maps.event.addListenerOnce(map, "bounds_changed", function() {
2165
+ var rboundsChangedListener = google.maps.event.addListenerOnce(map, "bounds_changed", function() {
2158
2166
  eventHandlers["RegionBoundsChanged"]({
2159
2167
  type: 'SUCCESS',
2160
2168
  message: 'Region bounds changed',
@@ -2162,7 +2170,7 @@ export class MapOverlayManager {
2162
2170
  data: null
2163
2171
  });
2164
2172
  });
2165
-
2173
+ mapListeners.push(rboundsChangedListener);
2166
2174
 
2167
2175
  map.fitBounds(rbounds);
2168
2176
  regions_BindPolyEvents();