rt-sim-training-client/src/jmap/shape/Link.js

52 lines
1018 B
JavaScript
Raw Normal View History

2019-07-03 14:29:09 +08:00
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) {
2019-07-15 15:51:39 +08:00
super({name: _code});
2019-07-04 10:59:40 +08:00
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: {
2019-07-10 16:29:07 +08:00
x1: model.lp.x,
y1: model.lp.y,
x2: model.rp.x,
y2: model.rp.y
2019-07-04 10:59:40 +08:00
},
style: {
2019-07-04 18:39:30 +08:00
lineWidth: style.linkWidth,
stroke: style.linkColor,
2019-07-04 10:59:40 +08:00
text: model.code,
2019-07-04 18:39:30 +08:00
textDistance: style.linkWidth * 2,
2019-07-05 00:40:53 +08:00
textPosition: 'inside',
2019-07-04 10:59:40 +08:00
textAlign: 'middle',
fontSize: style.textFontSize,
2019-07-04 18:39:30 +08:00
textFill: style.linkTextColor,
textStroke: style.backgroundColor
2019-07-04 10:59:40 +08:00
}
});
this.add(this.link);
}
2019-07-04 18:39:30 +08:00
setState({ _code, _type, zlevel, model, state }) {
2019-07-04 10:59:40 +08:00
}
tipBasePoint() {
}
2019-07-03 14:29:09 +08:00
}
2019-07-04 10:59:40 +08:00
export default Link;