Skip to content

Commit

Permalink
fix: dagre layout for collapsed combos; perf: give layout algorithm v…
Browse files Browse the repository at this point in the history
…edges; (#4092)
  • Loading branch information
Yanyan-Wang authored Nov 25, 2022
1 parent 59d3119 commit d725a49
Show file tree
Hide file tree
Showing 12 changed files with 28 additions and 20 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# ChangeLog

### 4.7.15

- fix: dagre layout for collapsed combos;
- perf: give layout algorithm vedges;

### 4.7.14

- fix: error occurs while dragging combo with drag-node behavior;
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@antv/g6-core",
"version": "0.7.14",
"version": "0.7.15",
"description": "A Graph Visualization Framework in JavaScript",
"keywords": [
"antv",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const colorSet = {
};

export default {
version: '0.7.14',
version: '0.7.15',
rootContainerClassName: 'root-container',
nodeContainerClassName: 'node-container',
edgeContainerClassName: 'edge-container',
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/graph/controller/layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ export default abstract class LayoutController {
combos,
hiddenCombos,
comboEdges,
vedges: this.graph.get('vedges')?.map(edge => edge.getModel())
} as GraphData;
}

Expand Down
8 changes: 5 additions & 3 deletions packages/core/src/graph/graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2376,23 +2376,25 @@ export default abstract class AbstractGraph extends EventEmitter implements IAbs
const vedges: IEdge[] = self.get('vedges');
const combos: ICombo[] = self.get('combos');

let model: NodeConfig;
let model: NodeConfig | ComboConfig;

const updatedNodes: { [key: string]: boolean } = {};

const updateItems = (items) => {
each(items, (item: INode) => {
model = item.getModel() as NodeConfig;
model = item.getModel() as NodeConfig | ComboConfig;
const originAttrs = item.get('originAttrs');
if (originAttrs && model.x === originAttrs.x && model.y === originAttrs.y) {
return;
}
const changed = item.updatePosition({ x: model.x!, y: model.y! });
updatedNodes[model.id] = changed;
if (model.comboId) updatedNodes[model.comboId] = updatedNodes[model.comboId] || changed;
if (model.comboId) updatedNodes[(model as NodeConfig).comboId] = updatedNodes[(model as NodeConfig).comboId] || changed;
if (model.parentId) updatedNodes[(model as ComboConfig).parentId] = updatedNodes[(model as ComboConfig).parentId] || changed;
});
}

updateItems(combos);
updateItems(nodes);

if (combos && combos.length !== 0) {
Expand Down
4 changes: 2 additions & 2 deletions packages/element/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@antv/g6-element",
"version": "0.7.14",
"version": "0.7.15",
"description": "A Graph Visualization Framework in JavaScript",
"keywords": [
"antv",
Expand Down Expand Up @@ -61,7 +61,7 @@
},
"dependencies": {
"@antv/g-base": "^0.5.1",
"@antv/g6-core": "0.7.14",
"@antv/g6-core": "0.7.15",
"@antv/util": "~2.0.5"
},
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions packages/g6/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@antv/g6",
"version": "4.7.14",
"version": "4.7.15",
"description": "A Graph Visualization Framework in JavaScript",
"keywords": [
"antv",
Expand Down Expand Up @@ -66,7 +66,7 @@
]
},
"dependencies": {
"@antv/g6-pc": "0.7.14"
"@antv/g6-pc": "0.7.15"
},
"devDependencies": {
"@babel/core": "^7.7.7",
Expand Down
4 changes: 2 additions & 2 deletions packages/g6/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import G6 from '@antv/g6-pc';

G6.version = '4.7.14';
G6.version = '4.7.15';

export * from '@antv/g6-pc';
export default G6;
export const version = '4.7.14';
export const version = '4.7.15';
8 changes: 4 additions & 4 deletions packages/pc/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@antv/g6-pc",
"version": "0.7.14",
"version": "0.7.15",
"description": "A Graph Visualization Framework in JavaScript",
"keywords": [
"antv",
Expand Down Expand Up @@ -75,9 +75,9 @@
"@antv/g-canvas": "^0.5.2",
"@antv/g-math": "^0.1.1",
"@antv/g-svg": "^0.5.1",
"@antv/g6-core": "0.7.14",
"@antv/g6-element": "0.7.14",
"@antv/g6-plugin": "0.7.14",
"@antv/g6-core": "0.7.15",
"@antv/g6-element": "0.7.15",
"@antv/g6-plugin": "0.7.15",
"@antv/hierarchy": "^0.6.7",
"@antv/layout": "^0.3.0",
"@antv/matrix-util": "^3.1.0-beta.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/pc/src/global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const textColor = 'rgb(0, 0, 0)';
const colorSet = getColorsWithSubjectColor(subjectColor, backColor);

export default {
version: '0.7.14',
version: '0.7.15',
rootContainerClassName: 'root-container',
nodeContainerClassName: 'node-container',
edgeContainerClassName: 'edge-container',
Expand Down
6 changes: 3 additions & 3 deletions packages/plugin/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@antv/g6-plugin",
"version": "0.7.14",
"version": "0.7.15",
"description": "G6 Plugin",
"main": "lib/index.js",
"module": "es/index.js",
Expand All @@ -22,8 +22,8 @@
"@antv/g-base": "^0.5.1",
"@antv/g-canvas": "^0.5.2",
"@antv/g-svg": "^0.5.2",
"@antv/g6-core": "0.7.14",
"@antv/g6-element": "0.7.14",
"@antv/g6-core": "0.7.15",
"@antv/g6-element": "0.7.15",
"@antv/matrix-util": "^3.1.0-beta.3",
"@antv/scale": "^0.3.4",
"@antv/util": "^2.0.9",
Expand Down
2 changes: 1 addition & 1 deletion packages/site/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"name": "@antv/g6-site",
"version": "4.7.14",
"version": "4.7.15",
"description": "G6 sites deployed on gh-pages",
"keywords": [
"antv",
Expand Down

0 comments on commit d725a49

Please sign in to comment.