提交文件

This commit is contained in:
ival 2021-04-09 17:09:58 +08:00
parent 5c19aab68c
commit 6c2b475213
9 changed files with 33 additions and 35 deletions

View File

@ -1,16 +1,6 @@
import types from './types'; import types from './types';
export default [ export default [
// {
// prop: 'name',
// label: '名称',
// type: types.String,
// rules:[
// { required: true, message:'请输入名称', trigger: 'blur' }
// ],
// value: '<名称>',
// description: '控制图形的前后顺序。'
// },
{ {
prop: 'z1', prop: 'z1',
label: '层级z1', label: '层级z1',

View File

@ -341,9 +341,6 @@ class JMap {
case events.Keyup: case events.Keyup:
this.$controller.on(events.Keyup, cb, context); this.$controller.on(events.Keyup, cb, context);
break; break;
// case events.BuildShape:
// this.$controller.on(events.BuildShape, cb, context);
// break;
} }
} }
} }
@ -392,9 +389,6 @@ class JMap {
case events.Keyup: case events.Keyup:
this.$controller.off(events.Keyup, cb); this.$controller.off(events.Keyup, cb);
break; break;
// case events.BuildShape:
// this.$controller.off(events.BuildShape, cb);
// break;
} }
} }
} }

View File

@ -27,7 +27,6 @@ export default {
}, },
methods: { methods: {
doBuilder(type) { doBuilder(type) {
console.log(elementConst, type)
const form = formBuilder.buildForm(elementConst[type]); const form = formBuilder.buildForm(elementConst[type]);
const model = utils.deepClone(form.model); const model = utils.deepClone(form.model);
model.code = utils.getUID(type); model.code = utils.getUID(type);
@ -45,7 +44,7 @@ export default {
.builder { .builder {
background: #f1f1f1; background: #f1f1f1;
height: 100%; height: 100%;
width: 120px; width: 130px;
position: absolute; position: absolute;
top: 0; top: 0;
} }

View File

@ -24,6 +24,7 @@ export default {
x: 0, x: 0,
y: 0 y: 0
}, },
clipboardList: [],
menus: [], menus: [],
list: [ list: [
{ {
@ -40,6 +41,21 @@ export default {
disabledCb: selected => { disabledCb: selected => {
return selected.shapeType != shapeType.Compose; return selected.shapeType != shapeType.Compose;
} }
},
{
label: '复制',
handler: this.doCopy,
disabledCb: selected => {
const storage = this.$iscs.getController().getStorage();
return storage.values().length <= 0;
}
},
{
label: '粘贴',
handler: this.doParse,
disabledCb: selected => {
return this.clipboardList.length;
}
} }
] ]
}; };
@ -92,6 +108,10 @@ export default {
} }
]); ]);
} }
},
doCopy(el) {
},
doParse(el) {
} }
} }
}; };

View File

@ -253,17 +253,12 @@ export default class SelectingHandle {
this.$painter.addToLayer(shapeLayer.Selecting)(this.selecting); this.$painter.addToLayer(shapeLayer.Selecting)(this.selecting);
const selectingRect = this.selecting.getBoundingRect(); const selectingRect = this.selecting.getBoundingRect();
const keyStr = this.$controller.getKeyStr();
Object.values(this.$map.getMapShape()).forEach(el => { Object.values(this.$map.getMapShape()).forEach(el => {
if (el.model && !el.model.composeCode && this.checkSelectingRectContainShape(selectingRect, el)) { if (el.model && !el.model.composeCode && this.checkSelectingRectContainShape(selectingRect, el)) {
this.setSelected(el); this.setSelected(el);
} }
}); });
// if (['Alt'].includes(keyStr)) {
// this.$controller.trigger(events.BuildShape, {...selectingRect, option: this.$map.getOption()});
// }
this.clear(); this.clear();
} }

View File

@ -11,6 +11,5 @@ export default {
StateLoaded: 'stateLoaded', StateLoaded: 'stateLoaded',
ViewUpdate: 'viewUpdate', ViewUpdate: 'viewUpdate',
StateUpdate: 'stateUpdate', StateUpdate: 'stateUpdate',
OptionUpdate: 'optionUpdate', OptionUpdate: 'optionUpdate'
// BuildShape: 'buildShape'
} }

View File

@ -233,10 +233,8 @@ export default {
}, },
// //
onSelected(em) { onSelected(em) {
console.log(em);
}, },
onDblclick(em) { onDblclick(em) {
console.log(em);
}, },
// //
onContextMenu(em) { onContextMenu(em) {

View File

@ -86,13 +86,17 @@ export default {
const source = this.$iscs.getSource(); const source = this.$iscs.getSource();
if (id && source) { if (id && source) {
const elementList = source.elementList.map(el => { const elementList = source.elementList.map(el => {
return this.$iscs.getShapeByCode(el.code); return this.$iscs.getShapeByCode(el.code).model;
}); });
const shapeList = elementList.map(el => el.model); const composeList = source.composeList.map(el => {
const rect = elementList.reduce( return this.$iscs.getShapeByCode(el.code).model;
(temp,el) => el&&temp? temp.union(el.getBoundingRect().clone()): el.getBoundingRect(), null); });
const rect = elementList.reduce((temp,el) => {
const shape = this.$iscs.getShapeByCode(el.code);
return shape&&temp? temp.union(shape.getBoundingRect().clone()): shape.getBoundingRect()
}, null);
const position = rect? [(rect.x + rect.width)/2, (rect.y + rect.height)/2]: [0,0]; const position = rect? [(rect.x + rect.width)/2, (rect.y + rect.height)/2]: [0,0];
const model = { id, name, type, shapeList, position }; const model = { id, name, type, elementList, composeList, position };
Idb.delete('composeList', model.id); Idb.delete('composeList', model.id);
Idb.write('composeList', model); Idb.write('composeList', model);
Idb.list('composeList').then(list => { Idb.list('composeList').then(list => {

View File

@ -101,8 +101,8 @@ export default {
setTimeout(_ => { setTimeout(_ => {
Idb.select('composeList', this.$route.query.id).then(resp => { Idb.select('composeList', this.$route.query.id).then(resp => {
this.$iscs.setMap([], { this.$iscs.setMap([], {
elementList: resp.shapeList||[], elementList: resp.elementList||[],
composeList: [] composeList: resp.composeList||[]
}, option); }, option);
}).catch(error => { }).catch(error => {
this.$iscs.setMap([], { this.$iscs.setMap([], {
@ -137,7 +137,6 @@ export default {
}, },
// //
onClick(em={}) { onClick(em={}) {
console.log(em);
this.$emit('selected', em); this.$emit('selected', em);
}, },
onReflect(em={}) { onReflect(em={}) {