close on room leave

This commit is contained in:
dank074 2021-11-02 18:47:37 -05:00
parent ee060670dc
commit 96e83fdd31

View File

@ -1,8 +1,8 @@
import { FloorHeightMapEvent, NitroPoint, RoomVisualizationSettingsEvent, UpdateFloorPropertiesMessageComposer } from '@nitrots/nitro-renderer'; import { FloorHeightMapEvent, NitroPoint, RoomEngineEvent, RoomVisualizationSettingsEvent, UpdateFloorPropertiesMessageComposer } from '@nitrots/nitro-renderer';
import { FC, useCallback, useEffect, useState } from 'react'; import { FC, useCallback, useEffect, useState } from 'react';
import { LocalizeText } from '../../api'; import { LocalizeText } from '../../api';
import { FloorplanEditorEvent } from '../../events/floorplan-editor/FloorplanEditorEvent'; import { FloorplanEditorEvent } from '../../events/floorplan-editor/FloorplanEditorEvent';
import { CreateMessageHook, SendMessageHook, useUiEvent } from '../../hooks'; import { CreateMessageHook, SendMessageHook, useRoomEngineEvent, useUiEvent } from '../../hooks';
import { NitroCardContentView, NitroCardHeaderView, NitroCardView, NitroLayoutFlex, NitroLayoutGrid, NitroLayoutGridColumn } from '../../layout'; import { NitroCardContentView, NitroCardHeaderView, NitroCardView, NitroLayoutFlex, NitroLayoutGrid, NitroLayoutGridColumn } from '../../layout';
import { FloorplanEditor } from './common/FloorplanEditor'; import { FloorplanEditor } from './common/FloorplanEditor';
import { convertNumbersForSaving, convertSettingToNumber } from './common/Utils'; import { convertNumbersForSaving, convertSettingToNumber } from './common/Utils';
@ -50,6 +50,13 @@ export const FloorplanEditorView: FC<{}> = props =>
FloorplanEditor.instance.initialize(); FloorplanEditor.instance.initialize();
}, []); }, []);
const onRoomEngineEvent = useCallback((event: RoomEngineEvent) =>
{
setIsVisible(false);
}, []);
useRoomEngineEvent(RoomEngineEvent.DISPOSED, onRoomEngineEvent);
const onFloorHeightMapEvent = useCallback((event: FloorHeightMapEvent) => const onFloorHeightMapEvent = useCallback((event: FloorHeightMapEvent) =>
{ {
const parser = event.getParser(); const parser = event.getParser();