Graph-Native Infrastructure for Context and Accountable AI Systems
Python agent-memoryaiai-governanceai-infrastructureartificial-intelligencecontext-engineeringcontext-graphsdata-engineeringdecision-intelligencedeveloper-toolsexplainable-aigenerative-aigraph-ragknowledge-graphllmontologyprovenancepythonreasoningsemantic-search
fix blinking and zooming problem
Zohaib Hassnainf95c1612d53d
diff --git a/explorer/src/workspaces/GraphWorkspace/SigmaSceneAdapter.tsx b/explorer/src/workspaces/GraphWorkspace/SigmaSceneAdapter.tsxindex 8eb9c5de..45a44fb9 100644--- a/explorer/src/workspaces/GraphWorkspace/SigmaSceneAdapter.tsx+++ b/explorer/src/workspaces/GraphWorkspace/SigmaSceneAdapter.tsx@@ -24,6 +24,8 @@ export const SigmaSceneAdapter = forwardRef<GraphSceneHandle, GraphSceneProps>(useImperativeHandle(ref, () => ({fitView: () => canvasRef.current?.fitView(),focusNode: (nodeId: string) => canvasRef.current?.focusNode(nodeId),+ zoomIn: () => canvasRef.current?.zoomIn(),+ zoomOut: () => canvasRef.current?.zoomOut(),getRuntime: () => runtimeRef.current,setLayoutRunning: onLayoutRunningChange? (running: boolean) => {diff --git a/explorer/src/workspaces/GraphWorkspace/behaviors/focusCameraBehavior.ts b/explorer/src/workspaces/GraphWorkspace/behaviors/focusCameraBehavior.tsindex 2e9cdfdf..d5ee9799 100644--- a/explorer/src/workspaces/GraphWorkspace/behaviors/focusCameraBehavior.ts+++ b/explorer/src/workspaces/GraphWorkspace/behaviors/focusCameraBehavior.ts@@ -5,11 +5,16 @@ export const focusCameraBehavior: GraphBehavior = {attach: () => {},detach: () => {},performAction: (context, action) => {- if (action.type !== "focusNode") {- return false;+ if (action.type === "focusNode") {+ context.focusNodeInView(action.nodeId);+ return true;}- context.focusNodeInView(action.nodeId);- return true;+ if (action.type === "centerSelection") {+ context.centerSelectionInView(action.nodeId);+ return true;+ }++ return false;},};diff --git a/explorer/src/workspaces/GraphWorkspace/behaviors/searchFocusBehavior.ts b/explorer/src/workspaces/GraphWorkspace/behaviors/searchFocusBehavior.tsindex 85ac3ea7..13bffcb6 100644--- a/explorer/src/workspaces/GraphWorkspace/behaviors/searchFocusBehavior.ts+++ b/explorer/src/workspaces/GraphWorkspace/behaviors/searchFocusBehavior.ts@@ -1,23 +1,23 @@import type { GraphBehavior } from "./types";export function createSearchFocusBehavior(): GraphBehavior {- let lastFocusedNodeId = "";+ let lastSelectedNodeId = "";return {id: "search-focus",attach: () => {},detach: () => {- lastFocusedNodeId = "";+ lastSelectedNodeId = "";},onStateChange: (context, interactionState) => {- const nextFocusedNodeId = interactionState.focusedNodeId;- if (!nextFocusedNodeId || nextFocusedNodeId === lastFocusedNodeId) {- lastFocusedNodeId = nextFocusedNodeId;+ const nextSelectedNodeId = interactionState.selectedNodeId;+ if (!nextSelectedNodeId || nextSelectedNodeId === lastSelectedNodeId) {+ lastSelectedNodeId = nextSelectedNodeId;return;}- lastFocusedNodeId = nextFocusedNodeId;- context.dispatchAction({ type: "focusNode", nodeId: nextFocusedNodeId });+ lastSelectedNodeId = nextSelectedNodeId;+ context.dispatchAction({ type: "centerSelection", nodeId: nextSelectedNodeId });},};}diff --git a/explorer/src/workspaces/GraphWorkspace/behaviors/types.ts b/explorer/src/workspaces/GraphWorkspace/behaviors/types.tsindex cbeebc06..2f34aac1 100644--- a/explorer/src/workspaces/GraphWorkspace/behaviors/types.ts+++ b/explorer/src/workspaces/GraphWorkspace/behaviors/types.ts@@ -6,7 +6,8 @@ import type { GraphCameraState, GraphInteractionState } from "../types";export type GraphBehaviorActionRequest =| { type: "fitView" }- | { type: "focusNode"; nodeId: string };+ | { type: "focusNode"; nodeId: string }+ | { type: "centerSelection"; nodeId: string };export interface GraphBehaviorContext {sigma: Sigma;@@ -17,6 +18,7 @@ export interface GraphBehaviorContext {onNodeSelectionChange: (nodeId: string) => void;onEdgeSelectionChange: (edgeId: string) => void;focusNodeInView: (nodeId: string) => void;+ centerSelectionInView: (nodeId: string) => void;fitCurrentView: () => void;dispatchAction: (action: GraphBehaviorActionRequest) => void;}diff --git a/explorer/src/workspaces/GraphWorkspace/behaviors/viewModeSwitchBehavior.ts b/explorer/src/workspaces/GraphWorkspace/behaviors/viewModeSwitchBehavior.tsindex c7d30335..d86e4a89 100644--- a/explorer/src/workspaces/GraphWorkspace/behaviors/viewModeSwitchBehavior.ts+++ b/explorer/src/workspaces/GraphWorkspace/behaviors/viewModeSwitchBehavior.ts@@ -16,9 +16,10 @@ export function createViewModeSwitchBehavior(): GraphBehavior {}lastViewMode = interactionState.viewMode;+ const nextSelectedNodeId = interactionState.selectedNodeId;- if (interactionState.focusedNodeId) {- context.dispatchAction({ type: "focusNode", nodeId: interactionState.focusedNodeId });+ if (interactionState.viewMode === "focused" && nextSelectedNodeId) {+ context.dispatchAction({ type: "focusNode", nodeId: nextSelectedNodeId });return;}