From dca093b7c1276f9452615c1230161fa51e814383 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5kon=20Flatval?= Date: Tue, 25 Jun 2024 12:33:19 +0200 Subject: [PATCH] chore: don't reset event handlers in-between runs Currently it crashes, and I don't know how to fix this in a nice way --- documentation/docs/components/LiveCodeSnippet.tsx | 1 - documentation/docs/utils/viewerUtilities.ts | 12 ------------ 2 files changed, 13 deletions(-) diff --git a/documentation/docs/components/LiveCodeSnippet.tsx b/documentation/docs/components/LiveCodeSnippet.tsx index ed988e47b82..82d7a03e6e1 100644 --- a/documentation/docs/components/LiveCodeSnippet.tsx +++ b/documentation/docs/components/LiveCodeSnippet.tsx @@ -65,7 +65,6 @@ function transformCode(code: string): string { } if (viewer) { - resetViewerEventHandlers(viewer); if (model instanceof CogniteCadModel) { resetCogniteCadModel(model); } diff --git a/documentation/docs/utils/viewerUtilities.ts b/documentation/docs/utils/viewerUtilities.ts index 95d1d17a76e..889ef5df040 100644 --- a/documentation/docs/utils/viewerUtilities.ts +++ b/documentation/docs/utils/viewerUtilities.ts @@ -1,20 +1,8 @@ import { CogniteCadModel, - Cognite3DViewer, DefaultNodeAppearance, } from '@cognite/reveal'; -/** - * Resets all event handlers on the viewer provided. This uses - * internal functionality and actual applications needs to implement - * this to better approaches than this. - */ -export function resetViewerEventHandlers(viewer: Cognite3DViewer): void { - const eventListeners = (viewer as any)._events; - eventListeners.cameraChange.unsubscribeAll(); - eventListeners.click.unsubscribeAll(); - eventListeners.hover.unsubscribeAll(); -} /** * Resets state of model to the default state (i.e. appearance and styled sets)