修改代码

This commit is contained in:
ival 2021-04-08 13:55:07 +08:00
parent 1fb3c04c37
commit cfed96504b
5 changed files with 25 additions and 6 deletions

View File

@ -326,6 +326,7 @@ export default class Controller extends Eventful {
clear() { clear() {
this.storage.clear(); this.storage.clear();
this.storage.clearClipboard(); this.storage.clearClipboard();
this._target = null;
this._pan = false; this._pan = false;
} }

View File

@ -44,7 +44,6 @@ class AbstractShape extends Group {
this.model.base.position[1] = this.model.base.position[1] + dy; this.model.base.position[1] = this.model.base.position[1] + dy;
this.instance.origin = utils.createOrigin(this.instance); this.instance.origin = utils.createOrigin(this.instance);
this.instance.transform = utils.createTransform({scale: this.model.base.scale, position: this.model.base.position, rotation: this.model.base.rotation*Math.PI/180}); this.instance.transform = utils.createTransform({scale: this.model.base.scale, position: this.model.base.position, rotation: this.model.base.rotation*Math.PI/180});
this.dirty();
} }
// 修改属性 // 修改属性

View File

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

View File

@ -166,6 +166,7 @@ class JMap {
let newShape = null; let newShape = null;
if (updateModel) { if (updateModel) {
this.$controller.clear()
switch(action.order) { switch(action.order) {
case orders.BINDING: case orders.BINDING:
case orders.ADD: case orders.ADD:
@ -190,13 +191,14 @@ class JMap {
oldShape = this.$shapeFactory.removeShape(curShape); oldShape = this.$shapeFactory.removeShape(curShape);
newShape = this.$shapeFactory.createShape(updateModel, action.shapeType); newShape = this.$shapeFactory.createShape(updateModel, action.shapeType);
this.$painter.removeFromLayer(oldShape.type, oldShape.instanceHightLight); this.$painter.removeFromLayer(oldShape.type, oldShape.instanceHightLight);
this.$painter.removeFromLayer(oldShape.type, newShape.instanceHightLight);
this.$painter.remove(oldShape); this.$painter.remove(oldShape);
this.$shapeFactory.storageShape(newShape) this.$shapeFactory.storageShape(newShape)
this.$painter.add(newShape); this.$painter.add(newShape);
this.$painter.addToLayer(newShape.type, newShape.instanceHightLight);
break; break;
case orders.UNBINDING: case orders.UNBINDING:
oldShape = this.$shapeFactory.removeShape(curShape); oldShape = this.$shapeFactory.removeShape(curShape);
this.$painter.removeFromLayer(oldShape.type, oldShape.instanceHightLight);
this.$painter.remove(oldShape); this.$painter.remove(oldShape);
break; break;
} }

View File

@ -84,6 +84,7 @@ export default {
onSave(data) { onSave(data) {
}, },
onSelectTab() { onSelectTab() {
this.selected = null;
}, },
onSelected(em) { onSelected(em) {
if (em.model) { if (em.model) {
@ -104,6 +105,7 @@ export default {
newModel.type = this.enabledTab; newModel.type = this.enabledTab;
newModel.code = utils.getUID(this.enabledTab); newModel.code = utils.getUID(this.enabledTab);
this.$refs.iscsCanvas.doAction([{model: newModel, action: {shapeType: shapeType.Element, order: orders.ADD}}]); this.$refs.iscsCanvas.doAction([{model: newModel, action: {shapeType: shapeType.Element, order: orders.ADD}}]);
this.clear(this.enabledTab);
} }
}); });
}, },
@ -114,6 +116,7 @@ export default {
model.code = this.selected.code; model.code = this.selected.code;
model.type = this.selected.type; model.type = this.selected.type;
this.$refs.iscsCanvas.doAction([{model, action: {shapeType: shapeType.Element, order: orders.UPDATE}}]); this.$refs.iscsCanvas.doAction([{model, action: {shapeType: shapeType.Element, order: orders.UPDATE}}]);
this.clear(this.enabledTab);
} }
}); });
}, },
@ -124,10 +127,13 @@ export default {
model.code = this.selected.code; model.code = this.selected.code;
model.type = this.selected.type; model.type = this.selected.type;
this.$refs.iscsCanvas.doAction([{model, action: {shapeType: shapeType.Element, order: orders.DELETE}}]); this.$refs.iscsCanvas.doAction([{model, action: {shapeType: shapeType.Element, order: orders.DELETE}}]);
this.$refs['dataform' + this.enabledTab][0].init(); this.clear(this.enabledTab);
this.selected = null;
} }
}); });
},
clear(enabledTab) {
this.$refs['dataform' + enabledTab][0].init();
this.selected = null;
} }
} }
}; };