Skip to content

Commit

Permalink
Tree View now doesn't respect node coordinates from the backend (coor…
Browse files Browse the repository at this point in the history
…dinates now start fresh and clean from cosmos, in the center of the canvas). This is ok because saving tree view coordinates isn't possible in the backend yet.
  • Loading branch information
Nyckoka committed Jul 3, 2023
1 parent c85a83b commit 9a2f095
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,16 @@ export function useGraph(projectId: string, datasetId: string, treeViewId: strin

const config = {
...defaultConfig,
nodeSize: graphRef.current ? graphTransformationsConfig.nodeSize : (data.transformations.nodeSize || defaultConfig.nodeSize),
linkWidth: graphRef.current ? graphTransformationsConfig.linkWidth : (data.transformations.linkWidth || defaultConfig.linkWidth),
nodeSize: graphRef.current ? graphTransformationsConfig.nodeSize : (data.transformations?.nodeSize || defaultConfig.nodeSize),
linkWidth: graphRef.current ? graphTransformationsConfig.linkWidth : (data.transformations?.linkWidth || defaultConfig.linkWidth),
simulation: {
linkSpring: graphRef.current ? simulationConfig.linkSpring : (data.transformations.linkSpring || defaultConfig.simulation?.linkSpring),
linkDistance: graphRef.current ? simulationConfig.linkDistance : (data.transformations.linkDistance || defaultConfig.simulation?.linkDistance),
gravity: graphRef.current ? simulationConfig.gravity : (data.transformations.gravity || defaultConfig.simulation?.gravity),
repulsion: graphRef.current ? simulationConfig.repulsion : (data.transformations.repulsion || defaultConfig.simulation?.repulsion),
friction: graphRef.current ? simulationConfig.friction : (data.transformations.friction || defaultConfig.simulation?.friction),
repulsionTheta: graphRef.current ? simulationConfig.repulsionTheta : (data.transformations.repulsionTheta || defaultConfig.simulation?.repulsionTheta),
decay: graphRef.current ? simulationConfig.decay : (data.transformations.decay || defaultConfig.simulation?.decay)
linkSpring: graphRef.current ? simulationConfig.linkSpring : (data.transformations?.linkSpring || defaultConfig.simulation?.linkSpring),
linkDistance: graphRef.current ? simulationConfig.linkDistance : (data.transformations?.linkDistance || defaultConfig.simulation?.linkDistance),
gravity: graphRef.current ? simulationConfig.gravity : (data.transformations?.gravity || defaultConfig.simulation?.gravity),
repulsion: graphRef.current ? simulationConfig.repulsion : (data.transformations?.repulsion || defaultConfig.simulation?.repulsion),
friction: graphRef.current ? simulationConfig.friction : (data.transformations?.friction || defaultConfig.simulation?.friction),
repulsionTheta: graphRef.current ? simulationConfig.repulsionTheta : (data.transformations?.repulsionTheta || defaultConfig.simulation?.repulsionTheta),
decay: graphRef.current ? simulationConfig.decay : (data.transformations?.decay || defaultConfig.simulation?.decay)
}
}
//
Expand Down Expand Up @@ -123,8 +123,8 @@ export function useGraph(projectId: string, datasetId: string, treeViewId: strin
const nodes = graph.nodes.map(node => {
return {
id: node.st,
x: node.coordinates[0],
y: node.coordinates[1],
//x: node.coordinates[0],
//y: node.coordinates[1],
}
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export interface GetTreeViewOutputModel {
nodesTotalCount: number
edges: Edge[]
edgesTotalCount: number
transformations: Transformations
transformations: Transformations | undefined
}

export interface Edge {
Expand Down

0 comments on commit 9a2f095

Please sign in to comment.