Skip to content

Commit

Permalink
fix: wrong style for modelRect after updating and state changing, closes
Browse files Browse the repository at this point in the history
: #2613; fix: drag-canvas with shouldBegin false, closes: #2571; fix: pack plugin with es module, closes: #2577; feat: dijkstra with multiple shortest paths, closes: #2297; fix: setMode while the delegates of brush-select and drag-node is on the canvas, closes: #2607; docs: update the english TimeBar docs, closes: #2597; fix: TimeBar time point switch text configurable, closes: #2597;
  • Loading branch information
Yanyan-Wang committed Jan 28, 2021
1 parent 0fbc33e commit e00e8da
Show file tree
Hide file tree
Showing 45 changed files with 370 additions and 62 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# ChangeLog

#### 4.1.5

- fix: wrong style for modelRect after updating and state changing, closes: #2613;
- fix: drag-canvas with shouldBegin false, closes: #2571;
- fix: pack plugin with es module, closes: #2577;
- feat: dijkstra with multiple shortest paths, closes: #2297;
- fix: setMode while the delegates of brush-select and drag-node is on the canvas, closes: #2607;
- docs: update the english TimeBar docs, closes: #2597;
- fix: TimeBar time point switch text configurable, closes: #2597;

#### 4.1.4

- fix: drag-canvas with touch on mobile;
Expand Down
2 changes: 1 addition & 1 deletion README-zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ $ npm run demos

请让我们知道您要解决或贡献什么,所以在贡献之前请先提交 [issues](https://github.com/antvis/g6/issues) 描述 bug 或建议。

成为一个贡献者前请阅读 [代码贡献规范](https://github.com/antvis/g6/blob/master/CONTRIBUTING.zh-CN.md).
成为一个贡献者前请阅读 [代码贡献规范](https://github.com/antvis/G6/blob/master/packages/g6/CONTRIBUTING.zh-CN.md).

## License

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ Users are welcome to join the **G6 Communication Group** or **G6 Communication G

Please let us know what you are you going to help. Do check out [issues](https://github.com/antvis/g6/issues) for bug reports or suggestions first.

To become a contributor, please follow our [contributing guide](https://github.com/antvis/g6/blob/master/CONTRIBUTING.md).
To become a contributor, please follow our [contributing guide](https://github.com/antvis/G6/blob/master/packages/g6/CONTRIBUTING.md).

## License

Expand Down
9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,15 @@
"typescript": "^3.5.3"
},
"devDependencies": {
"@umijs/fabric": "^2.3.1",
"pre-commit": "^1.2.2",
"@types/react": "^16.9.35",
"@types/react-dom": "^16.9.8",
"@umijs/fabric": "^2.3.1",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-react": "^7.22.0",
"eslint-plugin-react-hooks": "^4.2.0",
"eslint-plugin-unicorn": "^27.0.0",
"pre-commit": "^1.2.2",
"react-scripts": "3.1.2"
},
"resolutions": {
Expand Down
13 changes: 11 additions & 2 deletions packages/core/README-zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,17 @@ graph.render();
```bash
$ npm install

# run bootstrap to link the packages
$ npm run bootstrap

# build all the packages
$ npm run build:all

# run test case
$ npm test
$ npm run test

# run lint
$ npm run lint

# run test case in watch mode
npm test -- --watch ./tests/unit/algorithm/find-path-spec
Expand Down Expand Up @@ -149,7 +158,7 @@ $ npm run demos

请让我们知道您要解决或贡献什么,所以在贡献之前请先提交 [issues](https://github.com/antvis/g6/issues) 描述 bug 或建议。

成为一个贡献者前请阅读 [代码贡献规范](https://github.com/antvis/g6/blob/master/CONTRIBUTING.zh-CN.md).
成为一个贡献者前请阅读 [代码贡献规范](https://github.com/antvis/G6/blob/master/packages/g6/CONTRIBUTING.zh-CN.md).

## License

Expand Down
13 changes: 11 additions & 2 deletions packages/core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,17 @@ For more information of the usage, please refer to [Getting Started](https://ant
```bash
$ npm install

# run bootstrap to link the packages
$ npm run bootstrap

# build all the packages
$ npm run build:all

# run test case
$ npm test
$ npm run test

# run lint
$ npm run lint

# run test case in watch mode
npm test -- --watch ./tests/unit/algorithm/find-path-spec
Expand Down Expand Up @@ -145,7 +154,7 @@ Users are welcome to join the **G6 Communication Group** or **G6 Communication G

Please let us know what you are you going to help. Do check out [issues](https://github.com/antvis/g6/issues) for bug reports or suggestions first.

To become a contributor, please follow our [contributing guide](https://github.com/antvis/g6/blob/master/CONTRIBUTING.md).
To become a contributor, please follow our [contributing guide](https://github.com/antvis/G6/blob/master/packages/g6/CONTRIBUTING.md).

## License

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.0.7",
"version": "0.0.8",
"description": "A Graph Visualization Framework in JavaScript",
"keywords": [
"antv",
Expand Down
8 changes: 4 additions & 4 deletions packages/core/src/element/shapeBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { IPoint, Item, LabelStyle, ShapeStyle, ModelConfig, EdgeConfig } from '.
import Global from '../global';
import { ext } from '@antv/matrix-util';
import { deepMix, each, mix, isBoolean, isPlainObject, clone } from '@antv/util';
import { cloneBesidesImg } from '../util/graphic';

const transform = ext.transform;

Expand Down Expand Up @@ -401,11 +402,11 @@ export const shapeBase: ShapeOptions = {
}
} else {
// 所有生效的 state 的样式
const enableStatesStyle = clone(item.getCurrentStatesStyle());
const enableStatesStyle = cloneBesidesImg(item.getCurrentStatesStyle());

const model = item.getModel();
// 原始样式
const originStyle = mix({}, model.style, clone(item.getOriginStyle()));
const originStyle = mix({}, model.style, cloneBesidesImg(item.getOriginStyle()));

const keyShapeName = shape.get('name');

Expand All @@ -416,7 +417,7 @@ export const shapeBase: ShapeOptions = {
Object.keys(shapeAttrs).forEach((key) => {
if (key === 'img') return;
const attr = shapeAttrs[key];
if (typeof attr === 'object') {
if (attr && typeof attr === 'object') {
keyShapeStyles[key] = clone(attr);
} else {
keyShapeStyles[key] = attr;
Expand Down Expand Up @@ -466,7 +467,6 @@ export const shapeBase: ShapeOptions = {
} else {
filtetDisableStatesStyle[keyShapeName] = keyShapeStyles;
}

for (const key in enableStatesStyle) {
if (keptAttrs[key]) continue;
const enableStyle = enableStatesStyle[key];
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.0.7',
version: '0.0.8',
rootContainerClassName: 'root-container',
nodeContainerClassName: 'node-container',
edgeContainerClassName: 'edge-container',
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/graph/controller/mode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ export default class ModeController {
graph.emit('beforemodechange', { mode });

each(this.currentBehaves, behave => {
if (behave.delegate) behave.delegate.remove();
behave.unbind(graph);
});

Expand Down
6 changes: 4 additions & 2 deletions packages/core/src/item/item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,10 @@ export default class ItemBase implements IItemBase {
if (keyShapeStyle.matrix) delete keyShapeStyle.matrix;
if (!keyShapeName) {
Object.assign(originStyles, keyShapeStyle);
} else {
originStyles[keyShapeName] = keyShapeStyle;
} else { // 若 keyShape 有 name 且 !name,这个图形不是 keyShape,给这个图形一个 name
const shapeName = uniqueId('shape');
child.set('name', shapeName);
originStyles[shapeName] = shapeType !== 'image' ? clone(child.attr()) : self.getShapeStyleByName(name);
}
}
});
Expand Down
21 changes: 20 additions & 1 deletion packages/core/src/util/graphic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
} from '../types';
import { applyMatrix } from './math';
import letterAspectRatio from './letterAspectRatio';
import { isString, clone, isNumber } from '@antv/util';
import { isString, clone, isNumber, isObject } from '@antv/util';
import { IAbstractGraph } from '../interface/graph';

const { PI, sin, cos } = Math;
Expand Down Expand Up @@ -648,3 +648,22 @@ export const shouldRefreshEdge = (cfg) => {
isNumber(cfg.style.ry);
return refreshEdge;
};

export const cloneBesidesImg = (obj) => {
const clonedObj = {};
Object.keys(obj).forEach(key1 => {
const obj2 = obj[key1];
if (isObject(obj2)) {
const clonedObj2 = {};
Object.keys(obj2).forEach(key2 => {
const v = obj2[key2];
if(key2 === 'img' && !isString(v)) return;
clonedObj2[key2] = clone(v);
})
clonedObj[key1] = clonedObj2;
} else {
clonedObj[key1] = clone(obj2);
}
});
return clonedObj;
}
13 changes: 11 additions & 2 deletions packages/element/README-zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,17 @@ graph.render();
```bash
$ npm install

# run bootstrap to link the packages
$ npm run bootstrap

# build all the packages
$ npm run build:all

# run test case
$ npm test
$ npm run test

# run lint
$ npm run lint

# run test case in watch mode
npm test -- --watch ./tests/unit/algorithm/find-path-spec
Expand Down Expand Up @@ -149,7 +158,7 @@ $ npm run demos

请让我们知道您要解决或贡献什么,所以在贡献之前请先提交 [issues](https://github.com/antvis/g6/issues) 描述 bug 或建议。

成为一个贡献者前请阅读 [代码贡献规范](https://github.com/antvis/g6/blob/master/CONTRIBUTING.zh-CN.md).
成为一个贡献者前请阅读 [代码贡献规范](https://github.com/antvis/G6/blob/master/packages/g6/CONTRIBUTING.zh-CN.md).

## License

Expand Down
13 changes: 11 additions & 2 deletions packages/element/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,17 @@ For more information of the usage, please refer to [Getting Started](https://ant
```bash
$ npm install

# run bootstrap to link the packages
$ npm run bootstrap

# build all the packages
$ npm run build:all

# run test case
$ npm test
$ npm run test

# run lint
$ npm run lint

# run test case in watch mode
npm test -- --watch ./tests/unit/algorithm/find-path-spec
Expand Down Expand Up @@ -145,7 +154,7 @@ Users are welcome to join the **G6 Communication Group** or **G6 Communication G

Please let us know what you are you going to help. Do check out [issues](https://github.com/antvis/g6/issues) for bug reports or suggestions first.

To become a contributor, please follow our [contributing guide](https://github.com/antvis/g6/blob/master/CONTRIBUTING.md).
To become a contributor, please follow our [contributing guide](https://github.com/antvis/G6/blob/master/packages/g6/CONTRIBUTING.md).

## License

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.0.6",
"version": "0.0.7",
"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.0.7",
"@antv/g6-core": "*",
"@antv/util": "~2.0.5"
},
"devDependencies": {
Expand Down
2 changes: 2 additions & 0 deletions packages/element/src/nodes/modelRect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,8 @@ registerNode(
y: 7,
text: cfg.label,
},
className: 'text-shape',
name: 'text-shape',
draggable: true,
});
}
Expand Down
13 changes: 11 additions & 2 deletions packages/g6/README-zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,17 @@ graph.render();
```bash
$ npm install

# run bootstrap to link the packages
$ npm run bootstrap

# build all the packages
$ npm run build:all

# run test case
$ npm test
$ npm run test

# run lint
$ npm run lint

# run test case in watch mode
npm test -- --watch ./tests/unit/algorithm/find-path-spec
Expand Down Expand Up @@ -149,7 +158,7 @@ $ npm run demos

请让我们知道您要解决或贡献什么,所以在贡献之前请先提交 [issues](https://github.com/antvis/g6/issues) 描述 bug 或建议。

成为一个贡献者前请阅读 [代码贡献规范](https://github.com/antvis/g6/blob/master/CONTRIBUTING.zh-CN.md).
成为一个贡献者前请阅读 [代码贡献规范](https://github.com/antvis/G6/blob/master/packages/g6/CONTRIBUTING.zh-CN.md).

## License

Expand Down
13 changes: 11 additions & 2 deletions packages/g6/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,17 @@ For more information of the usage, please refer to [Getting Started](https://ant
```bash
$ npm install

# run bootstrap to link the packages
$ npm run bootstrap

# build all the packages
$ npm run build:all

# run test case
$ npm test
$ npm run test

# run lint
$ npm run lint

# run test case in watch mode
npm test -- --watch ./tests/unit/algorithm/find-path-spec
Expand Down Expand Up @@ -145,7 +154,7 @@ Users are welcome to join the **G6 Communication Group** or **G6 Communication G

Please let us know what you are you going to help. Do check out [issues](https://github.com/antvis/g6/issues) for bug reports or suggestions first.

To become a contributor, please follow our [contributing guide](https://github.com/antvis/g6/blob/master/CONTRIBUTING.md).
To become a contributor, please follow our [contributing guide](https://github.com/antvis/G6/blob/master/packages/g6/CONTRIBUTING.md).

## License

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.1.4",
"version": "4.1.5",
"description": "A Graph Visualization Framework in JavaScript",
"keywords": [
"antv",
Expand Down Expand Up @@ -66,7 +66,7 @@
]
},
"dependencies": {
"@antv/g6-pc": "^0.0.8"
"@antv/g6-pc": "*"
},
"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.1.4';
G6.version = '4.1.5';

export * from '@antv/g6-pc';
export default G6;
export const version = '4.1.4';
export const version = '4.1.5';
Loading

0 comments on commit e00e8da

Please sign in to comment.