Skip to content

Commit

Permalink
chore: update versions (#3590)
Browse files Browse the repository at this point in the history
* chore: update versions

* chore: refine

* fix: position animate considers origin attrs (#3584)

* enhancement: add types for graph event names (#3566)

* save progress; add types for graph event names

* make changes per feedback

Co-authored-by: clifford <[email protected]>

* test: add node label test cases (#3577)

Co-authored-by: daichaofan <[email protected]>

Co-authored-by: Nikhil <[email protected]>
Co-authored-by: Clifford Fajardo <[email protected]>
Co-authored-by: clifford <[email protected]>
Co-authored-by: daichaofan <[email protected]>
Co-authored-by: daichaofan <[email protected]>
  • Loading branch information
6 people authored Mar 25, 2022
1 parent 156037e commit e0ab79d
Show file tree
Hide file tree
Showing 17 changed files with 311 additions and 224 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# ChangeLog

#### 4.6.4

- chore: improve the types of graph events;
- fix: position animate considers origin attributes;


#### 4.6.3

- feat: shouldDeselect param for lasso-select;
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.6.3",
"version": "0.6.4",
"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.6.3',
version: '0.6.4',
rootContainerClassName: 'root-container',
nodeContainerClassName: 'node-container',
edgeContainerClassName: 'edge-container',
Expand Down
16 changes: 10 additions & 6 deletions packages/core/src/graph/graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import {
IG6GraphEvent,
IPoint,
FitViewRules,
G6Event,
} from '../types';
import { lerp, move } from '../util/math';
import { dataValidation, singleDataValidation } from '../util/validation';
Expand Down Expand Up @@ -2152,12 +2153,15 @@ export default abstract class AbstractGraph extends EventEmitter implements IAbs

let containerMatrix = node.getContainer().getMatrix();

if (originAttrs === undefined) {
if (originAttrs === undefined || originAttrs === null) {
// 变换前存在位置,设置到 originAttrs 上。否则标记 0 表示变换前不存在位置,不需要计算动画
node.set('originAttrs', containerMatrix ? {
x: containerMatrix[6],
y: containerMatrix[7],
} : 0);
if (containerMatrix) {
originAttrs = {
x: containerMatrix[6],
y: containerMatrix[7],
}
}
node.set('originAttrs', originAttrs || 0);
}

if (onFrame) {
Expand Down Expand Up @@ -3005,7 +3009,7 @@ export default abstract class AbstractGraph extends EventEmitter implements IAbs
/**
* 重新定义监听函数,复写参数类型
*/
public on<T = IG6GraphEvent>(eventName: string, callback: (e: T) => void, once?: boolean): this {
public on<T = IG6GraphEvent>(eventName: G6Event, callback: (e: T) => void, once?: boolean): this {
return super.on(eventName, callback, once);
}

Expand Down
7 changes: 7 additions & 0 deletions packages/core/src/interface/graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,13 @@ export interface IAbstractGraph extends EventEmitter {
* 重新定义监听函数,复写参数类型
*/
on: <T = IG6GraphEvent>(eventName: string, callback: (e: T) => void, once?: boolean) => this;

/**
* 移除指定的監聽函數
*/
off: <T = IG6GraphEvent>(eventName: string, callback: (e: T) => void, once?: boolean) => this;


/**
* 销毁画布
*/
Expand Down
Loading

0 comments on commit e0ab79d

Please sign in to comment.