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) {
|
if (names.length === 0 && editor.searchingText) {
|
||||||
const matrix = editor.graphMatrix;
|
const matrix = editor.graphMatrix;
|
||||||
|
const selectedId = editor.selectedId;
|
||||||
onSearchChange({
|
onSearchChange({
|
||||||
...filterOption,
|
...filterOption,
|
||||||
filterType: "content",
|
filterType: "content",
|
||||||
filterStr: editor.searchingText,
|
filterStr: editor.searchingText,
|
||||||
});
|
});
|
||||||
editor.graphMatrix = matrix;
|
editor.graphMatrix = matrix;
|
||||||
|
selectNode(selectedId);
|
||||||
restoreViewport();
|
restoreViewport();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -801,8 +803,6 @@ export const Editor: FC<EditorProps> = ({ onUpdate: updateState, data: editor, .
|
|||||||
|
|
||||||
const rename = (newPath: string) => {
|
const rename = (newPath: string) => {
|
||||||
editor.path = newPath;
|
editor.path = newPath;
|
||||||
editor.size.width = 0;
|
|
||||||
editor.size.height = 0;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const save = () => {
|
const save = () => {
|
||||||
@@ -878,13 +878,6 @@ export const Editor: FC<EditorProps> = ({ onUpdate: updateState, data: editor, .
|
|||||||
}, 200);
|
}, 200);
|
||||||
};
|
};
|
||||||
|
|
||||||
const destroyGraph = () => {
|
|
||||||
if (editor.graph) {
|
|
||||||
editor.graph.destroy();
|
|
||||||
editor.graph = undefined!;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const createGraph = (ref: React.MutableRefObject<null>) => {
|
const createGraph = (ref: React.MutableRefObject<null>) => {
|
||||||
editor.graph = new TreeGraph({
|
editor.graph = new TreeGraph({
|
||||||
container: ref.current!,
|
container: ref.current!,
|
||||||
@@ -1237,14 +1230,15 @@ export const Editor: FC<EditorProps> = ({ onUpdate: updateState, data: editor, .
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (editor.size.width !== editorSize.width || editor.size.height !== editorSize.height) {
|
|
||||||
destroyGraph();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!editor.graph) {
|
if (!editor.graph) {
|
||||||
createGraph(graphRef);
|
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) {
|
if (editor.selectedId) {
|
||||||
|
|||||||
@@ -355,8 +355,13 @@ const TreeInspector: FC = () => {
|
|||||||
<Divider orientation="left">
|
<Divider orientation="left">
|
||||||
<h4>{t("tree.group")}</h4>
|
<h4>{t("tree.group")}</h4>
|
||||||
</Divider>
|
</Divider>
|
||||||
<Form.Item name="group" style={{ marginLeft: 16 }}>
|
<Form.Item name="group">
|
||||||
<GroupDefItem />
|
<Select
|
||||||
|
mode="multiple"
|
||||||
|
suffixIcon={null}
|
||||||
|
onChange={form.submit}
|
||||||
|
options={workspace.groupDefs.map((g) => ({ label: g, value: g }))}
|
||||||
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -60,9 +60,8 @@ export class EditorStore {
|
|||||||
|
|
||||||
historyStack: string[] = [];
|
historyStack: string[] = [];
|
||||||
historyIndex: number = 0;
|
historyIndex: number = 0;
|
||||||
selectedId?: string | null;
|
selectedId: string | null = null;
|
||||||
|
|
||||||
size = { width: 0, height: 0 };
|
|
||||||
graphMatrix?: Matrix;
|
graphMatrix?: Matrix;
|
||||||
graph!: TreeGraph;
|
graph!: TreeGraph;
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user