Hello, I have this mark in a globe, it's just a circle, and I would like to change the cursor to pointer when hovering it. Can you help me?
Solved! Go to Solution.
Hi there,
You can do something like the following where I am checking if the mouse is over the polyline.
view.on("pointer-move", eventHandler);
function eventHandler(event) {
// only include graphics from graphicslayer in the hitTest
const opts = {
include: graphicsLayer
};
view.hitTest(event, opts).then((result)=>{
if (result.results.length > 0) {
result.results.forEach((r)=>{
if (r.graphic.geometry.type === "polyline"){
document.body.style.cursor = "pointer";
}
});
} else {
document.body.style.cursor = "auto";
}
});
}
Hi there,
You can do something like the following where I am checking if the mouse is over the polyline.
view.on("pointer-move", eventHandler);
function eventHandler(event) {
// only include graphics from graphicslayer in the hitTest
const opts = {
include: graphicsLayer
};
view.hitTest(event, opts).then((result)=>{
if (result.results.length > 0) {
result.results.forEach((r)=>{
if (r.graphic.geometry.type === "polyline"){
document.body.style.cursor = "pointer";
}
});
} else {
document.body.style.cursor = "auto";
}
});
}
It worked, but without opts object. Thanks!
I'm using pointGaphic as SimpleMarkerSymbol now. I tried to add SimpleMarkerSymbol or anything related to this in opts object and didn't work, so I deleted it and now it works.
Hi there,
Glad you got it working. Please feel free to mark this issue as resolved.