Skip to content

Commit 74ee442

Browse files
author
Savina Shen (Manpower Services Taiwan Co Ltd)
committed
add scale control sample
1 parent 1bb3fc3 commit 74ee442

1 file changed

Lines changed: 33 additions & 3 deletions

File tree

‎Samples/Controls/Map Navigation Control Options/Map Navigation Control Options.html‎

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@
3939
}
4040

4141
//Alternatively, use an Azure Maps key. Get an Azure Maps key at https://azure.com/maps. NOTE: The primary key should be used as the key.
42-
//authType: 'subscriptionKey',
43-
//subscriptionKey: '[YOUR_AZURE_MAPS_KEY]'
42+
// authType: 'subscriptionKey',
43+
// subscriptionKey: '[YOUR_AZURE_MAPS_KEY]'
4444
}
4545
});
4646

@@ -92,6 +92,13 @@
9292
layout: pickerLayout
9393
}));
9494

95+
//Create a scale control and add it to the map.
96+
controls.push(new atlas.control.ScaleControl({
97+
maxWidth: parseFloat(getSelectValue('scaleMaxWidth')),
98+
unit: getSelectValue('scaleUnit'),
99+
style: controlStyle
100+
}));
101+
95102
//Add controls to the map.
96103
map.controls.add(controls, {
97104
position: positionOption
@@ -106,7 +113,7 @@
106113
<style>
107114
.sidePanel {
108115
width: 350px;
109-
height: 580px;
116+
height: 640px;
110117
float: left;
111118
margin-right: 10px;
112119
}
@@ -224,6 +231,29 @@
224231
</select>
225232
</td>
226233
</tr>
234+
235+
<tr title="The maximum length of the scale control in pixels.">
236+
<td>Scale Max Width:</td>
237+
<td>
238+
<select id="scaleMaxWidth" onchange="addControls()" title="Scale Max Width">
239+
<option>50</option>
240+
<option selected="selected">100</option>
241+
<option>200</option>
242+
<option>400</option>
243+
</select>
244+
</td>
245+
</tr>
246+
247+
<tr title="The unit of the distance shown on scale control.">
248+
<td>Scale Unit:</td>
249+
<td>
250+
<select id="scaleUnit" onchange="addControls()" title="Scale Unit">
251+
<option>imperial</option>
252+
<option selected="selected">metric</option>
253+
<option>nautical</option>
254+
</select>
255+
</td>
256+
</tr>
227257
</table>
228258
</div>
229259

0 commit comments

Comments
 (0)