From 7e0453aafae252e98c9ec25d0191f95389e78996 Mon Sep 17 00:00:00 2001 From: Alexis Jacomy Date: Tue, 19 Nov 2024 14:25:06 +0100 Subject: [PATCH] [sigma] Fixes #getCanvases so that it returns only canvases --- packages/sigma/src/sigma.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/sigma/src/sigma.ts b/packages/sigma/src/sigma.ts index ff6adbc3a..bd0fce6e1 100644 --- a/packages/sigma/src/sigma.ts +++ b/packages/sigma/src/sigma.ts @@ -2344,9 +2344,12 @@ export default class Sigma< * - `hoverNodes` * - `mouse` * - * @return {PlainObject} - The collection of canvases. + * @return {PlainObject} - The collection of canvases. */ - getCanvases(): PlainObject { - return { ...this.elements }; + getCanvases(): PlainObject { + const res: Record = {}; + for (const layer in this.elements) + if (this.elements[layer] instanceof HTMLCanvasElement) res[layer] = this.elements[layer] as HTMLCanvasElement; + return res; } }