2020-03-05 15:48:51 +08:00
|
|
|
import Group from 'zrender/src/container/Group';
|
|
|
|
import Rect from 'zrender/src/graphic/shape/Rect';
|
2020-03-10 10:21:33 +08:00
|
|
|
import {getPrdType, isShowThePrdType} from '../utils/handlePath';
|
2020-03-05 15:48:51 +08:00
|
|
|
|
|
|
|
export default class OutFrame extends Group {
|
|
|
|
constructor(model, style) {
|
|
|
|
super();
|
|
|
|
this.model = model;
|
|
|
|
this._type = model._type;
|
|
|
|
this._code = model.code;
|
|
|
|
this.style = style;
|
|
|
|
this.zlevel = model.zlevel;
|
|
|
|
this.z = 0;
|
2020-03-10 09:49:05 +08:00
|
|
|
this.prdType = getPrdType();
|
2020-03-10 10:21:33 +08:00
|
|
|
if (isShowThePrdType(this.prdType, model.showConditions)) {
|
2020-03-10 09:49:05 +08:00
|
|
|
this.create();
|
|
|
|
this.setState(model);
|
|
|
|
}
|
2020-03-05 15:48:51 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
create() {
|
|
|
|
const model = this.model;
|
|
|
|
this.box = new Rect({
|
|
|
|
zlevel: this.zlevel,
|
|
|
|
z: this.z,
|
|
|
|
shape: {
|
|
|
|
x: model.position.x - model.width / 2,
|
|
|
|
y: model.position.y - model.height / 2,
|
|
|
|
width: model.width,
|
|
|
|
height: model.height
|
|
|
|
},
|
|
|
|
style: {
|
|
|
|
lineDash: null,
|
|
|
|
stroke: '#fff',
|
|
|
|
lineWidth: 1,
|
|
|
|
fill: 'rgb(135,206,250,0)'
|
|
|
|
}
|
|
|
|
});
|
|
|
|
this.add(this.box);
|
|
|
|
}
|
|
|
|
|
|
|
|
// 设置状态
|
|
|
|
setState(model) {
|
|
|
|
}
|
|
|
|
}
|