68 lines
1.8 KiB
JavaScript
68 lines
1.8 KiB
JavaScript
import Group from 'zrender/src/container/Group';
|
|
import Circle from 'zrender/src/graphic/shape/Circle';
|
|
import Line from 'zrender/src/graphic/shape/Line';
|
|
|
|
class EDetainCircle extends Group {
|
|
constructor(model) {
|
|
super();
|
|
this.model = model;
|
|
this.create();
|
|
}
|
|
|
|
create() {
|
|
const model = this.model;
|
|
const style = this.model.style;
|
|
this.detainCircle = new Circle({
|
|
zlevel: model.zlevel,
|
|
z: model.z,
|
|
shape: {
|
|
cx: model.x,
|
|
cy: model.y,
|
|
r: model.radius
|
|
},
|
|
style:{
|
|
lineWidth:2,
|
|
stroke:style.sidelineColor
|
|
}
|
|
});
|
|
this.line1 = new Line({
|
|
zlevel: model.zlevel,
|
|
z: model.z,
|
|
shape:{
|
|
x1:model.x - model.radius * 0.7,
|
|
y1:model.y - model.radius * 0.7,
|
|
x2:model.x + model.radius * 0.7,
|
|
y2:model.y + model.radius * 0.7
|
|
},
|
|
style:{
|
|
lineWidth:2,
|
|
stroke:style.sidelineColor
|
|
}
|
|
});
|
|
this.line2 = new Line({
|
|
zlevel: model.zlevel,
|
|
z: model.z,
|
|
shape:{
|
|
x1:model.x - model.radius * 0.7,
|
|
y1:model.y + model.radius * 0.7,
|
|
x2:model.x + model.radius * 0.7,
|
|
y2:model.y - model.radius * 0.7
|
|
},
|
|
style:{
|
|
lineWidth:2,
|
|
stroke:style.sidelineColor
|
|
}
|
|
});
|
|
this.add(this.detainCircle);
|
|
this.add(this.line1);
|
|
this.add(this.line2);
|
|
}
|
|
|
|
setColor(color) {
|
|
this.detainCircle.setStyle('stroke', color);
|
|
this.line1.setStyle('stroke', color);
|
|
}
|
|
}
|
|
|
|
export default EDetainCircle;
|