修改代码
This commit is contained in:
parent
aab9cb8bed
commit
f78fa04842
@ -42,12 +42,16 @@ class AbstractShape extends Group {
|
|||||||
drift({dx, dy}) {
|
drift({dx, dy}) {
|
||||||
this.model.base.position[0] = this.model.base.position[0] + dx;
|
this.model.base.position[0] = this.model.base.position[0] + dx;
|
||||||
this.model.base.position[1] = this.model.base.position[1] + dy;
|
this.model.base.position[1] = this.model.base.position[1] + dy;
|
||||||
|
this.instance.scale = this.model.base.scale;
|
||||||
|
this.instance.position = this.model.base.position;
|
||||||
|
this.instance.rotation = this.model.base.rotation*Math.PI/180;
|
||||||
this.instance.origin = utils.createOrigin(this.instance);
|
this.instance.origin = utils.createOrigin(this.instance);
|
||||||
|
console.log(this.model.base.position, this.model.base.rotation);
|
||||||
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.setInvisible(this.model.base.hide)
|
this.setInvisible(this.model.base.hide)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 修改属性
|
// 修改状态
|
||||||
attr(attrs) {
|
attr(attrs) {
|
||||||
if (this.instance) {
|
if (this.instance) {
|
||||||
this.instance.attr(attrs);
|
this.instance.attr(attrs);
|
||||||
|
@ -82,6 +82,7 @@ class Element extends AbstractShape {
|
|||||||
compose.model.elementCodes.push(this.type);
|
compose.model.elementCodes.push(this.type);
|
||||||
this.shapeFactory.removeFormLayer(el.type, this);
|
this.shapeFactory.removeFormLayer(el.type, this);
|
||||||
compose.instance.add(this);
|
compose.instance.add(this);
|
||||||
|
compose.attr(compose.model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -99,6 +100,7 @@ class Element extends AbstractShape {
|
|||||||
if (index >= 0) {
|
if (index >= 0) {
|
||||||
compose.model.elementCodes.splice(index, 1);
|
compose.model.elementCodes.splice(index, 1);
|
||||||
compose.instance.remove(this);
|
compose.instance.remove(this);
|
||||||
|
compose.attr(compose.model);
|
||||||
this.shapeFactory.addToLayer(el.type)(this);
|
this.shapeFactory.addToLayer(el.type)(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -246,7 +246,7 @@ function update2List(source, model, action, name='') {
|
|||||||
switch(action.order) {
|
switch(action.order) {
|
||||||
case orders.Binding:
|
case orders.Binding:
|
||||||
case orders.Add:
|
case orders.Add:
|
||||||
list.push(model);
|
i < 0 && list.push(model);
|
||||||
break;
|
break;
|
||||||
case orders.Unbinding:
|
case orders.Unbinding:
|
||||||
case orders.Delete:
|
case orders.Delete:
|
||||||
|
@ -105,7 +105,7 @@ export default {
|
|||||||
},
|
},
|
||||||
onSelected(em) {
|
onSelected(em) {
|
||||||
if (em.model) {
|
if (em.model) {
|
||||||
this.selected = JSON.parse(JSON.stringify(em.model));
|
this.selected = utils.deepClone(em.model);
|
||||||
const elem = this.elementList.find(el => el.code == this.selected.type);
|
const elem = this.elementList.find(el => el.code == this.selected.type);
|
||||||
if (elem) {
|
if (elem) {
|
||||||
elem.model = this.selected;
|
elem.model = this.selected;
|
||||||
@ -119,7 +119,7 @@ export default {
|
|||||||
this.$refs['dataform'+this.enabledTab][0].$refs['form'].validate((valid) => {
|
this.$refs['dataform'+this.enabledTab][0].$refs['form'].validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
const formModel = this.$refs['dataform' + this.enabledTab][0].formModel;
|
const formModel = this.$refs['dataform' + this.enabledTab][0].formModel;
|
||||||
const newModel = JSON.parse(JSON.stringify(formModel));
|
const newModel = utils.deepClone(formModel);
|
||||||
newModel.code = utils.getUID(this.enabledTab);
|
newModel.code = utils.getUID(this.enabledTab);
|
||||||
newModel.type = this.enabledTab;
|
newModel.type = this.enabledTab;
|
||||||
newModel.name = '<名称>';
|
newModel.name = '<名称>';
|
||||||
@ -132,7 +132,7 @@ export default {
|
|||||||
onModify() {
|
onModify() {
|
||||||
this.$refs['dataform' + this.enabledTab][0].$refs['form'].validate((valid) => {
|
this.$refs['dataform' + this.enabledTab][0].$refs['form'].validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
const model = this.$refs['dataform' + this.enabledTab][0].formModel;
|
const model = utils.deepClone(this.$refs['dataform' + this.enabledTab][0].formModel);
|
||||||
model.code = this.selected.code;
|
model.code = this.selected.code;
|
||||||
model.type = this.selected.type;
|
model.type = this.selected.type;
|
||||||
model.name = this.selected.name;
|
model.name = this.selected.name;
|
||||||
@ -144,7 +144,7 @@ export default {
|
|||||||
onDelete() {
|
onDelete() {
|
||||||
this.$refs['dataform' + this.enabledTab][0].$refs['form'].validate((valid) => {
|
this.$refs['dataform' + this.enabledTab][0].$refs['form'].validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
const model = this.$refs['dataform' + this.enabledTab][0].formModel;
|
const model = utils.deepClone(this.$refs['dataform' + this.enabledTab][0].formModel);
|
||||||
model.code = this.selected.code;
|
model.code = this.selected.code;
|
||||||
model.type = this.selected.type;
|
model.type = this.selected.type;
|
||||||
model.name = this.selected.name;
|
model.name = this.selected.name;
|
||||||
|
@ -81,7 +81,7 @@ export default {
|
|||||||
offsetY: 0
|
offsetY: 0
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
ShapeBuilder,
|
// ShapeBuilder,
|
||||||
// ShapeProperty
|
// ShapeProperty
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
@ -135,6 +135,7 @@ export default {
|
|||||||
},
|
},
|
||||||
// 点击选择事件
|
// 点击选择事件
|
||||||
onClick(em={}) {
|
onClick(em={}) {
|
||||||
|
console.log(em);
|
||||||
this.$emit('selected', em);
|
this.$emit('selected', em);
|
||||||
},
|
},
|
||||||
onReflect(em={}) {
|
onReflect(em={}) {
|
||||||
|
@ -93,7 +93,7 @@ export default {
|
|||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
ShapeBuilder,
|
ShapeBuilder,
|
||||||
ShapeProperty
|
// ShapeProperty
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user