Search code examples
fabricjsmouse-cursor

How can i set a custom cursor for fabric object?


This is not Drawing Mode.

I want according to some condition to be able to change the cursor when I am over some element. Something like

$('#canvasID').css('cursor','pointer');

but this is not working for me. Do you know some property from their library?


Solution

  • After some tests this is working for me:

            canvas.observe('mouse:over', function (e) {
                if (e.target.get('type') == 'line') {
    
                    e.target.hoverCursor = 'crosshair';
                }
    
            });