优化代码
This commit is contained in:
parent
773522b8f0
commit
1bea58747a
@ -149,13 +149,13 @@ export default {
|
|||||||
this.pixelExecCb(e, args => {
|
this.pixelExecCb(e, args => {
|
||||||
if(this.model.choice == 'Plan') {
|
if(this.model.choice == 'Plan') {
|
||||||
if (this.model.action == 'Translate') {
|
if (this.model.action == 'Translate') {
|
||||||
this.doTranslate(args);
|
this.doTranslateSeries(args);
|
||||||
}
|
}
|
||||||
} else if(this.model.choice == 'Construction') {
|
} else if(this.model.choice == 'Construction') {
|
||||||
if (this.model.action == 'Translate') {
|
if (this.model.action == 'Translate') {
|
||||||
this.doTranslate(args);
|
this.doTranslateArea(args);
|
||||||
} else if (this.model.action == 'Edit') {
|
} else if (this.model.action == 'Edit') {
|
||||||
this.doTranslate(args);
|
this.doTranslateHorn(args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -309,26 +309,17 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
doSetDrag({e, pointInGrid}) {
|
doSetDrag({e, pointInGrid}) {
|
||||||
if (e.target) {
|
if (e.target && ['drag'].includes(e.target.subType)) {
|
||||||
if (['drag'].includes(e.target.subType)) {
|
this.dragging = false;
|
||||||
const model = e.target.model
|
|
||||||
Object.assign(model, {
|
|
||||||
_x: pointInGrid[0],
|
|
||||||
_y: pointInGrid[1]
|
|
||||||
})
|
|
||||||
|
|
||||||
this.drag = e.target;
|
this.drag = e.target;
|
||||||
}
|
this.drag.model._x = pointInGrid[0];
|
||||||
|
this.drag.model._y = pointInGrid[1];
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
doSetTarget({e, pointInGrid}) {
|
doSetTarget({e, pointInGrid}) {
|
||||||
if (e.target) {
|
if (e.target && ['area'].includes(e.target.subType)) {
|
||||||
if (['area'].includes(e.target.subType)) {
|
this.dragging = false;
|
||||||
const model = e.target.model
|
|
||||||
Object.assign(model, {
|
|
||||||
_x: pointInGrid[0],
|
|
||||||
_y: pointInGrid[1]
|
|
||||||
})
|
|
||||||
|
|
||||||
if (this.target &&
|
if (this.target &&
|
||||||
this.target.model.areaNo != e.target.model.areaNo) {
|
this.target.model.areaNo != e.target.model.areaNo) {
|
||||||
@ -336,16 +327,20 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.target = e.target;
|
this.target = e.target;
|
||||||
this.setTargetLight();
|
this.target.model._x = pointInGrid[0];
|
||||||
|
this.target.model._y = pointInGrid[1];
|
||||||
|
|
||||||
this.$emit('tag', e.target);
|
this.$emit('tag', e.target);
|
||||||
}
|
|
||||||
|
this.setTargetLight();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
doSetSelected({e, pointInGrid}) {
|
doSetSelected({e, pointInGrid}) {
|
||||||
if (e.componentType == "series" &&
|
if (e.componentType == "series" &&
|
||||||
e.componentSubType == "line" &&
|
e.componentSubType == "line" &&
|
||||||
e.seriesName.includes('service')) {
|
e.seriesName.includes('service')) {
|
||||||
|
this.dragging = false;
|
||||||
|
|
||||||
const value = e.value;
|
const value = e.value;
|
||||||
const option = this.myChart.getOption();
|
const option = this.myChart.getOption();
|
||||||
const dataList = option.series[e.seriesIndex].data;
|
const dataList = option.series[e.seriesIndex].data;
|
||||||
@ -508,7 +503,8 @@ export default {
|
|||||||
if (model._x == undefined || model._y == undefined) {
|
if (model._x == undefined || model._y == undefined) {
|
||||||
model._x = pointInGrid[0];
|
model._x = pointInGrid[0];
|
||||||
model._y = pointInGrid[1];
|
model._y = pointInGrid[1];
|
||||||
} else {
|
}
|
||||||
|
|
||||||
const dx = pointInGrid[0] - model._x;
|
const dx = pointInGrid[0] - model._x;
|
||||||
const dy = pointInGrid[1] - model._y;
|
const dy = pointInGrid[1] - model._y;
|
||||||
|
|
||||||
@ -524,7 +520,6 @@ export default {
|
|||||||
this.onZrMouseUp(e);
|
this.onZrMouseUp(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
},
|
},
|
||||||
doAreaHornDragging({e, pointInGrid}) {
|
doAreaHornDragging({e, pointInGrid}) {
|
||||||
if (this.drag && ['drag'].includes(this.drag.subType)) {
|
if (this.drag && ['drag'].includes(this.drag.subType)) {
|
||||||
@ -597,7 +592,19 @@ export default {
|
|||||||
this.myChart.setOption(option, {notMerge: true});
|
this.myChart.setOption(option, {notMerge: true});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
doTranslate({e}) {
|
doTranslateSeries({e}) {
|
||||||
|
if (this.dragging) {
|
||||||
|
this.dragging = false;
|
||||||
|
this.$emit('translate');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
doTranslateArea({e}) {
|
||||||
|
if (this.dragging) {
|
||||||
|
this.dragging = false;
|
||||||
|
this.$emit('translate');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
doTranslateHorn({e}) {
|
||||||
if (this.dragging) {
|
if (this.dragging) {
|
||||||
this.dragging = false;
|
this.dragging = false;
|
||||||
this.$emit('translate');
|
this.$emit('translate');
|
||||||
|
Loading…
Reference in New Issue
Block a user