Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 659
Marin Popov Avatar asked Jun 13 '15 08:06

Marin Popov


People also ask

Can you use SVG for cursor?

The <cursor> SVG element can be used to define a platform-independent custom cursor.

How do I use my cursor on custom cursor?

In the Pointers tab of the Mouse Properties pop up, select on the cursor you want to change under Customize and then click on "Browse" on the bottom-right hand corner of the screen. 2. You will now see a slew of cursor options for you to choose from. Select the cursor that you want and Click Open.

How do I customize my cursor in CSS?

Answer: Use the CSS cursor property You can define a custom cursor using the CSS cursor property. The cursor property takes the comma-separated list of user-defined cursors value followed by the generic cursor. First of all create cursor image and save it with the extension .


1 Answers

After some tests this is working for me:

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

                e.target.hoverCursor = 'crosshair';
            }

        });
like image 102
Marin Popov Avatar answered Jan 01 '23 13:01

Marin Popov