增加代码

This commit is contained in:
ival 2021-03-31 18:29:17 +08:00
parent 143d6a67cc
commit 82f432136e
4 changed files with 24 additions and 5 deletions

View File

@ -23,6 +23,7 @@ function update2List(source, model, action, name='') {
let updateModel = model;
const i = list.findIndex(elem => { return elem.code == model.code; })
switch(action.order) {
case orders.BINDING:
case orders.ADD:
list.push(model);
break;

View File

@ -178,6 +178,9 @@ class JMap {
case orders.UNBINDING:
this.$painter.remove(oldShape);
break;
case orders.BINDING:
// 暂不支持
break;
}
}
});

View File

@ -17,14 +17,12 @@ export default class SelectHandle {
if (e.target) {
this.e = {...e};
if (['Control'].includes(this.$controller.getKeyStr())) {
console.log(this.$controller.isSelected(e.target.model.code));
if (this.$controller.isSelected(e.target.model.code)) {
this.delSelected(e.target);
} else {
this.addSelected(e.target);
}
} else {
console.log(2222)
this.clear();
this.addSelected(e.target);
}
@ -33,11 +31,13 @@ export default class SelectHandle {
addSelected(target) {
this.$controller.storage.set(target.model.code, target);
console.log(this.$controller.storage.values());
target.active();
}
delSelected(target) {
target.inactive();
console.log('bug')
this.$controller.storage.delete(target.model.code);
}

View File

@ -112,7 +112,7 @@ export default {
fill: 'red',
stroke: 'black'
},
composeCode: '4'
composeCode: '100'
},
{
code: '2',
@ -126,7 +126,7 @@ export default {
fill: 'red',
stroke: 'black'
},
composeCode: '4'
composeCode: '100'
},
{
code: '3',
@ -142,11 +142,26 @@ export default {
stroke: 'black'
},
composeCode: ''
},
{
code: '4',
type: 'Droplet',
shape: {
cx: 400,
cy: 200,
width: 20,
height: 20,
},
style: {
fill: 'red',
stroke: 'black'
},
composeCode: ''
}
],
composeList: [
{
code: '4',
code: '100',
type: 'Device',
elementCodes: ['1', '2']
}