通过 containsPoint 方法坐标是否在某个元素内
const rect = new fabric.Rect({ width: 100, height: 100, fill: 'red', }) canvas.add(rect); canvas.on('mousee:down', (event) => { let point = new fabric.Point(event.e.offsetX, event.e.offsetY); console.log(rect.containsPoint(point)); })