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); } }