Skip to content

Commit

Permalink
dom changes on select
Browse files Browse the repository at this point in the history
  • Loading branch information
aexol committed Feb 5, 2024
1 parent c05d8cb commit 7548541
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
3 changes: 0 additions & 3 deletions packages/editor/src/shared/hooks/useDomManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ export const useDomManagerTs = (parent: "focus" | "all") => {
DOMNavigationNode.addClassByFn("active", (e) => {
const htmlElem = e as HTMLDivElement;
const m = htmlElem.dataset.id === nodeId;
if (m) {
htmlElem.scrollIntoView({ behavior: "smooth", block: "center" });
}
return m;
});
DOMGraphConnection.addClassByFn("active", (e) => {
Expand Down
12 changes: 5 additions & 7 deletions packages/editor/src/state/containers/trees/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,10 +206,10 @@ const useTreesStateContainer = createContainer(() => {
.map((a) => a.name);
const nodesRelatedToActiveInterface =
activeNode &&
activeNode.data.type === TypeDefinition.InterfaceTypeDefinition
activeNode.data.type === TypeDefinition.InterfaceTypeDefinition
? allNodes.nodes
.filter((node) => node.interfaces.includes(activeNode.name))
.map((a) => a.name)
.filter((node) => node.interfaces.includes(activeNode.name))
.map((a) => a.name)
: [];
const notBaseTypes = activeNode?.args
.map((a) => getTypeName(a.type.fieldType))
Expand Down Expand Up @@ -241,10 +241,8 @@ const useTreesStateContainer = createContainer(() => {
nodeId !== selectedNodeId?.value?.id ||
_selectedNodeId?.justCreated !== selectedNodeId?.justCreated
) {
setTimeout(() => {
DOMEvents.selectNode.trigger(nodeId);
return _setSelectedNodeId(_selectedNodeId);
}, 250);
DOMEvents.selectNode.trigger(nodeId);
return _setSelectedNodeId(_selectedNodeId);
}
},
[_setSelectedNodeId, allNodes, selectedNodeId?.value?.id, focusMode]
Expand Down

0 comments on commit 7548541

Please sign in to comment.