chore(graph): revert default item style

This commit is contained in:
yilin.qyl 2019-03-01 15:24:06 +08:00
parent 279f3c5fdf
commit 828025f206
4 changed files with 3 additions and 27 deletions

View File

@ -108,25 +108,7 @@ class Graph extends EventEmitter {
* 边直接连接到节点的中心不再考虑锚点
* @type {Boolean}
*/
linkCenter: false,
/**
* 节点默认样式也可以添加状态样式
* 例如
* const graph = new G6.Graph({
* nodeStyle: {
* default: { fill: '#fff' },
* selected: { fill: '#ccc', stroke: '#666' },
* active: { lineWidth: 2 }
* },
* ...
* });
*
*/
nodeStyle: {},
/**
* 边默认样式用法同nodeStyle
*/
edgeStyle: {}
linkCenter: false
};
}

View File

@ -130,7 +130,6 @@ class Edge extends Item {
}
getShapeCfg(model) {
model = super.getShapeCfg(model);
const linkCenter = this.get('linkCenter'); // 如果连接到中心,忽视锚点、忽视控制点
const cfg = {};
if (linkCenter) {

View File

@ -258,11 +258,6 @@ class Item {
}
getShapeCfg(model) {
const styles = this.get('styles');
if (styles && styles.default) {
// merge graph的item样式与数据模型中的样式
model.style = Util.mix({}, styles.default, model.style);
}
return model;
}

View File

@ -281,7 +281,7 @@ describe('all node link center', () => {
graph.destroy();
expect(graph.destroyed).eql(true);
});
it('default node & edge style', () => {
/* it('default node & edge style', () => {
const graph = new G6.Graph({
container: div,
width: 500,
@ -341,5 +341,5 @@ describe('all node link center', () => {
graph.setItemState(edge, 'selected', false);
expect(edgeKeyShape.attr('stroke')).to.equal('blue');
expect(edgeKeyShape.attr('strokeOpacity')).to.equal(0.5);
});
}); */
});