Skip to content

Commit 71e007c

Browse files
committed
Update style options sample to include styleOverrides
1 parent 225102b commit 71e007c

1 file changed

Lines changed: 34 additions & 1 deletion

File tree

‎Samples/Map/Map style options/Map style options.html‎

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,17 @@
100100
renderWorldCopies: getPropertyValue('renderWorldCopies', document.getElementById('renderWorldCopies').checked),
101101
showFeedbackLink: getPropertyValue('showFeedbackLink', document.getElementById('showFeedbackLink').checked),
102102
showLogo: getPropertyValue('showLogo', document.getElementById('showLogo').checked),
103+
showLabels: getPropertyValue('showLabels', document.getElementById('showLabels').checked),
103104
showTileBoundaries: getPropertyValue('showTileBoundaries', document.getElementById('showTileBoundaries').checked),
104105
style: getPropertyValue('style', getSelectValue('style')),
105-
light: (Object.keys(light).length > 0)? light: undefined
106+
light: (Object.keys(light).length > 0)? light: undefined,
107+
styleOverrides: (obj => Object.keys(obj).length > 0 ? obj : undefined)(Object.fromEntries([
108+
['countryRegion', { visible: document.getElementById('showCountryBorders').checked }],
109+
['adminDistrict', { visible: document.getElementById('showAdminDistrictBorders').checked }],
110+
['adminDistrict2', { visible: document.getElementById('showSecondAdminDistrictBorders').checked }],
111+
['buildingFootprint', { visible: document.getElementById('showBuildingFootprints').checked }],
112+
['roadDetails', { visible: document.getElementById('showRoadDetails').checked }]
113+
].filter(([_, v]) => !removeDefaults || !v.visible))),
106114
};
107115
}
108116

@@ -165,6 +173,7 @@
165173
width: 290px;
166174
height: 390px;
167175
overflow-y: auto;
176+
tab-size: 4;
168177
}
169178

170179
.copyBtn {
@@ -236,6 +245,30 @@
236245
<td>Show logo:</td>
237246
<td><input id="showLogo" type="checkbox" onclick="updateStyles()" checked="checked" /></td>
238247
</tr>
248+
<tr title="Specifies if the map should display labels.">
249+
<td>Show labels:</td>
250+
<td><input id="showLabels" type="checkbox" onclick="updateStyles()" checked="checked" /></td>
251+
</tr>
252+
<tr title="Specifies if the map should display country borders.">
253+
<td>Show country borders:</td>
254+
<td><input id="showCountryBorders" type="checkbox" onclick="updateStyles()" checked="checked" /></td>
255+
</tr>
256+
<tr title="Specifies if the map should display admin district borders.">
257+
<td>Show admin district borders:</td>
258+
<td><input id="showAdminDistrictBorders" type="checkbox" onclick="updateStyles()" checked="checked" /></td>
259+
</tr>
260+
<tr title="Specifies if the map should display second admin district borders.">
261+
<td>Show second admin district borders:</td>
262+
<td><input id="showSecondAdminDistrictBorders" type="checkbox" onclick="updateStyles()" checked="checked" /></td>
263+
</tr>
264+
<tr title="Specifies if the map should display building footprints.">
265+
<td>Show building footprints:</td>
266+
<td><input id="showBuildingFootprints" type="checkbox" onclick="updateStyles()" checked="checked" /></td>
267+
</tr>
268+
<tr title="Specifies if the map should display road details.">
269+
<td>Show road details:</td>
270+
<td><input id="showRoadDetails" type="checkbox" onclick="updateStyles()" checked="checked" /></td>
271+
</tr>
239272
<tr title="Specifies if the map should render an outline around each tile and the tile ID. These tile boundaries are useful for debugging. The uncompressed file size of the first vector source is drawn in the top left corner of each tile, next to the tile ID. ">
240273
<td>Show tile boundaries:</td>
241274
<td><input id="showTileBoundaries" type="checkbox" onclick="updateStyles()" /></td>

0 commit comments

Comments
 (0)