Skip to content

Commit

Permalink
remove adding new quantity (#752)
Browse files Browse the repository at this point in the history
  • Loading branch information
ostatni5 committed Feb 9, 2023
1 parent 1281cc4 commit e80a8a0
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,32 @@ import { Editor } from '../../../../js/Editor';
import { LabelPropertyField, TextPropertyField } from '../fields/PropertyField';
import { useSmartWatchEditorState } from '../../../../util/hooks/signals';
import { PropertiesCategory } from './PropertiesCategory';
import { isBeam } from '../../../../util/Beam';

export function ObjectInfo(props: { editor: Editor; object: Object3D }) {
const { object, editor } = props;

const { state: watchedObject } = useSmartWatchEditorState(editor, object);

const visibleFlag = !isBeam(watchedObject);

return (
<PropertiesCategory category='Information'>
<LabelPropertyField label='ID' value={watchedObject.id.toString()} />
<LabelPropertyField label='Type' value={watchedObject.type} />
<TextPropertyField
label='Name'
value={watchedObject.name}
onChange={value => {
editor.execute(new SetValueCommand(editor, watchedObject.object, 'name', value));
}}
/>
<PropertiesCategory category='Information' visible={visibleFlag}>
{visibleFlag && (
<>
<LabelPropertyField label='ID' value={watchedObject.id.toString()} />
<LabelPropertyField label='Type' value={watchedObject.type} />
<TextPropertyField
label='Name'
value={watchedObject.name}
onChange={value => {
editor.execute(
new SetValueCommand(editor, watchedObject.object, 'name', value)
);
}}
/>
</>
)}
</PropertiesCategory>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export function PropertiesCategory(props: {
const { category, children, visible = true } = props;

return (
<Accordion key={category} sx={{ display: visible ? '' : 'none' }}>
<Accordion square key={category} sx={{ display: visible ? '' : 'none' }}>
<AccordionSummary expandIcon={<ExpandMoreIcon />}>
<Typography>{category}</Typography>
</AccordionSummary>
Expand Down
15 changes: 9 additions & 6 deletions src/ThreeEditor/components/Sidebar/tabs/EditorSidebarTabTree.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import {
AccordionSummaryProps,
styled,
Divider,
Stack
Stack,
AccordionProps
} from '@mui/material';
import { ReactElement } from 'react';
import { Object3D } from 'three';
Expand Down Expand Up @@ -47,11 +48,13 @@ const AccordionDetails = styled(MuiAccordionDetails)(({ theme }) => ({
paddingTop: 0
}));

const Accordion = styled(MuiAccordion)(({ theme }) => ({
'&.Mui-expanded': {
margin: '0'
}
}));
const Accordion = styled((props: AccordionProps) => <MuiAccordion square {...props} />)(
({ theme }) => ({
'&.Mui-expanded': {
margin: '0'
}
})
);

interface TreeElement {
title: string;
Expand Down

0 comments on commit e80a8a0

Please sign in to comment.