Hi,
I have attempted to modify the compass widget (2D map view) using the 'icon' property, but unfortunately, it did not yield the expected results. Could you please provide idea how to change icon for Compass default widget? Sample code here: https://codepen.io/aonwittawat/pen/gOqoMex
<html lang="en">
<head>
<meta charset="utf-8" />
<meta
name="viewport"
content="initial-scale=1,maximum-scale=1,user-scalable=no"
/>
<title>Compass widget | Sample | ArcGIS Maps SDK for JavaScript 4.28</title>
<style>
html,
body,
#viewDiv {
padding: 0;
margin: 0;
height: 100%;
width: 100%;
}
</style>
<link
rel="stylesheet"
href="https://js.arcgis.com/4.28/esri/themes/light/main.css"
/>
<script src="https://js.arcgis.com/4.28/"></script>
<script>
require(["esri/Map", "esri/views/MapView", "esri/widgets/Compass"], (
Map,
MapView,
Compass
) => {
const map = new Map({
basemap: "streets-vector"
});
const view = new MapView({
container: "viewDiv",
scale: 500000,
center: [26.26, 39.17],
map: map
});
/********************************
* Create a compass widget object.
*********************************/
// https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Compass.html#icon
const compassWidget = new Compass({
view: view,
icon: "compass" // https://developers.arcgis.com/calcite-design-system/icons/?icon=globe&library=Calcite%20UI&query=north
});
// Add the Compass widget to the top left corner of the view
view.ui.add(compassWidget, "top-left");
});
</script>
</head>
<body>
<div id="viewDiv"></div>
</body>
</html>
Also, is there a way to use custom image for widget?
Thank you!