fix click node do not change inspector in search state
This commit is contained in:
1 parent
6eb48532a4
commit
f6b02d92c6
3 files changed
+17
-19
No files matched your search
@@ -573,12 +573,14 @@ export const Editor: FC<EditorProps> = ({ onUpdate: updateState, data: editor, .
|
||||
}
|
||||
if (names.length === 0 && editor.searchingText) {
|
||||
const matrix = editor.graphMatrix;
|
||||
const selectedId = editor.selectedId;
|
||||
onSearchChange({
|
||||
...filterOption,
|
||||
filterType: "content",
|
||||
filterStr: editor.searchingText,
|
||||
});
|
||||
editor.graphMatrix = matrix;
|
||||
selectNode(selectedId);
|
||||
restoreViewport();
|
||||
}
|
||||
};
|
||||
@@ -801,8 +803,6 @@ export const Editor: FC<EditorProps> = ({ onUpdate: updateState, data: editor, .
|
||||
|
||||
const rename = (newPath: string) => {
|
||||
editor.path = newPath;
|
||||
editor.size.width = 0;
|
||||
editor.size.height = 0;
|
||||
};
|
||||
|
||||
const save = () => {
|
||||
@@ -878,13 +878,6 @@ export const Editor: FC<EditorProps> = ({ onUpdate: updateState, data: editor, .
|
||||
}, 200);
|
||||
};
|
||||
|
||||
const destroyGraph = () => {
|
||||
if (editor.graph) {
|
||||
editor.graph.destroy();
|
||||
editor.graph = undefined!;
|
||||
}
|
||||
};
|
||||
|
||||
const createGraph = (ref: React.MutableRefObject<null>) => {
|
||||
editor.graph = new TreeGraph({
|
||||
container: ref.current!,
|
||||
@@ -1237,14 +1230,15 @@ export const Editor: FC<EditorProps> = ({ onUpdate: updateState, data: editor, .
|
||||
return;
|
||||
}
|
||||
|
||||
if (editor.size.width !== editorSize.width || editor.size.height !== editorSize.height) {
|
||||
destroyGraph();
|
||||
}
|
||||
|
||||
if (!editor.graph) {
|
||||
createGraph(graphRef);
|
||||
editor.size.width = editorSize.width;
|
||||
editor.size.height = editorSize.height;
|
||||
}
|
||||
|
||||
if (
|
||||
editor.graph.getWidth() !== editorSize.width ||
|
||||
editor.graph.getHeight() !== editorSize.height
|
||||
) {
|
||||
editor.graph.changeSize(editorSize.width, editorSize.height);
|
||||
}
|
||||
|
||||
if (editor.selectedId) {
|
||||
|
||||
@@ -355,8 +355,13 @@ const TreeInspector: FC = () => {
|
||||
<Divider orientation="left">
|
||||
<h4>{t("tree.group")}</h4>
|
||||
</Divider>
|
||||
<Form.Item name="group" style={{ marginLeft: 16 }}>
|
||||
<GroupDefItem />
|
||||
<Form.Item name="group">
|
||||
<Select
|
||||
mode="multiple"
|
||||
suffixIcon={null}
|
||||
onChange={form.submit}
|
||||
options={workspace.groupDefs.map((g) => ({ label: g, value: g }))}
|
||||
/>
|
||||
</Form.Item>
|
||||
</>
|
||||
)}
|
||||
|
||||
@@ -60,9 +60,8 @@ export class EditorStore {
|
||||
|
||||
historyStack: string[] = [];
|
||||
historyIndex: number = 0;
|
||||
selectedId?: string | null;
|
||||
selectedId: string | null = null;
|
||||
|
||||
size = { width: 0, height: 0 };
|
||||
graphMatrix?: Matrix;
|
||||
graph!: TreeGraph;
|
||||
|
||||
|
||||
Reference in new issue
Block a user