fix conflict

This commit is contained in:
TomHuangCN 2018-08-28 18:03:57 +08:00
commit abb5f414da
5 changed files with 19 additions and 11 deletions

View File

@ -48,6 +48,11 @@
shape: 'custom'
});
graph.read(data);
setTimeout(()=>{
graph.update('node1', {
title: 'sss'
});
}, 1000);
</script>
</body>
</html>

View File

@ -100,7 +100,7 @@
"screenshot": "node ./bin/screenshot.js",
"start": "npm run dev",
"test": "torch --compile --renderer --recursive ./test/unit",
"test-live": "torch --compile --interactive --watch --recursive ./test/unit/util/",
"test-live": "torch --compile --interactive --watch --recursive ./test/unit/",
"watch": "webpack --config webpack-dev.config.js",
"win-dev": "node ./bin/win-dev.js"
},

View File

@ -172,7 +172,12 @@ class Plugin {
if (!model.isTreeEdge || typeof model.isTreeEdge === 'undefined') model.shape = 'quadraticCurve';
}
graph.edge({
style: this.edgeStyle,
style: model => {
if (model.actived) {
return this.activedEdgeStyle;
}
return this.edgeStyle;
},
endArrow: true
});
graph.node({
@ -188,7 +193,7 @@ class Plugin {
graph.draw();
} else if (item.isEdge) {
graph.simpleUpdate(item, {
style: this.activedEdgeStyle
actived: true
});
}
}
@ -200,7 +205,7 @@ class Plugin {
graph.draw();
} else if (item.isEdge) {
graph.simpleUpdate(item, {
style: this.edgeStyle
actived: false
});
}
}

View File

@ -37,12 +37,10 @@ class Controller extends Base {
mapping(model) {
const channels = this.channels;
Util.each(channels, (channel, name) => {
if (Util.isNil(model[name])) {
if (Util.isFunction(channel.input)) {
model[name] = channel.input(model);
} else if (channel.input) {
model[name] = channel.input;
}
if (Util.isFunction(channel.input)) {
model[name] = channel.input(model);
} else if (channel.input) {
model[name] = channel.input;
}
});
}

View File

@ -70,7 +70,6 @@ class Item {
}
_init() {
this._setIndex();
this._mapping();
this._setShapeObj();
this._initGroup();
this.draw();
@ -188,6 +187,7 @@ class Item {
const group = this.group;
group.clear(!animate);
const shapeObj = this.shapeObj;
this._mapping();
const keyShape = shapeObj.draw(this);
if (keyShape) {
keyShape.isKeyShape = true;