rt-sim-training-client/src/jmapNew/shape/Train/TrainBodyBox.js

34 lines
812 B
JavaScript
Raw Normal View History

2019-11-29 12:51:58 +08:00
import Group from 'zrender/src/container/Group';
import Rect from 'zrender/src/graphic/shape/Rect';
export default class TrainBodyBox extends Group {
constructor(model) {
super();
this.model = model;
this.create();
}
create() {
const model = this.model;
this.trainBodyBox = new Rect({
zlevel: model.zlevel,
z: model.z,
shape: {
x: model.point.x,
y: model.point.y,
width: model.style.Train.common.trainWidth,
height: model.style.Train.common.trainHeight
},
style: {
lineWidth: model.style.Train.trainBody.trainBodyLineWidth,
stroke: model.style.trainSidelineColor,
fill: model.style.Train.trainBody.trainBodyFillColor
},
cursor: 'pointer'
});
this.add(this.trainBodyBox);
}
setColor(key, color) {
this.trainBodyBox.setStyle(key, color);
}
}