✨ Innovative and open-source visualization application that transforms various data formats, such as JSON, YAML, XML and CSV into interactive graphs.
improve search node algorithm
AykutSaraca029bbe73d32
diff --git a/src/containers/LiveEditor/index.tsx b/src/containers/LiveEditor/index.tsxindex 24df5334..7f671a74 100644--- a/src/containers/LiveEditor/index.tsx+++ b/src/containers/LiveEditor/index.tsx@@ -77,13 +77,21 @@ export const LiveEditor: React.FC = React.memo(() => {`span[data-key*='${settings.searchNode}' i]`);- if (wrapperRect && node) {- const newScale = 0.8;+ document+ .querySelector("foreignObject.searched")+ ?.classList.remove("searched");++ if (wrapperRect && node && node.parentElement) {+ const newScale = 1.2;const x = Number(node.getAttribute("data-x"));const y = Number(node.getAttribute("data-y"));- const newPositionX = (wrapperRect.left - x) * newScale;- const newPositionY = (wrapperRect.top - y) * newScale;+ const newPositionX = (wrapperRect.left - x) * newScale - 300;+ const newPositionY = (wrapperRect.top - y) * newScale + 300;++ node.parentElement.parentElement+ ?.closest("foreignObject")+ ?.classList.toggle("searched");wrapperRef.current?.setTransform(newPositionX, newPositionY, newScale);}