@foodmarketmaker/mapag 0.0.11 → 0.0.12
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.
|
@@ -14973,8 +14973,9 @@ class WatershedMapper {
|
|
|
14973
14973
|
map.setPaintProperty(this.LINE_LAYER_ID, 'line-color', settings.borderColor);
|
|
14974
14974
|
map.setPaintProperty(this.LINE_LAYER_ID, 'line-width', settings.borderWidth);
|
|
14975
14975
|
map.setPaintProperty(this.LINE_LAYER_ID, 'line-opacity', settings.borderOpacity);
|
|
14976
|
-
|
|
14977
|
-
map.
|
|
14976
|
+
const watershedLabelVisible = settings.visible && settings.labelsVisible;
|
|
14977
|
+
map.setLayoutProperty(this.LABEL_LAYER_ID, 'visibility', watershedLabelVisible ? 'visible' : 'none');
|
|
14978
|
+
// map.setPaintProperty(this.LABEL_LAYER_ID, 'text-size', settings.labelsSize);
|
|
14978
14979
|
map.setPaintProperty(this.LABEL_LAYER_ID, 'text-color', settings.labelsColor);
|
|
14979
14980
|
map.setPaintProperty(this.LABEL_LAYER_ID, 'text-halo-color', settings.labelsHaloColor);
|
|
14980
14981
|
map.setPaintProperty(this.LABEL_LAYER_ID, 'text-halo-width', settings.labelsHaloWidth);
|
|
@@ -15039,11 +15040,43 @@ class WatershedMapper {
|
|
|
15039
15040
|
layout: {
|
|
15040
15041
|
'text-field': ['get', 'name'],
|
|
15041
15042
|
},
|
|
15043
|
+
paint: {
|
|
15044
|
+
'text-color': this.settings().labelsColor,
|
|
15045
|
+
'text-halo-color': this.settings().labelsHaloColor,
|
|
15046
|
+
'text-halo-width': this.settings().labelsHaloWidth,
|
|
15047
|
+
// 'text-size': this.settings().labelsSize,
|
|
15048
|
+
},
|
|
15042
15049
|
}, StandardLayersMapper.POLYGONS_BACKGROUND);
|
|
15043
15050
|
this._update(this.settings());
|
|
15044
15051
|
if (!addedFill) {
|
|
15045
15052
|
return;
|
|
15046
15053
|
}
|
|
15054
|
+
map.on('zoomend', () => {
|
|
15055
|
+
if (!this.settings().visible) {
|
|
15056
|
+
return;
|
|
15057
|
+
}
|
|
15058
|
+
const zoom = map.getZoom();
|
|
15059
|
+
if (this.settings().autoSelectLayer) {
|
|
15060
|
+
if (zoom >= 0 && zoom < 5 && this.currentHU !== 'HUC2') {
|
|
15061
|
+
this.update({ hydrologicUnit: 'HUC2' });
|
|
15062
|
+
}
|
|
15063
|
+
else if (zoom >= 5 && zoom < 7 && this.currentHU !== 'HUC4') {
|
|
15064
|
+
this.update({ hydrologicUnit: 'HUC4' });
|
|
15065
|
+
}
|
|
15066
|
+
else if (zoom >= 7 && zoom < 9 && this.currentHU !== 'HUC6') {
|
|
15067
|
+
this.update({ hydrologicUnit: 'HUC6' });
|
|
15068
|
+
}
|
|
15069
|
+
else if (zoom >= 9 && zoom < 11 && this.currentHU !== 'HUC8') {
|
|
15070
|
+
this.update({ hydrologicUnit: 'HUC8' });
|
|
15071
|
+
}
|
|
15072
|
+
else if (zoom >= 11 && zoom < 13 && this.currentHU !== 'HUC10') {
|
|
15073
|
+
this.update({ hydrologicUnit: 'HUC10' });
|
|
15074
|
+
}
|
|
15075
|
+
else if (zoom >= 13 && this.currentHU !== 'HUC12') {
|
|
15076
|
+
this.update({ hydrologicUnit: 'HUC12' });
|
|
15077
|
+
}
|
|
15078
|
+
}
|
|
15079
|
+
});
|
|
15047
15080
|
map.on('mousemove', this.FILL_LAYER_ID, (e) => {
|
|
15048
15081
|
this.over.set(e.features && e.features.length > 0 ? e.features[0] : null);
|
|
15049
15082
|
});
|
|
@@ -15106,6 +15139,7 @@ class WatershedSettings {
|
|
|
15106
15139
|
labelsColor = '#000000';
|
|
15107
15140
|
labelsHaloColor = '#ffffff';
|
|
15108
15141
|
labelsHaloWidth = 1;
|
|
15142
|
+
autoSelectLayer = false;
|
|
15109
15143
|
}
|
|
15110
15144
|
|
|
15111
15145
|
class HttpBoundaryLoader {
|