Open Infrastructure Map, a view of infrastructure data in OpenStreetMap
Use variable anchors on more labels
Russ Garrett0a39fdf7ba77
diff --git a/web/src/style/common.ts b/web/src/style/common.tsindex b8dfc19..5c177e3 100644--- a/web/src/style/common.ts+++ b/web/src/style/common.ts@@ -107,15 +107,15 @@ export function oimSymbol(options: OIMSymbolOptions): LayerSpecificationWithZInd[18, textSize]]),- 'text-anchor': 'top',+ 'text-variable-anchor': ['top', 'bottom'],// Increase the textOffset as iconSize increases. Beyond iconMaxZoom, ease the textOffset to 0,// unless the feature is a node, in which case we'll still be showing the icon.- 'text-offset': interpolate(+ 'text-radial-offset': interpolate(['zoom'],[- [options.textMinZoom, literal([0, textOffset * 0.8])],- [iconMaxZoom, literal([0, textOffset])],- [iconMaxZoom + 2, ['case', get('is_node'), literal([0, textOffset]), literal([0, 0])]]+ [options.textMinZoom, textOffset * 0.8],+ [iconMaxZoom, textOffset],+ [iconMaxZoom + 2, ['case', get('is_node'), textOffset, 0]]]),'text-optional': true,diff --git a/web/src/style/style_oim_power.ts b/web/src/style/style_oim_power.tsindex 1cf6d1d..9867969 100644--- a/web/src/style/style_oim_power.ts+++ b/web/src/style/style_oim_power.ts@@ -1025,8 +1025,8 @@ export default function layers(): LayerSpecificationWithZIndex[] {'symbol-z-order': 'source','text-field': substation_label,'text-font': font,- 'text-anchor': 'top',- 'text-offset': [0, 0.5],+ 'text-variable-anchor': ['top', 'bottom'],+ 'text-radial-offset': 0.8,'text-size': interpolate(zoom, [[8, 10],[@@ -1057,8 +1057,11 @@ export default function layers(): LayerSpecificationWithZIndex[] {]),'text-field': substation_label,'text-font': font,- 'text-anchor': 'top',- 'text-offset': [0, 1.2],+ 'text-variable-anchor': ['top', 'bottom'],+ 'text-radial-offset': interpolate(zoom, [+ [5, 1.2],+ [9, 1.6]+ ]),'text-size': interpolate(zoom, [[7, 10],[@@ -1105,11 +1108,11 @@ export default function layers(): LayerSpecificationWithZIndex[] {'text-font': font,'text-variable-anchor': ['top', 'bottom'],'text-radial-offset': interpolate(zoom, [- [7, 1.2],+ [7, 1],[13,interpolate(output, [- [0, 1.2],+ [0, 1],[1000, 1.6]])],