Hi, is it possible to add a custom cursor on mouse hover ?
something like this?
Hi, is it possible to add a custom cursor on mouse hover ?
something like this?
Use a url
as the cursor: cursor - CSS: Cascading Style Sheets | MDN
For the community, here is the way to achieve it.
Add it in your css file.
.svg-cursor {
cursor: url('example.svg'),auto;
}
Add it into your events.
mouseEnter:(e,obj)=>{
obj.diagram?.div?.classList.add('svg-cursor');
},
mouseLeave:(e,obj)=>{
obj.diagram?.div?.classList.remove('svg-cursor');
}
@walter There is an issue if i am dragging the node then on mouse hover it’s not coming, it’s coming as normal arrow cursor.
No, it’s even simpler than that – just set the GraphObject.cursor property to "url(example.svg)"
.
Don’t bother with using CSS classes.
Nope it’s not working.
I forgot to say that you have to include a fallback cursor for when the image hasn’t yet been loaded.
new go.Node(..., { cursor: "url(example.svg), pointer", ... })