rt-sim-training-client/src/jmapNew/shape/Signal/ELowButton.js
2020-03-20 18:14:42 +08:00

56 lines
1.3 KiB
JavaScript

import Rect from 'zrender/src/graphic/shape/Rect';
import Group from 'zrender/src/container/Group';
class ELowButton extends Group {
constructor(model) {
super();
this.model = model;
this.create();
}
create() {
const model = this.model;
const style = this.model.style;
this.button = new Rect({
zlevel: model.zlevel,
z: model.z,
shape: {
x: model.x,
y: model.y,
width: style.Signal.lamp.radiusR * 2,
height: style.Signal.lamp.radiusR * 2
},
style: {
lineWidth: 1,
stroke: style.Signal.lowButton.strokeColor,
fill: style.Signal.lowButton.fillColor
}
});
this.add(this.button);
this.hide();
}
// 隐藏
hide() {
this.button.hide();
}
// 显示
show() {
this.button.show();
}
setLowButtonActive() {
const style = this.model.style;
this.button.setStyle({ fill: style.Signal.lowButton.fillActiveColor });
}
setLowButtonRecover() {
const style = this.model.style;
this.button.setStyle({ fill: style.Signal.lowButton.fillColor });
}
}
export default ELowButton;