From d0145cc0eddf30c749345de64eaadd7ddb45ed16 Mon Sep 17 00:00:00 2001 From: Bill Date: Wed, 16 Mar 2022 05:38:15 -0400 Subject: [PATCH] Add rotate & state click on room previewer --- src/common/layout/LayoutRoomPreviewerView.tsx | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/common/layout/LayoutRoomPreviewerView.tsx b/src/common/layout/LayoutRoomPreviewerView.tsx index a7722c73..ff2caeb6 100644 --- a/src/common/layout/LayoutRoomPreviewerView.tsx +++ b/src/common/layout/LayoutRoomPreviewerView.tsx @@ -1,5 +1,5 @@ import { ColorConverter, IRoomRenderingCanvas, RoomPreviewer, TextureUtils } from '@nitrots/nitro-renderer'; -import { FC, useCallback, useEffect, useRef, useState } from 'react'; +import { FC, MouseEvent, useCallback, useEffect, useRef, useState } from 'react'; import { GetNitroInstance } from '../../api'; export interface LayoutRoomPreviewerViewProps @@ -14,6 +14,20 @@ export const LayoutRoomPreviewerView: FC = props = const [ renderingCanvas, setRenderingCanvas ] = useState(null); const elementRef = useRef(); + const onClick = (event: MouseEvent) => + { + if(!roomPreviewer) return; + + if(event.shiftKey) + { + roomPreviewer.changeRoomObjectDirection(); + } + else + { + roomPreviewer.changeRoomObjectState(); + } + } + const update = useCallback((time: number) => { if(!roomPreviewer || !renderingCanvas || !elementRef.current) return; @@ -83,7 +97,7 @@ export const LayoutRoomPreviewerView: FC = props = return (
-
+
{ props.children }
);