rt-sim-training-client/src/jmapNew/shape/StationStand/EReentry.js
2020-03-27 17:26:17 +08:00

48 lines
1.1 KiB
JavaScript

import Group from 'zrender/src/container/Group';
import Polygon from 'zrender/src/graphic/shape/Polygon';
import { flashlight } from '../utils/ShapePoints.js';
class EReentry extends Group {
constructor(model) {
super();
this.model = model;
this.isNew = false;
}
create() {
if (!this.isNew) {
const model = this.model;
this.isNew = true;
this.reentry = new Polygon({
zlevel: model.zlevel,
z: model.z,
shape: {
points: flashlight(model.x, model.y, model.drict, 10, 5, 0, 0, 4)
},
style: {
lineWidth: model.lineWidth,
fill: model.fill
}
});
this.add(this.reentry);
}
}
setColor(color) {
this.create();
this.reentry.setStyle('textFill', color);
}
hideMode() {
this.reentry && this.reentry.hide();
}
showMode() {
this.create();
this.reentry.show();
}
}
export default EReentry;