I’m currently working on a project where the mouse cursor for a web application is a circle with radius r where r can be changed by the user. The cursor need only appear within a specific element on the page, but that element should still be able to receive clicks from the user.
From what I can imagine, my only options are to use javascript to change the cursor image; however, that would require an image for each possible choice of r the user has.
Or I can have a canvas element follow the cursor which would draw a circle with radius r in it, however, I am not sure whether the original element would still receive clicks this way.
Any thoughts? Is there a better trick that I’m missing?
You can do that fairly easily with canvas.
Placing the element that is going to receive clicks over the canvas.
Tracking the mouse position on the top layer (the element to receive clicks) and using those mouse positions to draw on the canvas below.
Here is some code I made for you: