fix: computeSnap throws when ctx.otherLayers is not an array (#1716)

This commit is contained in:
Afonso Coutinho
2026-06-03 05:34:25 +01:00
committed by GitHub
parent 319ba50a44
commit 55c7a4a546
2 changed files with 46 additions and 1 deletions
+2 -1
View File
@@ -37,7 +37,8 @@ export function computeSnap(layer, nx, ny, ctx) {
{ y: ch, label: 'canvas-b' },
{ y: ch / 2, label: 'canvas-cy' },
];
for (const other of ctx.otherLayers) {
const otherLayers = Array.isArray(ctx.otherLayers) ? ctx.otherLayers : [];
for (const other of otherLayers) {
if (!other.visible || other.id === layer.id) continue;
const o = other.offset || { x: 0, y: 0 };
const ow = other.canvas.width, oh = other.canvas.height;