修改
This commit is contained in:
parent
1bab212c05
commit
b9132cb29f
66
src/jmap/shape/Signal/ESigAuto.js
Normal file
66
src/jmap/shape/Signal/ESigAuto.js
Normal file
@ -0,0 +1,66 @@
|
||||
import Polygon from 'zrender/src/graphic/shape/Polygon';
|
||||
import Group from 'zrender/src/container/Group';
|
||||
import { arrows } from '../utils/ShapePoints';
|
||||
|
||||
class ESigPass extends Group {
|
||||
constructor(model) {
|
||||
super();
|
||||
this.model = model;
|
||||
this._create();
|
||||
}
|
||||
|
||||
_create() {
|
||||
const model = this.model;
|
||||
const style = this.model.style;
|
||||
const rotation = model.drict != 1? 0 : Math.PI;
|
||||
const point = arrows(model.x, model.y, style.Signal.signalSigPassWidth, style.Signal.lamp.signalR * 0.8);
|
||||
this.arrows = new Polygon({
|
||||
zlevel: model.zlevel,
|
||||
z: model.z,
|
||||
rotation: rotation,
|
||||
shape: {
|
||||
points: point
|
||||
},
|
||||
style: {
|
||||
stroke: model.stroke,
|
||||
lineWidth: model.lineWidth,
|
||||
fill: model.fill
|
||||
}
|
||||
});
|
||||
this.add(this.arrows);
|
||||
}
|
||||
|
||||
// 停止动画
|
||||
animationRecover() {
|
||||
this.arrows.stopAnimation(false);
|
||||
}
|
||||
|
||||
// 箭头颜色
|
||||
setColor(color) {
|
||||
this.arrows.setStyle('fill', color);
|
||||
}
|
||||
|
||||
// 箭头闪烁
|
||||
arrowsAnimation() {
|
||||
const style = this.model.style;
|
||||
const fill = this.arrows.style.Signal.fill;
|
||||
this.arrows.animate(true)
|
||||
.when(1000, { fill: style.backgroundColor, stroke: style.style.backgroundColor })
|
||||
.when(2000, { fill: fill, stroke: style.style.Signal.sidelineColor })
|
||||
.when(3000, { fill: style.style.backgroundColor, stroke: style.style.backgroundColor })
|
||||
.when(4000, { fill: fill, stroke: style.style.Signal.sidelineColor })
|
||||
.start();
|
||||
}
|
||||
|
||||
// 隐藏
|
||||
hide() {
|
||||
this.arrows.hide();
|
||||
}
|
||||
|
||||
// 显示
|
||||
show() {
|
||||
this.arrows.show();
|
||||
}
|
||||
}
|
||||
|
||||
export default ESigPass;
|
Loading…
Reference in New Issue
Block a user