修改代码

This commit is contained in:
zyy 2019-07-19 14:30:26 +08:00
parent 8f534ce10a
commit d99d1b9ecc
8 changed files with 86 additions and 75 deletions

View File

@ -131,6 +131,7 @@ class Jmap {
}
setOptions(zoom) {
console.log(zoom, '1111');
this.$options.update(this.pullBack(zoom));
this.$painter.updateZoomTransform(this.$options);
if (this.methods.optionsUpdate instanceof Function) { this.methods.optionsUpdate(); }

View File

@ -48,7 +48,7 @@ class MouseController extends Eventful {
zr.on('click', clickHandler);
zr.on('contextmenu', contextmenuHandler);
zr.on('mousemove', moveEventHandler);
// zr.on('mousemove', moveEventHandler);
this.enable = function (opts) {
opts = opts || {};

View File

@ -193,7 +193,8 @@ class Signal extends Group {
// 封锁
block() {
this.lamps[0] && this.lamps[0].setColor(this.style.Signal.signalLampRedColor);
this.sigName.setColor(this.style.Signal.sectionBlockTextColor);
// this.sigName.setColor(this.style.Signal.sectionBlockTextColor);
this.sigName.setStyle({'textFill': this.style.Signal.sectionBlockTextColor});
}
// 功能封锁
@ -269,7 +270,8 @@ class Signal extends Group {
recover() {
this.sigDelay.hide();
this.sigPass.animationRecover();
this.sigName.setColor(this.style.Signal.signalTextGreen);
// this.sigName.setColor(this.style.Signal.signalTextGreen);
this.sigName.setStyle({'textFill': this.style.Signal.signalTextGreen});
}
setState(state) {

View File

@ -28,8 +28,8 @@ export default class StationControl extends Group {
style: this.style,
zlevel: this.zlevel,
point: {
x: model.position.x - this.style.StationControl.stationControlDistance * 3 / 2,
y: model.position.y
x: model.position.x - this.style.StationControl.stationControlDistance * 3 / 2 + this.style.StationControl.stationOffset.x,
y: model.position.y + this.style.StationControl.stationOffset.y
},
context: model.jjzkContent,
pop: false
@ -40,8 +40,8 @@ export default class StationControl extends Group {
style: this.style,
zlevel: this.zlevel,
point: {
x: model.position.x - this.style.StationControl.stationControlDistance / 2,
y: model.position.y
x: model.position.x - this.style.StationControl.stationControlDistance / 2 + this.style.StationControl.stationOffset.x,
y: model.position.y + this.style.StationControl.stationOffset.y
},
context: model.zokContent,
pop: false
@ -52,8 +52,8 @@ export default class StationControl extends Group {
style: this.style,
zlevel: this.zlevel,
point: {
x: model.position.x + this.style.StationControl.stationControlDistance / 2,
y: model.position.y
x: model.position.x + this.style.StationControl.stationControlDistance / 2 + this.style.StationControl.stationOffset.x,
y: model.position.y + this.style.StationControl.stationOffset.y
},
context: model.zakContent,
pop: false
@ -69,23 +69,11 @@ export default class StationControl extends Group {
count: this.count,
drict: 1,
point: point,
x: model.position.x,
y: model.position.y + this.style.StationControl.stationControlmodeR / 2,
x: model.position.x + this.style.StationControl.stationOffset.x,
y: model.position.y + this.style.StationControl.stationControlmodeR / 2 + this.style.StationControl.stationOffset.y,
fill: this.style.StationControl.stationControlGrayColor,
lineWidth: 1,
stroke: this.style.sidelineColor
// cursor: 'pointer',
// // 图形元素上绑定事件
// onmouseover: () => {
// if (model.status == '03') {
// this.add(this.arrowText);
// }
// },
// onmouseout: () => {
// if (model.status == '03') {
// this.remove(this.arrowText);
// }
// }
});
this.add(this.arrowsControl);
}

View File

@ -1,49 +1,67 @@
import Group from 'zrender/src/container/Group';
// import Group from 'zrender/src/container/Group';
import Text from 'zrender/src/graphic/Text';
/** 名称元素*/
export default class ETextName extends Group {
constructor(model) {
super();
this.model = model;
this.zlevel = model.zlevel;
this.z = model.z;
this._create();
}
_create() {
this.TextName = new Text({
_subType: this.model._subType,
zlevel: this.zlevel,
z: this.z,
silent: this.model.silent || false,
style: {
x: this.model.x,
y: this.model.y,
text: this.model.text,
textFont: this.model.textFont,
textFill: this.model.textFill,
textAlign: this.model.textAlign,
textPosition: this.model.textPosition || 'inside',
textVerticalAlign: this.model.textVerticalAlign || null
}
});
this.add(this.TextName);
}
setStyle(model) {
this.TextName.setStyle(model);
}
setColor(color) {
this.TextName.setStyle('textFill', color);
}
hide() {
this.TextName.hide();
}
show() {
this.TextName.show();
}
export default function ETextName(model) {
return new Text({
_subType: model._subType,
zlevel: model.zlevel,
z: model.z,
silent: model.silent || false,
style: {
x: model.x,
y: model.y,
text: model.text,
textFont: model.textFont,
textFill: model.textFill,
textAlign: model.textAlign,
textPosition: model.textPosition || 'inside',
textVerticalAlign: model.textVerticalAlign || null
}
});
}
// export default class ETextName extends Group {
// constructor(model) {
// super();
// this.model = model;
// this.zlevel = model.zlevel;
// this.z = model.z;
// this._create();
// }
// _create() {
// this.TextName = new Text({
// _subType: this.model._subType,
// zlevel: this.zlevel,
// z: this.z,
// silent: this.model.silent || false,
// style: {
// x: this.model.x,
// y: this.model.y,
// text: this.model.text,
// textFont: this.model.textFont,
// textFill: this.model.textFill,
// textAlign: this.model.textAlign,
// textPosition: this.model.textPosition || 'inside',
// textVerticalAlign: this.model.textVerticalAlign || null
// }
// });
// this.add(this.TextName);
// }
// setStyle(model) {
// this.TextName.setStyle(model);
// }
// setColor(color) {
// this.TextName.setStyle('textFill', color);
// }
// hide() {
// this.TextName.hide();
// }
// show() {
// this.TextName.show();
// }
// }

View File

@ -196,7 +196,8 @@ class Beijing extends defaultSkin {
};
this[deviceType.StationControl] = {
singleControlNum: 3,
arrowsShow: false,
stationOffset: {x: 20, y: 0},
arrowsShow: false, // 控制模式箭头显隐
/** 控制模式字体大小*/
stationControlTextSize: 10,
/** 控制模式灯的半径 */

View File

@ -193,7 +193,8 @@ class Fuzhou extends defaultSkin {
};
this[deviceType.StationControl] = {
singleControlNum: 2,
arrowsShow: true,
stationOffset: {x: 0, y: 0},
arrowsShow: true, // 控制模式箭头显隐
/** 控制模式字体大小*/
stationControlTextSize: 10,
/** 控制模式灯的半径 */

View File

@ -12,7 +12,7 @@ export default {
data() {
return {
id: '__jmap__',
jmap: null,
jmap: null
};
},
mounted() {
@ -37,8 +37,8 @@ export default {
viewLoaded() { console.log('viewLoaded'); },
stateLoaded() { console.log('stateLoaded'); },
viewUpdate() { console.log('viewUpdate'); },
stateUpdate() { console.log('stateUpdate'); },
optionsUpdate() { console.log('optionsUpdate'); }
stateUpdate() { console.log('stateUpdate'); }
// optionsUpdate() { console.log('optionsUpdate'); }
}
});
@ -46,7 +46,7 @@ export default {
this.jmap.on('contextmenu', this.contextmenu);
// const list = [];
// for (let i = 1; i < 40; i++) {
// for (let i = 1; i < 20; i++) {
// for (let j = 1; j < 1000; j++) {
// list.push({ code: `${(Array(3).join(0) + i).slice(-3)}${(Array(3).join(0) + j).slice(-3)}`, lp: { x: 50 + i * 120, y: 50 + j * 20 }, rp: { x: 150 + i * 120, y: 50 + j * 20 } });
// }
@ -54,7 +54,7 @@ export default {
// this.jmap.load({ skinVO: { code: '02' }, linkList: list });
getPublishMapDetail('02').then(resp => {
getPublishMapDetail('03').then(resp => {
this.jmap.load(resp.data);
// this.jmap.setDefaultState();
this.jmap.setLevelInvisible([deviceType.Link]);