iscs调整(批量拖动)

This commit is contained in:
fan 2020-01-15 14:33:21 +08:00
parent 699d548b84
commit bf1497164c
4 changed files with 56 additions and 1 deletions

View File

@ -8,5 +8,11 @@ deviceRender[deviceType.ManualAlarmButton] = {
zlevel: 1,
z: 4
};
/** CheckBox渲染配置 */
deviceRender[deviceType.CheckBox] = {
_type: deviceType.CheckBox,
zlevel: 10,
z: 0
};
export default deviceRender;

View File

@ -1,5 +1,6 @@
const deviceType = {
ManualAlarmButton: 'manualAlarmButton'
ManualAlarmButton: 'manualAlarmButton',
CheckBox: 'CheckBox'
};
export default deviceType;

View File

@ -0,0 +1,46 @@
import Group from 'zrender/src/container/Group';
import Rect from 'zrender/src/graphic/shape/Rect';
export default class checkBox extends Group {
constructor(device) {
super();
this.model = device.model;
this._type = device.model._type;
this._code = device.model.code;
this.zlevel = device.model.zlevel;
this.z = device.model.z;
this.create();
}
create() {
const model = this.model;
this.grouper = new Group({
id: model.code,
position: [model.point.x, model.point.y]
});
this.box = new Rect({
zlevel: model.zlevel,
z: model.z,
draggable: false,
shape: {
x: 0,
y: 0,
width: this.model.width,
height: this.model.height
},
style: {
fill: 'rgb(135,206,250,0.2)'
}
});
this.grouper.add(this.box);
this.add(this.grouper);
}
setModel(dx, dy) {
this.model.point.x += dx;
this.model.point.y += dy;
}
setSize(width, height) {
this.model.width = width;
this.model.height = height;
}
}

View File

@ -1,8 +1,10 @@
import ManualAlarmButton from './manualAlarmButton';
import deviceType from '../constant/deviceType';
import CheckBox from './checkBox';
const iscsShape = {};
iscsShape[deviceType.ManualAlarmButton] = ManualAlarmButton;
iscsShape[deviceType.CheckBox] = CheckBox;
function shapefactory(device, iscs) {
const type = device.model._type;