Skip to content

Commit

Permalink
4.7.10 (#4017)
Browse files Browse the repository at this point in the history
* perf: force layout with animation using graph refreshPositions instead positionsAnimate;

* perf: force layout with animation calls graph refreshPositions instead positionsAnimate while refreshing;
  • Loading branch information
Yanyan-Wang authored Oct 27, 2022
1 parent 55fee1e commit d6d9a1f
Show file tree
Hide file tree
Showing 13 changed files with 31 additions and 22 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# ChangeLog

### 4.7.10

- perf: force layout with animation calls graph refreshPositions instead positionsAnimate while refreshing;

### 4.7.9

- perf: init node positions when the node has no x and y in the origin data;
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.9",
"version": "0.7.10",
"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.9',
version: '0.7.10',
rootContainerClassName: 'root-container',
nodeContainerClassName: 'node-container',
edgeContainerClassName: 'edge-container',
Expand Down
8 changes: 6 additions & 2 deletions packages/core/src/graph/controller/layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { isFunction, groupBy } from '@antv/util';
import { isNaN, calculationItemsBBox } from '../../util/base';
import { GraphData } from '../../types';
import { IAbstractGraph } from '../../interface/graph';
import { isForce } from '../../util/layout';

export default abstract class LayoutController {
public graph: IAbstractGraph;
Expand Down Expand Up @@ -72,9 +73,12 @@ export default abstract class LayoutController {

// 绘制
public refreshLayout() {
const { graph, layoutType } = this;
const { graph, layoutType, layoutCfg = {} } = this;
if (!graph) return;
if (graph.get('animate')) {
const { animate } = layoutCfg;
const isDefaultAnimateLayout = animate === undefined && (layoutType === 'force' || layoutType === 'force2');
const forceAnimate = isForce(layoutType) && (animate || isDefaultAnimateLayout);
if (graph.get('animate') && !forceAnimate) {
graph.positionsAnimate(layoutType === 'comboCombined');
} else {
graph.refreshPositions(layoutType === 'comboCombined');
Expand Down
3 changes: 2 additions & 1 deletion packages/core/src/util/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ import * as GraphicUtil from './graphic';
import * as PathUtil from './path';
import * as BaseUtil from './base';
import * as ColorUtil from './color';
import * as LayoutUtil from './layout';
import { ext, mat3 } from '@antv/matrix-util';

const transform = ext.transform;

const Util = { ...BaseUtil, ...GraphicUtil, ...PathUtil, ...MathUtil, ...ColorUtil, transform, mat3 };
const Util = { ...BaseUtil, ...GraphicUtil, ...PathUtil, ...MathUtil, ...ColorUtil, ...LayoutUtil, transform, mat3 };
export default Util;
1 change: 1 addition & 0 deletions packages/core/src/util/layout.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const isForce = (layoutType) => layoutType === 'force' || layoutType === 'g6force' || layoutType === 'gForce' || layoutType === 'force2';
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.9",
"version": "0.7.10",
"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.9",
"@antv/g6-core": "0.7.10",
"@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.9",
"version": "4.7.10",
"description": "A Graph Visualization Framework in JavaScript",
"keywords": [
"antv",
Expand Down Expand Up @@ -66,7 +66,7 @@
]
},
"dependencies": {
"@antv/g6-pc": "0.7.9"
"@antv/g6-pc": "0.7.10"
},
"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.9';
G6.version = '4.7.10';

export * from '@antv/g6-pc';
export default G6;
export const version = '4.7.9';
export const version = '4.7.10';
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.9",
"version": "0.7.10",
"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.9",
"@antv/g6-element": "0.7.9",
"@antv/g6-plugin": "0.7.9",
"@antv/g6-core": "0.7.10",
"@antv/g6-element": "0.7.10",
"@antv/g6-plugin": "0.7.10",
"@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.9',
version: '0.7.10',
rootContainerClassName: 'root-container',
nodeContainerClassName: 'node-container',
edgeContainerClassName: 'edge-container',
Expand Down
5 changes: 2 additions & 3 deletions packages/pc/src/graph/controller/layout.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AbstractLayout } from '@antv/g6-core';
import { AbstractLayout, Util } from '@antv/g6-core';
import { Layout } from '../../layout';
import { LayoutWorker } from '../../layout/worker/layout';
import { LAYOUT_MESSAGE } from '../../layout/worker/layoutConst';
Expand Down Expand Up @@ -129,8 +129,7 @@ export default class LayoutController extends AbstractLayout {
}
}

const isForce = layoutType === 'force' || layoutType === 'g6force' || layoutType === 'gForce' || layoutType === 'force2';
if (isForce) {
if (Util.isForce(layoutType)) {
const { onTick, animate } = layoutCfg;
const isDefaultAnimateLayout = animate === undefined && (layoutType === 'force' || layoutType === 'force2');
const tick = () => {
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.9",
"version": "0.7.10",
"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.9",
"@antv/g6-element": "0.7.9",
"@antv/g6-core": "0.7.10",
"@antv/g6-element": "0.7.10",
"@antv/matrix-util": "^3.1.0-beta.3",
"@antv/scale": "^0.3.4",
"@antv/util": "^2.0.9",
Expand Down

0 comments on commit d6d9a1f

Please sign in to comment.