mirror of
https://github.com/duckietm/Nitro-V3.git
synced 2026-06-20 07:26:19 +00:00
feat(wired-ui): expand advanced wired editors
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { GetSessionDataManager } from '@nitrots/nitro-renderer';
|
||||
import { GetRoomEngine, GetSessionDataManager } from '@nitrots/nitro-renderer';
|
||||
import { CSSProperties, FC, PropsWithChildren, ReactNode, useEffect, useState } from 'react';
|
||||
import { LocalizeText, WiredFurniType, WiredSelectionVisualizer } from '../../../api';
|
||||
import { Button, NitroCardContentView, NitroCardHeaderView, NitroCardView, Text } from '../../../common';
|
||||
@@ -24,8 +24,15 @@ export const WiredBaseView: FC<PropsWithChildren<WiredBaseViewProps>> = props =>
|
||||
const [ needsSave, setNeedsSave ] = useState<boolean>(false);
|
||||
const { trigger = null, setTrigger = null, setIntParams = null, setStringParam = null, setFurniIds = null, setAllowsFurni = null, saveWired = null } = useWired();
|
||||
|
||||
const clearRoomAreaSelection = () =>
|
||||
{
|
||||
GetRoomEngine().areaSelectionManager.clearHighlight();
|
||||
GetRoomEngine().areaSelectionManager.deactivate();
|
||||
};
|
||||
|
||||
const onClose = () =>
|
||||
{
|
||||
clearRoomAreaSelection();
|
||||
WiredSelectionVisualizer.clearAllSelectionShaders();
|
||||
setTrigger(null);
|
||||
};
|
||||
@@ -92,6 +99,11 @@ export const WiredBaseView: FC<PropsWithChildren<WiredBaseViewProps>> = props =>
|
||||
}
|
||||
}, [ trigger, hasSpecialInput, setIntParams, setStringParam, setFurniIds ]);
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
return () => clearRoomAreaSelection();
|
||||
}, []);
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
if(!trigger) return;
|
||||
@@ -99,8 +111,16 @@ export const WiredBaseView: FC<PropsWithChildren<WiredBaseViewProps>> = props =>
|
||||
setAllowsFurni(requiresFurni);
|
||||
}, [ trigger, requiresFurni, setAllowsFurni ]);
|
||||
|
||||
const resolvedCardStyle: CSSProperties = { ...cardStyle };
|
||||
|
||||
if(resolvedCardStyle.width !== undefined)
|
||||
{
|
||||
resolvedCardStyle.minWidth = resolvedCardStyle.width;
|
||||
delete resolvedCardStyle.width;
|
||||
}
|
||||
|
||||
return (
|
||||
<NitroCardView className="nitro-wired" theme="primary-slim" uniqueKey="nitro-wired" style={ cardStyle }>
|
||||
<NitroCardView className="nitro-wired" theme="primary-slim" uniqueKey="nitro-wired" isResizable={ false } style={ resolvedCardStyle }>
|
||||
<NitroCardHeaderView headerText={ LocalizeText('wiredfurni.title') } onCloseClick={ onClose } />
|
||||
<NitroCardContentView>
|
||||
<div className="flex flex-col gap-1">
|
||||
|
||||
Reference in New Issue
Block a user