52 lines
1005 B
JavaScript
52 lines
1005 B
JavaScript
import Line from 'zrender/src/graphic/shape/Line';
|
|
import Group from 'zrender/src/container/Group';
|
|
|
|
class Link extends Group {
|
|
constructor({ _code, _type, zlevel, model, state }, style) {
|
|
super();
|
|
this._code = _code;
|
|
this._type = _type;
|
|
this.zlevel = zlevel;
|
|
this.model = model;
|
|
this.state = state;
|
|
this.style = style;
|
|
this.create();
|
|
}
|
|
|
|
create() {
|
|
const model = this.model;
|
|
const style = this.style;
|
|
|
|
this.link = new Line({
|
|
zlevel: this.zlevel,
|
|
shape: {
|
|
x1: model.lp.x,
|
|
y1: model.lp.y,
|
|
x2: model.rp.x,
|
|
y2: model.rp.y
|
|
},
|
|
style: {
|
|
lineWidth: style.linkWidth,
|
|
stroke: style.linkColor,
|
|
text: model.code,
|
|
textDistance: style.linkWidth * 2,
|
|
textPosition: 'inside',
|
|
textAlign: 'middle',
|
|
fontSize: style.textFontSize,
|
|
textFill: style.linkTextColor,
|
|
textStroke: style.backgroundColor
|
|
}
|
|
});
|
|
|
|
this.add(this.link);
|
|
}
|
|
|
|
setState({ _code, _type, zlevel, model, state }) {
|
|
}
|
|
|
|
tipBasePoint() {
|
|
}
|
|
}
|
|
|
|
export default Link;
|