调整ibp鼠标逻辑

This commit is contained in:
zyy 2020-09-17 16:33:22 +08:00
parent b6f2de4d0f
commit e98b53d8ad
3 changed files with 31 additions and 6 deletions

View File

@ -332,7 +332,7 @@ class SkinCode extends defaultStyle {
spareColor: '#5b5b5b' // 区段显示颜色 spareColor: '#5b5b5b' // 区段显示颜色
}, },
core: { core: {
length: 4 // 道岔单边长度 length: 8 // 道岔单边长度
}, },
jointImg: { // 道岔 A B C D四元素属性配置 jointImg: { // 道岔 A B C D四元素属性配置
trapezoidLength: 8, // 直角梯形元素默认长度 trapezoidLength: 8, // 直角梯形元素默认长度

View File

@ -21,6 +21,8 @@ class ESwLocal extends Group {
style: { style: {
fill: style.backgroundColor fill: style.backgroundColor
// fill: 'red' // fill: 'red'
// lineWidth: style.Section.line.width,
// stroke: style.backgroundColor
}, },
cursor: model.cursor, cursor: model.cursor,
onmouseover: model.onmouseover, onmouseover: model.onmouseover,
@ -47,6 +49,7 @@ class ESwLocal extends Group {
setColor(color) { setColor(color) {
this.locShelter.setStyle({ fill: color }); this.locShelter.setStyle({ fill: color });
// this.locShelter.setStyle({ stroke: color });
} }
animateStyle(cb) { animateStyle(cb) {

View File

@ -1,6 +1,3 @@
/*
* 道岔
*/
import Group from 'zrender/src/container/Group'; import Group from 'zrender/src/container/Group';
import Text from 'zrender/src/graphic/Text'; import Text from 'zrender/src/graphic/Text';
import Rect from 'zrender/src/graphic/shape/Rect'; import Rect from 'zrender/src/graphic/shape/Rect';
@ -50,7 +47,7 @@ export default class Switch extends Group {
const style = this.style; const style = this.style;
const switchWidth = style.Section.line.width + style.Section.line.beyondWidth * 2; // 超出宽度多少 const switchWidth = style.Section.line.width + style.Section.line.beyondWidth * 2; // 超出宽度多少
const swPadding = style.Switch.core.length; const swPadding = style.Switch.core.length + style.Section.line.width / 2;
const directx = this.triangle.drictx; const directx = this.triangle.drictx;
const directy = this.triangle.dricty; const directy = this.triangle.dricty;
const direct = -this.triangle.drictx * this.triangle.dricty; const direct = -this.triangle.drictx * this.triangle.dricty;
@ -66,11 +63,33 @@ export default class Switch extends Group {
const point2 = [model.intersection.x + directx * (width2 + width1) + directx * detailWidth, point1[1]]; const point2 = [model.intersection.x + directx * (width2 + width1) + directx * detailWidth, point1[1]];
const point3 = [point2[0] + directx * this.triangle.getCotRate() * swPadding, point2[1] + directy * swPadding]; const point3 = [point2[0] + directx * this.triangle.getCotRate() * swPadding, point2[1] + directy * swPadding];
const point4 = [point3[0] + direct * this.triangle.getSin(switchWidth) - directx * 2 * detailWidth, point3[1] - direct * this.triangle.getCos(switchWidth)]; const point4 = [point3[0] + direct * this.triangle.getSin(switchWidth) - directx * 2 * detailWidth, point3[1] - direct * this.triangle.getCos(switchWidth)];
// const sectionAModel = Vue.prototype.$jlmap.mapDevice[model.sectionACode];
// const sectionATriangle = new JTriangle(sectionAModel.points[0], sectionAModel.points[1]);
// const sectionAPoint = { x: '', y: '' };
// sectionAModel.points.forEach((point, sectionIndex) => {
// if (point.x == model.intersection.x && point.y == model.intersection.y) {
// sectionAPoint.x = point.x;
// sectionAPoint.y = point.y;
// this.sectionIndex = sectionIndex;
// }
// });
// let directxA = 1;
// // const directxA = sectionATriangle.drictx;
// const drictyyA = sectionATriangle.dricty;
// if (this.sectionIndex != 0) {
// directxA = -1;
// }
// const difference = switchWidth1 * this.triangle.getCosRate();
// const point1 = [model.intersection.x + directx * this.triangle.getCotRate() * swPadding, model.intersection.y + directy * swPadding];
// const point2 = [model.intersection.x, model.intersection.y];
// const point3 = [sectionAPoint.x + directxA * (difference / sectionATriangle.getCosRate()), sectionAPoint.y + drictyyA * difference * sectionATriangle.getTanRate()];
this.locShelter = new ESwLocal({ // 定位 覆盖形状 A this.locShelter = new ESwLocal({ // 定位 覆盖形状 A
zlevel: this.zlevel, zlevel: this.zlevel,
z: this.z, z: this.z,
style: style, style: style,
shelterPoints: [point1, point2, point3, point4], shelterPoints: [point1, point2, point3, point4],
// shelterPoints: [point1, point2, point3],
cursor: 'pointer', cursor: 'pointer',
triangle: this.triangle, triangle: this.triangle,
onmouseover: () => { this.name.getArrowText().show(); }, onmouseover: () => { this.name.getArrowText().show(); },
@ -291,6 +310,9 @@ export default class Switch extends Group {
this.relocShelter.hide(); this.relocShelter.hide();
this.sheltertriangle.hide(); this.sheltertriangle.hide();
} }
// this.relocShelter.show();
// this.relocShelter.setColor('red');
// this.locShelter.setColor('yellow');
this.setTextColor(this.style.Switch.text.locateColor); this.setTextColor(this.style.Switch.text.locateColor);
} }