车身计算包围框调整
This commit is contained in:
parent
81c81e5ac1
commit
ce2d67ed2c
@ -470,7 +470,7 @@ class SkinCode extends defaultStyle {
|
||||
trainHSDATextFontSize: 8// 列车HDSA字号
|
||||
},
|
||||
trainAtrStatus: {
|
||||
trainAtrStatusOffset: { x: 80, y: 9},
|
||||
trainAtrStatusOffset: { x: 68, y: 9},
|
||||
r: 5
|
||||
},
|
||||
travelSigns: {
|
||||
@ -480,7 +480,7 @@ class SkinCode extends defaultStyle {
|
||||
trainDelayTimeOffset: { x:5, y: 14}
|
||||
},
|
||||
crewNum: {
|
||||
trainCrewNumOffset: { x:60, y: 25}
|
||||
trainCrewNumOffset: { x:50, y: 25}
|
||||
},
|
||||
travelNum: {
|
||||
trainTravelNumOffset: { x:48, y:3}
|
||||
@ -527,7 +527,7 @@ class SkinCode extends defaultStyle {
|
||||
fixedCoordinates: true, // 列车车组号等固定坐标
|
||||
trainHeight: 40, // 列车高度
|
||||
trainHeadDistance: 2, // 列车和车头之间的间距
|
||||
trainWidth: 90, // 列车长度
|
||||
trainWidth: 76, // 列车长度
|
||||
trainTextFontSize: 12, // 列车字号
|
||||
fontFamily: 'consolas', // 默认字体 族类
|
||||
nameFontSize: 12, // 字体大小
|
||||
|
@ -5,6 +5,7 @@ import ETextName from '../element/ETextName'; // 名称文字 (共有)
|
||||
import EMouse from './EMouse';
|
||||
import store from '@/store';
|
||||
import Circle from 'zrender/src/graphic/shape/Circle';
|
||||
import BoundingRect from "zrender/src/core/BoundingRect";
|
||||
|
||||
/** 车身*/
|
||||
export default class TrainBody extends Group {
|
||||
@ -296,6 +297,22 @@ export default class TrainBody extends Group {
|
||||
setBodyBoxShape(key, color) {
|
||||
this.trainBodyBox && this.trainBodyBox.setColor(key, color);
|
||||
}
|
||||
getBoundingRect() {
|
||||
let rect = null;
|
||||
this.eachChild(elem => {
|
||||
if (elem) {
|
||||
const tempRect = elem.getBoundingRect();
|
||||
if ((tempRect.x || tempRect.y) && tempRect.width && tempRect.height) {
|
||||
if (rect) {
|
||||
rect.union(tempRect);
|
||||
} else {
|
||||
rect = tempRect;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
return rect || new BoundingRect(0, 0, 0, 0);
|
||||
}
|
||||
formatChangePosition(model, style) {
|
||||
if (this.nameFormat) {
|
||||
const arr = this.nameFormat.split(':');
|
||||
|
@ -361,7 +361,6 @@ export default class Train extends Group {
|
||||
getBoundingRect() {
|
||||
const list = [this.trainB, this.trainL, this.trainR];
|
||||
let rect = null;
|
||||
|
||||
list.forEach(elem => {
|
||||
if (elem) {
|
||||
const tempRect = elem.getBoundingRect();
|
||||
@ -374,7 +373,6 @@ export default class Train extends Group {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return rect || new BoundingRect(0, 0, 0, 0);
|
||||
}
|
||||
createTrainBorder() {
|
||||
|
Loading…
Reference in New Issue
Block a user