populate canvas.targets with subtargets during mouse events

This commit is contained in:
llama 2025-07-23 17:25:45 +08:00
parent 1f3d03f7f8
commit c6c59a5e01
No known key found for this signature in database
GPG key ID: 0B7543854B9413C3

View file

@ -109,6 +109,8 @@ function initCanvas(): fabric.Canvas {
// snap rotation around 0 by +-3deg // snap rotation around 0 by +-3deg
fabric.Object.prototype.snapAngle = 360; fabric.Object.prototype.snapAngle = 360;
fabric.Object.prototype.snapThreshold = 3; fabric.Object.prototype.snapThreshold = 3;
// populate canvas.targets with subtargets during mouse events
fabric.Group.prototype.subTargetCheck = true;
// disable rotation when selecting // disable rotation when selecting
canvas.on("selection:created", () => { canvas.on("selection:created", () => {
const g = canvas.getActiveObject(); const g = canvas.getActiveObject();