修改设置shape的bug
This commit is contained in:
parent
ae686de0ab
commit
9b01aada15
@ -75,14 +75,12 @@ class Compose extends AbstractShape {
|
||||
this.shapeFactory.hideHightLight(this);
|
||||
this.model.elementCodes.forEach(code => {
|
||||
const el = this.shapeFactory.getShapeByCode(code);
|
||||
if (el) {
|
||||
if (el && el.model) {
|
||||
this.shapeFactory.hideHightLight(el);
|
||||
if (el.model) {
|
||||
this.shapeFactory.removeFromLayer(el.type, el);
|
||||
this.instance.add(el);
|
||||
el.model.composeCode = this.code;
|
||||
el.attr(el.model);
|
||||
}
|
||||
this.shapeFactory.removeFromLayer(el.type, el);
|
||||
this.instance.add(el);
|
||||
el.model.composeCode = this.code;
|
||||
el.attr(el.model);
|
||||
}
|
||||
})
|
||||
}
|
||||
@ -93,15 +91,12 @@ class Compose extends AbstractShape {
|
||||
this.shapeFactory.hideHightLight(this);
|
||||
this.model.elementCodes.forEach(code => {
|
||||
const el = this.shapeFactory.getShapeByCode(code);
|
||||
if (el) {
|
||||
if (el && el.model) {
|
||||
this.shapeFactory.hideHightLight(el);
|
||||
if (el.model &&
|
||||
el.model.composeCode) {
|
||||
this.instance.remove(el);
|
||||
this.shapeFactory.addToLayer(el.type, el);
|
||||
el.model.composeCode = '';
|
||||
el.attr(el.model);
|
||||
}
|
||||
this.instance.remove(el);
|
||||
this.shapeFactory.addToLayer(el.type, el);
|
||||
el.model.composeCode = '';
|
||||
el.attr(el.model);
|
||||
}
|
||||
})
|
||||
this.model.elementCodes = [];
|
||||
|
@ -77,10 +77,10 @@ class Element extends AbstractShape {
|
||||
compose.model &&
|
||||
compose.model.elementCodes) {
|
||||
this.shapeFactory.hideHightLight(compose);
|
||||
const index = compose.model.elementCodes.findIndex(this.type);
|
||||
const index = compose.model.elementCodes.findIndex(this.code);
|
||||
if (index < 0) {
|
||||
compose.model.elementCodes.push(this.type);
|
||||
this.shapeFactory.removeFormLayer(el.type, this);
|
||||
compose.model.elementCodes.push(this.code);
|
||||
this.shapeFactory.removeFormLayer(this.type, this);
|
||||
compose.instance.add(this);
|
||||
compose.attr(compose.model);
|
||||
}
|
||||
@ -96,12 +96,12 @@ class Element extends AbstractShape {
|
||||
compose.model &&
|
||||
compose.model.elementCodes) {
|
||||
this.shapeFactory.hideHightLight(compose);
|
||||
const index = compose.model.elementCodes.findIndex(this.type);
|
||||
const index = compose.model.elementCodes.findIndex(this.code);
|
||||
if (index >= 0) {
|
||||
compose.model.elementCodes.splice(index, 1);
|
||||
compose.instance.remove(this);
|
||||
compose.attr(compose.model);
|
||||
this.shapeFactory.addToLayer(el.type, this);
|
||||
this.shapeFactory.addToLayer(this.type, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -132,7 +132,6 @@ class ShapeFactory extends Eventful {
|
||||
|
||||
addShape(shape) {
|
||||
if (shape && shape.code) {
|
||||
this.hideHightLight(shape);
|
||||
this.mapShape[shape.code] = shape;
|
||||
shape.combine();
|
||||
}
|
||||
@ -141,7 +140,6 @@ class ShapeFactory extends Eventful {
|
||||
|
||||
removeShape(shape) {
|
||||
if (shape && shape.code) {
|
||||
this.hideHightLight(shape);
|
||||
shape.uncouple();
|
||||
delete this.mapShape[shape.code];
|
||||
}
|
||||
@ -158,6 +156,7 @@ class ShapeFactory extends Eventful {
|
||||
|
||||
showHightLight(shape) {
|
||||
const target = this.$controller.getTarget();
|
||||
|
||||
if (shape.instanceHightLight) {
|
||||
shape.instanceHightLight.setShape(shape.getBoundingRect())
|
||||
this.$painter.addToLayer(shapeLayer.HightLight, shape.instanceHightLight);
|
||||
@ -176,6 +175,7 @@ class ShapeFactory extends Eventful {
|
||||
|
||||
hideHightLight(shape) {
|
||||
const target = this.$controller.getTarget();
|
||||
|
||||
if (shape.instanceHightLight) {
|
||||
this.$painter.removeFromLayer(shapeLayer.HightLight, shape.instanceHightLight);
|
||||
}
|
||||
|
@ -165,6 +165,7 @@ class JMap {
|
||||
let newShape = null;
|
||||
|
||||
if (updateModel) {
|
||||
this.$controller.clear();
|
||||
switch(action.order) {
|
||||
case orders.Binding:
|
||||
case orders.Add:
|
||||
@ -179,22 +180,19 @@ class JMap {
|
||||
if (updateModel) {
|
||||
curShape = this.$shapeFactory.getShapeByCode(updateModel.code);
|
||||
oldShape = this.$shapeFactory.removeShape(curShape);
|
||||
this.$painter.removeFromLayer(oldShape.type, oldShape.instanceHightLight);
|
||||
this.$painter.remove(oldShape);
|
||||
}
|
||||
});
|
||||
break;
|
||||
case orders.Update:
|
||||
oldShape = this.$shapeFactory.removeShape(curShape);
|
||||
this.$painter.remove(oldShape);
|
||||
newShape = this.$shapeFactory.createShape(updateModel, action.shapeType);
|
||||
this.$shapeFactory.addShape(newShape)
|
||||
this.$painter.removeFromLayer(oldShape.type, oldShape.instanceHightLight);
|
||||
this.$painter.remove(oldShape);
|
||||
this.$painter.add(newShape);
|
||||
break;
|
||||
case orders.Unbinding:
|
||||
oldShape = this.$shapeFactory.removeShape(curShape);
|
||||
this.$painter.removeFromLayer(oldShape.type, oldShape.instanceHightLight);
|
||||
this.$painter.remove(oldShape);
|
||||
this.$shapeFactory.addShape(oldShape);
|
||||
this.$painter.add(oldShape);
|
||||
|
@ -60,11 +60,12 @@ class Painter extends Group {
|
||||
}
|
||||
|
||||
add(shape) {
|
||||
shape && this.removeFromLayer(shapeLayer.HightLight, shape.instanceHightLight);
|
||||
shape && this.addToLayer(shape.type, shape);
|
||||
|
||||
}
|
||||
|
||||
remove(shape) {
|
||||
shape && this.removeFromLayer(shapeLayer.HightLight, shape.instanceHightLight);
|
||||
shape && this.removeFromLayer(shape.type, shape);
|
||||
}
|
||||
|
||||
|
@ -186,10 +186,14 @@ export default {
|
||||
},
|
||||
getComposeElemList() {
|
||||
const source = this.$iscs.getSource();
|
||||
if (source.elementList) {
|
||||
if (source &&
|
||||
source.elementList &&
|
||||
source.elementList.length) {
|
||||
this.composeElemList = source.elementList;
|
||||
this.statusTab = this.composeElemList[0].code;
|
||||
}
|
||||
} else {
|
||||
this.composeElemList = [];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -194,15 +194,19 @@ export default {
|
||||
},
|
||||
getComposeElemList() {
|
||||
const source = this.$iscs.getSource();
|
||||
if (source.elementList && source.elementLis.length > 0) {
|
||||
if (source &&
|
||||
source.elementList &&
|
||||
source.elementList.length) {
|
||||
this.composeElemList = source.elementList;
|
||||
this.statusTab = this.composeElemList[0].code;
|
||||
}
|
||||
} else {
|
||||
this.composeElemList = [];
|
||||
}
|
||||
},
|
||||
onSaveStatus() {
|
||||
this.$refs['tableform' + this.statusTab][0].$refs['form'].validate((valid) => {
|
||||
if (valid) {
|
||||
const model = utils.deepClone(this.$refs['tableform' + this.statusTab][0].formModel);
|
||||
const model = utils.deepClone(this.$refs['tableform' + this.statusTab][0].formModel);
|
||||
model.stateList.map(state=>{ delete state.defaultStyleSelect; delete state.defaultShapeSelect; });
|
||||
this.$refs.iscsCanvas.doAction([{model, action: {shapeType: shapeType.Element, order: orders.Update}}]);
|
||||
this.onSave();
|
||||
|
Loading…
Reference in New Issue
Block a user