Skip to content

Commit

Permalink
chore: don't reset event handlers in-between runs
Browse files Browse the repository at this point in the history
Currently it crashes, and I don't know how to fix this in a nice way
  • Loading branch information
haakonflatval-cognite committed Jun 25, 2024
1 parent 52ebb7e commit dca093b
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 13 deletions.
1 change: 0 additions & 1 deletion documentation/docs/components/LiveCodeSnippet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ function transformCode(code: string): string {
}
if (viewer) {
resetViewerEventHandlers(viewer);
if (model instanceof CogniteCadModel) {
resetCogniteCadModel(model);
}
Expand Down
12 changes: 0 additions & 12 deletions documentation/docs/utils/viewerUtilities.ts
Original file line number Diff line number Diff line change
@@ -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)
Expand Down

0 comments on commit dca093b

Please sign in to comment.