调整西安二号线鼠标移入

This commit is contained in:
zyy 2020-05-06 13:11:37 +08:00
parent 94ca9bce69
commit adf2627fec
5 changed files with 69 additions and 7 deletions

View File

@ -80,7 +80,10 @@ class SkinCode extends defaultStyle {
mouseOverStyle: { mouseOverStyle: {
borderColor: '#fff', borderColor: '#fff',
borderBackgroundColor: '#22DFDF', borderBackgroundColor: '#22DFDF',
textShadowColor: '#22DFDF' textShadowColor: '#22DFDF',
nameShow: true,
lineDash: [3, 3],
lineWidthMore: 0
}, },
line: { line: {
width: 5, // 区段宽度 width: 5, // 区段宽度

View File

@ -75,6 +75,14 @@ class SkinCode extends defaultStyle {
textPosition: 'inside', // 文字位置 textPosition: 'inside', // 文字位置
textVerticalAlign: 'middle' // 文字垂直对齐方式 textVerticalAlign: 'middle' // 文字垂直对齐方式
}, },
mouseOverStyle: {
borderColor: '#fff',
borderBackgroundColor: '#22DFDF',
textShadowColor: '#22DFDF',
nameShow: false,
lineDash: null,
lineWidthMore: 6
},
line: { line: {
width: 4, // 区段宽度 width: 4, // 区段宽度
beyondWidth: 0, // 区段宽超出宽度 beyondWidth: 0, // 区段宽超出宽度

View File

@ -1,7 +1,9 @@
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';
// import Polygon from 'zrender/src/graphic/shape/Polygon';
import store from '@/store/index_APP_TARGET'; import store from '@/store/index_APP_TARGET';
// import JTriangle from '../../utils/JTriangle';
class EMouse extends Group { class EMouse extends Group {
constructor(device, code) { constructor(device, code) {
super(); super();
@ -11,7 +13,7 @@ class EMouse extends Group {
} }
create() { create() {
// 名称的包围框 // 名称的包围框
if (this.device.name) { if (this.device.name && this.device.style.Section.mouseOverStyle.nameShow) {
const rect = this.device.name.getBoundingRect(); const rect = this.device.name.getBoundingRect();
if (!this.device.isSwitchSection) { if (!this.device.isSwitchSection) {
this.sectionTextBorder = new Rect({ this.sectionTextBorder = new Rect({
@ -69,16 +71,65 @@ class EMouse extends Group {
// 区段包围框 // 区段包围框
if (this.device.section) { if (this.device.section) {
const rect = this.device.section.getBoundingRect(); const rect = this.device.section.getBoundingRect();
rect.height = rect.height + this.device.style.Section.mouseOverStyle.lineWidthMore;
const shape = {
x: rect.x,
y: rect.y - this.device.style.Section.mouseOverStyle.lineWidthMore / 2,
width: rect.width,
height: rect.height
};
this.lineBorder = new Rect({ this.lineBorder = new Rect({
zlevel: this.device.zlevel, zlevel: this.device.zlevel,
z: this.device.z - 1, z: this.device.z - 1,
shape: rect, shape: shape,
style: { style: {
lineDash: [3, 3], lineDash: this.device.style.Section.mouseOverStyle.lineDash,
stroke: this.device.style.Section.mouseOverStyle.borderColor, stroke: this.device.style.Section.mouseOverStyle.borderColor,
fill: this.device.style.transparentColor fill: this.device.style.transparentColor
} }
}); });
// const model = this.device.model;
// const arr = JSON.parse(JSON.stringify(model.points));
// arr.reverse();
// const points = [];
// model.points.forEach((ele, index) => {
// if (index == model.points.length - 1) {
// this.triangle = new JTriangle(model.points[index - 1], ele);
// } else {
// console.log(ele, model.points[index + 1]);
// this.triangle = new JTriangle(ele, model.points[index + 1]);
// }
// const directx = this.triangle.drictx;
// const directy = this.triangle.dricty;
// const x = 5 * this.triangle.getSinRate();
// console.log(this.triangle.getCosRate(), this.triangle.getSinRate());
// const y = 5;
// points.push([ele.x - (directx * x), ele.y - (directy * y)]);
// });
// arr.forEach((ele, index) => {
// if (index == arr.length - 1) {
// this.triangle = new JTriangle(arr[index - 1], ele);
// } else {
// this.triangle = new JTriangle(ele, arr[index + 1]);
// }
// const directx = this.triangle.drictx;
// const directy = this.triangle.dricty;
// const x = 5 * this.triangle.getSinRate();
// const y = 5;
// points.push([ele.x + (directx * x), ele.y + (directy * y)]);
// });
// this.lineBorder = new Polygon({
// zlevel: this.device.zlevel,
// z: this.device.z - 1,
// shape: {
// points: points
// },
// style: {
// lineDash: this.device.style.Section.mouseOverStyle.lineDash,
// stroke: this.device.style.Section.mouseOverStyle.borderColor,
// fill: this.device.style.transparentColor
// }
// });
this.add(this.lineBorder); this.add(this.lineBorder);
this.lineBorder.hide(); this.lineBorder.hide();

View File

@ -771,7 +771,7 @@ export default class Section extends Group {
} }
createMouseEvent() { // 鼠标事件 createMouseEvent() { // 鼠标事件
if (this.style.Section.mouseOverStyle) { // 只有北京线路才会有鼠标事件 if (this.style.Section.mouseOverStyle) {
this.mouseEvent = new EMouse(this, this.model.relSwitchCode); this.mouseEvent = new EMouse(this, this.model.relSwitchCode);
this.add(this.mouseEvent); this.add(this.mouseEvent);
this.on('mouseout', (e) => { this.mouseEvent.mouseout(e); }); this.on('mouseout', (e) => { this.mouseEvent.mouseout(e); });

View File

@ -2,9 +2,9 @@ export function getBaseUrl() {
let BASE_API; let BASE_API;
if (process.env.NODE_ENV === 'development') { if (process.env.NODE_ENV === 'development') {
// BASE_API = 'https://joylink.club/jlcloud'; // BASE_API = 'https://joylink.club/jlcloud';
// BASE_API = 'https://test.joylink.club/jlcloud'; BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'http://192.168.3.5:9000'; // 袁琪 // BASE_API = 'http://192.168.3.5:9000'; // 袁琪
BASE_API = 'http://192.168.3.6:9000'; // 旭强 // BASE_API = 'http://192.168.3.6:9000'; // 旭强
// BASE_API = 'http://192.168.3.41:9000'; // 张赛 // BASE_API = 'http://192.168.3.41:9000'; // 张赛
// BASE_API = 'http://192.168.3.82:9000'; // 杜康 // BASE_API = 'http://192.168.3.82:9000'; // 杜康
// BASE_API = 'http://192.168.3.41:9000'; // 张赛 // BASE_API = 'http://192.168.3.41:9000'; // 张赛