调整区段鼠标移入元素绘制
This commit is contained in:
parent
d82f381eb1
commit
2de0a0fc5b
@ -81,7 +81,7 @@ class SkinCode extends defaultStyle {
|
||||
textShadowColor: '#22DFDF',
|
||||
nameShow: false,
|
||||
lineDash: '',
|
||||
lineWidthMore: 0
|
||||
lineWidthMore: 5
|
||||
},
|
||||
line: {
|
||||
width: 5, // 区段宽度
|
||||
|
@ -93,9 +93,8 @@ class EMouse extends Group {
|
||||
this.lineBorder.hide();
|
||||
} else {
|
||||
const model = this.device.model;
|
||||
const arr = JSON.parse(JSON.stringify(model.points));
|
||||
arr.reverse();
|
||||
const points = [];
|
||||
let points = [];
|
||||
const pointsReverse = [];
|
||||
model.points.forEach((ele, index) => {
|
||||
let flag = false;
|
||||
if (index == model.points.length - 1) {
|
||||
@ -103,11 +102,9 @@ class EMouse extends Group {
|
||||
} else {
|
||||
this.triangle = new JTriangle(ele, model.points[index + 1]);
|
||||
}
|
||||
const directx = this.triangle.drictx;
|
||||
const directy = this.triangle.dricty;
|
||||
const switchWidth = 5; // 超出宽度多少
|
||||
if (index > 0) {
|
||||
if (model.points[index - 1].y == ele.y) {
|
||||
if (model.points[index - 1].y == ele.y || index < model.points.length - 1 && model.points[index + 1].y == ele.y) {
|
||||
flag = true;
|
||||
}
|
||||
} else {
|
||||
@ -116,40 +113,22 @@ class EMouse extends Group {
|
||||
}
|
||||
}
|
||||
if (flag) {
|
||||
const switchWidth = this.device.style.Section.mouseOverStyle.lineWidthMore; // 超出宽度多少
|
||||
const param = [ele.x, ele.y + switchWidth];
|
||||
points.push(param);
|
||||
const param1 = [ele.x, ele.y - switchWidth];
|
||||
pointsReverse.unshift(param1);
|
||||
} else {
|
||||
const param = [ele.x - directx * this.triangle.getAbsSin(switchWidth), ele.y + directy * this.triangle.getAbsCos(switchWidth)];
|
||||
const switchWidth = this.device.style.Section.mouseOverStyle.lineWidthMore + 3;
|
||||
const T = this.triangle.getAbsCos(switchWidth);
|
||||
const param = [ele.x - directy * this.triangle.getAbsSin(T), ele.y + this.triangle.getAbsCos(T)];
|
||||
points.push(param);
|
||||
const param1 = [ele.x + directy * this.triangle.getAbsSin(T), ele.y - this.triangle.getAbsCos(T)];
|
||||
pointsReverse.unshift(param1);
|
||||
}
|
||||
|
||||
});
|
||||
model.points.forEach((ele, index) => {
|
||||
let flag = false;
|
||||
if (index == model.points.length - 1) {
|
||||
this.triangle = new JTriangle(model.points[index - 1], ele);
|
||||
} else {
|
||||
this.triangle = new JTriangle(ele, model.points[index + 1]);
|
||||
}
|
||||
const directx = this.triangle.drictx;
|
||||
const directy = this.triangle.dricty;
|
||||
const switchWidth = 5; // 超出宽度多少
|
||||
if (index > 0) {
|
||||
if (model.points[index - 1].y == ele.y) {
|
||||
flag = true;
|
||||
}
|
||||
} else {
|
||||
if (model.points[index + 1].y == ele.y) {
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
if (flag) {
|
||||
const param = [ele.x, ele.y - switchWidth];
|
||||
points.unshift(param);
|
||||
} else {
|
||||
const param = [ele.x + directx * this.triangle.getAbsSin(switchWidth), ele.y - directy * this.triangle.getAbsCos(switchWidth)];
|
||||
points.unshift(param);
|
||||
}
|
||||
});
|
||||
points = points.concat(pointsReverse);
|
||||
this.lineBorder = new Polygon({
|
||||
zlevel: this.device.zlevel,
|
||||
z: this.device.z + 10,
|
||||
|
@ -282,7 +282,6 @@ export default class Section extends Group {
|
||||
style: style
|
||||
});
|
||||
this.add(this.section);
|
||||
|
||||
if (this.style.Section.block.special) { // 创建哈尔滨特殊区段(用作封锁显示)
|
||||
this.sectionBlock = new EblockLines({
|
||||
zlevel: this.zlevel,
|
||||
@ -381,20 +380,22 @@ export default class Section extends Group {
|
||||
const model = this.model;
|
||||
const style = this.style;
|
||||
const traingle = new JTriangle(model.points[0], model.points[model.points.length - 1]);
|
||||
this.release = new ERelease({
|
||||
zlevel: this.zlevel,
|
||||
z: this.z,
|
||||
shape: {
|
||||
x1: model.points[0].x + traingle.getCos(traingle.absz / 3),
|
||||
y1: model.points[0].y + traingle.getSin(traingle.absz / 3),
|
||||
x2: model.points[0].x + traingle.getCos(traingle.absz / 3 * 2),
|
||||
y2: model.points[0].y + traingle.getSin(traingle.absz / 3 * 2)
|
||||
},
|
||||
lineWidth: style.Section.line.width,
|
||||
stroke: style.Section.line.spareColor
|
||||
});
|
||||
if ((model.type == '01' && (!model.logicSectionCodeList || !model.logicSectionCodeList.length)) || model.type == '02' || model.type == '03') {
|
||||
this.release = new ERelease({
|
||||
zlevel: this.zlevel,
|
||||
z: this.z,
|
||||
shape: {
|
||||
x1: model.points[0].x + traingle.getCos(traingle.absz / 3),
|
||||
y1: model.points[0].y + traingle.getSin(traingle.absz / 3),
|
||||
x2: model.points[0].x + traingle.getCos(traingle.absz / 3 * 2),
|
||||
y2: model.points[0].y + traingle.getSin(traingle.absz / 3 * 2)
|
||||
},
|
||||
lineWidth: style.Section.line.width,
|
||||
stroke: style.Section.line.spareColor
|
||||
});
|
||||
|
||||
this.add(this.release);
|
||||
this.add(this.release);
|
||||
}
|
||||
}
|
||||
|
||||
// 创建限速线
|
||||
|
@ -1026,9 +1026,7 @@ export default {
|
||||
model.leftStopPointOffset = 5;
|
||||
model.rightStopPointOffset = model.lengthFact - 5;
|
||||
}
|
||||
const changeSectionList = this.handleOtherSectionChange(
|
||||
model
|
||||
);
|
||||
const changeSectionList = this.handleOtherSectionChange(model);
|
||||
models = [model, ...changeSectionList];
|
||||
|
||||
this.$emit('updateMapModel', models);
|
||||
@ -1044,13 +1042,9 @@ export default {
|
||||
// 处理该区段改变导致的相关区段的变化
|
||||
const models = [];
|
||||
const pointModel = [];
|
||||
const slope1 =
|
||||
(this.oldPoint[this.oldPoint.length - 1].y -
|
||||
this.oldPoint[0].y) /
|
||||
(this.oldPoint[this.oldPoint.length - 1].x -
|
||||
this.oldPoint[0].x);
|
||||
const slope1 = (this.oldPoint[this.oldPoint.length - 1].y - this.oldPoint[0].y) / (this.oldPoint[this.oldPoint.length - 1].x - this.oldPoint[0].x);
|
||||
this.sectionList.forEach(section => {
|
||||
if (section.parentCode === model.code) {
|
||||
if (section.parentCode === model.code) { // 逻辑区段
|
||||
const copySection = deepAssign({}, section);
|
||||
copySection.logicSectionShow = model.logicSectionShow;
|
||||
// copySection.lengthFact = (Number(model.lengthFact) / model.logicSectionCodeList.length).toFixed(3); // 容易处理成无限大
|
||||
@ -1061,10 +1055,7 @@ export default {
|
||||
copySection.points[copySection.points.length - 1] = model.points[model.points.length - 1];
|
||||
}
|
||||
models.push(copySection);
|
||||
} else if (
|
||||
model.code !== section.code &&
|
||||
(section.type === '01' || section.type === '03' || section.type === '02')
|
||||
) {
|
||||
} else if (model.code !== section.code && (section.type === '01' || section.type === '03' || section.type === '02')) {
|
||||
const copySection = deepAssign({}, section);
|
||||
let updataFlag = false;
|
||||
if (model.leftSectionCode !== this.oldLeftSectionCode) {
|
||||
@ -1089,16 +1080,12 @@ export default {
|
||||
updataFlag = true;
|
||||
}
|
||||
}
|
||||
if (model.parentCode == copySection.code) {
|
||||
if (model.parentCode == copySection.code) { // 物理区段
|
||||
let lengthFact = 0;
|
||||
copySection.logicSectionCodeList.forEach(code => {
|
||||
if (model.code != code) {
|
||||
const localSectionModel = this.$store.getters[
|
||||
'map/getDeviceByCode'
|
||||
](code);
|
||||
lengthFact += Number(
|
||||
localSectionModel.lengthFact
|
||||
);
|
||||
const localSectionModel = this.$store.getters['map/getDeviceByCode'](code);
|
||||
lengthFact += Number(localSectionModel.lengthFact);
|
||||
}
|
||||
});
|
||||
lengthFact += model.lengthFact;
|
||||
|
@ -145,7 +145,7 @@ export default {
|
||||
models.forEach(item=> {
|
||||
logicSectionCodeList.push(item.code);
|
||||
});
|
||||
this.editModel.logicSectionCodeList.forEach( logicCode => {
|
||||
this.editModel.logicSectionCodeList.forEach(logicCode => {
|
||||
const section = this.$store.getters['map/getDeviceByCode'](logicCode);
|
||||
models.push(deepAssign(section, {_dispose: true}));
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user