mirror of
https://gitee.com/antv/g6.git
synced 2024-12-15 01:51:00 +08:00
commit
e48a41ac1d
21
CHANGELOG.md
21
CHANGELOG.md
@ -2,7 +2,20 @@
|
||||
|
||||
---
|
||||
|
||||
## v2.0.0
|
||||
#### 2.0.2 (2018-06-13)
|
||||
|
||||
##### New Features
|
||||
|
||||
* chore(plugin): require g6 by src/index
|
||||
* chore(dev test): remove useless test script
|
||||
|
||||
##### Bug Fixes
|
||||
|
||||
* fix(plugin) minimap destroy Closes #308
|
||||
* fix(saveImage) saveImage bug
|
||||
* fix(event): fix dom coord. Closes #305
|
||||
|
||||
## v2.0.1
|
||||
|
||||
`2018-06-11`
|
||||
|
||||
@ -20,12 +33,6 @@
|
||||
|
||||
## v1.2.1
|
||||
|
||||
`2018-04-15`
|
||||
|
||||
* feat: 新增 layout 接口
|
||||
|
||||
## v1.2.1
|
||||
|
||||
`2018-03-15`
|
||||
|
||||
* feat: 新增 layout 接口
|
||||
|
@ -13,8 +13,7 @@
|
||||
<script src="../build/g6.js"></script>
|
||||
<script src="../build/templateMaxSpanningForest.js"></script>
|
||||
<script>
|
||||
const Plugin = window.TemplateMaxSpanningForest;
|
||||
const plugin = new Plugin();
|
||||
const plugin = new G6.Plugins['template.maxSpanningForest']();
|
||||
const data = {
|
||||
nodes: [
|
||||
{
|
||||
|
@ -16,8 +16,7 @@
|
||||
<script src="../build/g6.js"></script>
|
||||
<script src="../build/toolMinimap.js"></script>
|
||||
<script>
|
||||
const Plugin = window.ToolMinimap;
|
||||
const plugin = new Plugin({
|
||||
const plugin = new G6.Plugins['tool.minimap']({
|
||||
container: 'minimap',
|
||||
width: 180,
|
||||
height: 120
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@antv/g6",
|
||||
"version": "2.0.1-beta.1",
|
||||
"version": "2.0.1",
|
||||
"description": "graph visualization frame work",
|
||||
"main": "lib/index.js",
|
||||
"browser": "build/g6.js",
|
||||
@ -98,10 +98,7 @@
|
||||
"screenshot": "node ./bin/screenshot.js",
|
||||
"start": "npm run dev",
|
||||
"test": "torch --compile --renderer --recursive ./test/unit",
|
||||
"test-all": "npm run test && npm run test-cases",
|
||||
"test-cases": "torch --compile --renderer --recursive ./test/cases",
|
||||
"test-cases-live": "torch --compile --interactive --watch --recursive ./test/cases",
|
||||
"test-live": "torch --compile --interactive --watch --recursive ./test/unit",
|
||||
"test-live": "torch --compile --interactive --watch --recursive ./test/bugs/issue-308-spec.js",
|
||||
"watch": "webpack --config webpack-dev.config.js",
|
||||
"win-dev": "node ./bin/win-dev.js"
|
||||
},
|
||||
|
@ -2,7 +2,7 @@
|
||||
* @fileOverview 拓展分析交互
|
||||
* @author huangtonger@aliyun.com
|
||||
*/
|
||||
const G6 = require('@antv/g6');
|
||||
const G6 = require('../../src/index');
|
||||
|
||||
function panCanvas(graph, button = 'left') {
|
||||
let lastPoint;
|
||||
|
@ -4,7 +4,7 @@
|
||||
* cpd control point distance detail {number} could be 0 ~ 1
|
||||
* @author huangtonger@aliyun.com
|
||||
*/
|
||||
const G6 = require('@antv/g6');
|
||||
const G6 = require('../../src/index');
|
||||
const Util = G6.Util;
|
||||
|
||||
G6.registerEdge('quadraticCurve', {
|
||||
|
@ -3,7 +3,7 @@
|
||||
* @author huangtonger@aliyun.com
|
||||
*/
|
||||
|
||||
const G6 = require('@antv/g6');
|
||||
const G6 = require('../../src/index');
|
||||
const Layout = require('./layout');
|
||||
|
||||
G6.Layouts.ArchimeddeanSpiral = Layout;
|
||||
|
@ -3,7 +3,7 @@
|
||||
* https://zh.wikipedia.org/wiki/%E9%98%BF%E5%9F%BA%E7%B1%B3%E5%BE%B7%E8%9E%BA%E7%BA%BF
|
||||
* @author huangtonger@aliyun.com
|
||||
*/
|
||||
const G6 = require('@antv/g6');
|
||||
const G6 = require('../../src/index');
|
||||
const Util = G6.Util;
|
||||
|
||||
class Layout {
|
||||
|
@ -3,7 +3,7 @@
|
||||
* @author huangtonger@aliyun.com
|
||||
*/
|
||||
|
||||
const G6 = require('@antv/g6');
|
||||
const G6 = require('../../src/index');
|
||||
const Layout = require('./layout');
|
||||
|
||||
G6.Layouts.Circle = Layout;
|
||||
|
@ -2,7 +2,7 @@
|
||||
* @fileOverview 圆形布局
|
||||
* @author huangtonger@aliyun.com
|
||||
*/
|
||||
const G6 = require('@antv/g6');
|
||||
const G6 = require('../../src/index');
|
||||
const Util = G6.Util;
|
||||
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
* @fileOverview DAG 分层布局
|
||||
* @author huangtonger@aliyun.com
|
||||
*/
|
||||
const G6 = require('@antv/g6');
|
||||
const G6 = require('../../src/index');
|
||||
const Layout = require('./layout');
|
||||
|
||||
G6.Layouts.Dagre = Layout;
|
||||
|
@ -3,7 +3,7 @@
|
||||
* dagre layout wiki: https://github.com/cpettitt/dagre/wiki
|
||||
* @author huangtonger@aliyun.com
|
||||
*/
|
||||
const G6 = require('@antv/g6');
|
||||
const G6 = require('../../src/index');
|
||||
const dagre = require('dagre');
|
||||
const { Util } = G6;
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
* @fileOverview 栅格布局
|
||||
* @author huangtonger@aliyun.com
|
||||
*/
|
||||
const G6 = require('@antv/g6');
|
||||
const G6 = require('../../src/index');
|
||||
const Layout = require('./layout');
|
||||
|
||||
G6.Layouts.Grid = Layout;
|
||||
|
@ -2,7 +2,7 @@
|
||||
* @fileOverview 栅格布局
|
||||
* @author huangtonger@aliyun.com
|
||||
*/
|
||||
const G6 = require('@antv/g6');
|
||||
const G6 = require('../../src/index');
|
||||
const Util = G6.Util;
|
||||
|
||||
class Layout {
|
||||
|
@ -10,7 +10,7 @@
|
||||
* node.rank 分层权重
|
||||
* node.label 节点标签
|
||||
*/
|
||||
const G6 = require('@antv/g6');
|
||||
const G6 = require('../../src/index');
|
||||
const maxSpanningForest = require('./maxSpanningForest');
|
||||
const d3 = require('d3');
|
||||
const { forceSimulation, forceLink, forceManyBody, forceCenter, forceCollide } = d3;
|
||||
|
@ -2,7 +2,7 @@
|
||||
* @fileOverview 最大生成森林
|
||||
* @author huangtonger@aliyun.com
|
||||
*/
|
||||
const G6 = require('@antv/g6');
|
||||
const G6 = require('../../src/index');
|
||||
const { Util } = G6;
|
||||
const maxSpanningTree = require('./maxSpanningTree');
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
* https://zh.wikipedia.org/wiki/%E6%99%AE%E6%9E%97%E5%A7%86%E7%AE%97%E6%B3%95
|
||||
* @author huangtonger@aliyun.com
|
||||
*/
|
||||
const G6 = require('@antv/g6');
|
||||
const G6 = require('../../src/index');
|
||||
const { Util } = G6;
|
||||
|
||||
let treeNodes = [];
|
||||
|
@ -4,7 +4,7 @@
|
||||
* d3-legend https://github.com/susielu/d3-legend
|
||||
* @author huangtonger@aliyun.com
|
||||
*/
|
||||
const G6 = require('@antv/g6');
|
||||
const G6 = require('../../src/index');
|
||||
const d3 = require('d3');
|
||||
const Util = G6.Util;
|
||||
const DEFAULT_LEGEND_FILL = '#199CFB';
|
||||
|
@ -2,7 +2,7 @@
|
||||
* @fileOverview 缩略图
|
||||
* @author huangtonger@aliyun.com
|
||||
*/
|
||||
const G6 = require('@antv/g6');
|
||||
const G6 = require('../../src/index');
|
||||
const Minimap = require('./minimap');
|
||||
|
||||
class Plugin {
|
||||
@ -34,6 +34,10 @@ class Plugin {
|
||||
this.renderViewPort = () => {
|
||||
minimap.renderViewPort();
|
||||
};
|
||||
this.minimap = minimap;
|
||||
}
|
||||
destroy() {
|
||||
this.minimap.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
* @fileOverview minimap
|
||||
* @author huangtonger@aliyun.com
|
||||
*/
|
||||
const G6 = require('@antv/g6');
|
||||
const G6 = require('../../src/index');
|
||||
const { Util, G } = G6;
|
||||
const Canvas = G.Canvas;
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
* @fileOverview 模拟数据生成的工具
|
||||
* @author huangtonger@aliyun.com
|
||||
*/
|
||||
const G6 = require('@antv/g6');
|
||||
const G6 = require('../../src/index');
|
||||
const Util = G6.Util;
|
||||
const randomData = {
|
||||
// 生成链式图数据
|
||||
|
@ -292,13 +292,14 @@ class Controller extends Base {
|
||||
const point = this._parsePoint(canvasPoint.x, canvasPoint.y);
|
||||
const shape = canvas.getShape(canvasPoint.x, canvasPoint.y);
|
||||
const item = graph.getItemByShape(shape);
|
||||
const pixelRatio = canvas.get('pixelRatio');
|
||||
return {
|
||||
item,
|
||||
shape,
|
||||
x: point.x,
|
||||
y: point.y,
|
||||
domX: ev.offsetX,
|
||||
domY: ev.offsetY,
|
||||
domX: canvasPoint.x / pixelRatio,
|
||||
domY: canvasPoint.y / pixelRatio,
|
||||
domEvent: ev
|
||||
};
|
||||
}
|
||||
|
@ -787,12 +787,11 @@ class Graph extends Base {
|
||||
* @return {object} canvas dom
|
||||
*/
|
||||
saveImage() {
|
||||
const graph = this.getGraph();
|
||||
const box = this.getBBox();
|
||||
const padding = this.getFitViewPadding();
|
||||
|
||||
return Util.graph2Canvas({
|
||||
graph,
|
||||
graph: this,
|
||||
width: box.width + padding[1] + padding[3],
|
||||
height: box.height + padding[0] + padding[2]
|
||||
});
|
||||
|
@ -1 +1 @@
|
||||
module.exports = '2.0.1-beta.1';
|
||||
module.exports = '2.0.1';
|
||||
|
58
test/bugs/issue-308-spec.js
Normal file
58
test/bugs/issue-308-spec.js
Normal file
@ -0,0 +1,58 @@
|
||||
const G6 = require('../../src/index');
|
||||
const expect = require('chai').expect;
|
||||
|
||||
describe('issue-308-spec', () => {
|
||||
const div = G6.Util.createDOM(`
|
||||
<div>
|
||||
<div id="mountNode"></div>
|
||||
<div id="minimap"></div>
|
||||
</div>
|
||||
`);
|
||||
require('../../plugins/index');
|
||||
document.body.appendChild(div);
|
||||
const plugin = new G6.Plugins['tool.minimap']({
|
||||
container: 'minimap',
|
||||
width: 180,
|
||||
height: 120
|
||||
});
|
||||
const data = {
|
||||
nodes: [{
|
||||
id: 'node0',
|
||||
x: -100,
|
||||
y: 200
|
||||
}, {
|
||||
id: 'node1',
|
||||
x: 100,
|
||||
y: 200
|
||||
}, {
|
||||
id: 'node2',
|
||||
x: 300,
|
||||
y: 200
|
||||
}, {
|
||||
id: 'node3',
|
||||
x: 600,
|
||||
y: 200
|
||||
}],
|
||||
edges: [{
|
||||
target: 'node0',
|
||||
source: 'node1'
|
||||
}, {
|
||||
target: 'node2',
|
||||
source: 'node1'
|
||||
}, {
|
||||
target: 'node2',
|
||||
source: 'node3'
|
||||
}]
|
||||
};
|
||||
const graph = new G6.Graph({
|
||||
container: 'mountNode',
|
||||
fitView: 'cc',
|
||||
height: window.innerHeight,
|
||||
plugins: [ plugin ]
|
||||
});
|
||||
graph.read(data);
|
||||
it('test minimap has been destroy when graph destroy', () => {
|
||||
graph.destroy();
|
||||
expect(document.getElementById('minimap').innerHTML).eql('');
|
||||
});
|
||||
});
|
@ -353,6 +353,10 @@ describe('graph test', () => {
|
||||
it('reRender', () => {
|
||||
graph.reRender();
|
||||
});
|
||||
it('saveImage', () => {
|
||||
const imageCanvas = graph.saveImage();
|
||||
expect(imageCanvas.tagName).eql('CANVAS');
|
||||
});
|
||||
it('destroy', () => {
|
||||
graph.destroy();
|
||||
expect(div.childNodes.length).equal(0);
|
||||
|
@ -27,7 +27,8 @@ module.exports = {
|
||||
path: resolve(__dirname, 'build/')
|
||||
},
|
||||
externals: {
|
||||
'@antv/g6': 'G6'
|
||||
'@antv/g6': 'G6',
|
||||
'../../src/index': 'G6'
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
|
Loading…
Reference in New Issue
Block a user