I have a problem that I would like to add a circular mask on top of the HTML5 canvas editable fabric.js . A similar problem is described in this article:
Create an image mask with an HTML 5 canvas
My problem is that when I add this layer on top of the fabric.js canvas, then my canvas is no longer editable inside this transparent circle. This means that the top element (mask) captures the click / drag event, but I would like to move the elements below this mask element. Looking for ideas on how to get around this problem.
You can use the built-in mask support in the fabric.
Here is an example of creating a circular mask at 100/100 with a radius of 200:
var canvas = new fabric.Canvas('...'); // ... canvas.clipTo = function (ctx) { ctx.arc(100, 100, 200, 0, Math.PI*2, true); };
Source: https://habr.com/ru/post/1383347/More articles:Creating a multidimensional array with PHP and MySQL - phpHibernate exception in open sessions. How can I debug this? - javaCoordinates for dot fonts in Javascript - javascriptCall Javascript function from HTML - javascriptSort by value in Hadoop from file - javaModal irregular shape on iPad - iosCan I send an int using serialPort in C #? - c #Multiple GPUs with Cuda Thrust? - gpuThe easiest way to convert keycodes to strings representing keys? - javascriptconstructor call or function-style in C ++ - c ++All Articles