修改代码

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) { setOptions(zoom) {
console.log(zoom, '1111');
this.$options.update(this.pullBack(zoom)); this.$options.update(this.pullBack(zoom));
this.$painter.updateZoomTransform(this.$options); this.$painter.updateZoomTransform(this.$options);
if (this.methods.optionsUpdate instanceof Function) { this.methods.optionsUpdate(); } 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('click', clickHandler);
zr.on('contextmenu', contextmenuHandler); zr.on('contextmenu', contextmenuHandler);
zr.on('mousemove', moveEventHandler); // zr.on('mousemove', moveEventHandler);
this.enable = function (opts) { this.enable = function (opts) {
opts = opts || {}; opts = opts || {};

View File

@ -193,7 +193,8 @@ class Signal extends Group {
// 封锁 // 封锁
block() { block() {
this.lamps[0] && this.lamps[0].setColor(this.style.Signal.signalLampRedColor); 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() { recover() {
this.sigDelay.hide(); this.sigDelay.hide();
this.sigPass.animationRecover(); 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) { setState(state) {

View File

@ -28,8 +28,8 @@ export default class StationControl extends Group {
style: this.style, style: this.style,
zlevel: this.zlevel, zlevel: this.zlevel,
point: { point: {
x: model.position.x - this.style.StationControl.stationControlDistance * 3 / 2, x: model.position.x - this.style.StationControl.stationControlDistance * 3 / 2 + this.style.StationControl.stationOffset.x,
y: model.position.y y: model.position.y + this.style.StationControl.stationOffset.y
}, },
context: model.jjzkContent, context: model.jjzkContent,
pop: false pop: false
@ -40,8 +40,8 @@ export default class StationControl extends Group {
style: this.style, style: this.style,
zlevel: this.zlevel, zlevel: this.zlevel,
point: { point: {
x: model.position.x - this.style.StationControl.stationControlDistance / 2, x: model.position.x - this.style.StationControl.stationControlDistance / 2 + this.style.StationControl.stationOffset.x,
y: model.position.y y: model.position.y + this.style.StationControl.stationOffset.y
}, },
context: model.zokContent, context: model.zokContent,
pop: false pop: false
@ -52,8 +52,8 @@ export default class StationControl extends Group {
style: this.style, style: this.style,
zlevel: this.zlevel, zlevel: this.zlevel,
point: { point: {
x: model.position.x + this.style.StationControl.stationControlDistance / 2, x: model.position.x + this.style.StationControl.stationControlDistance / 2 + this.style.StationControl.stationOffset.x,
y: model.position.y y: model.position.y + this.style.StationControl.stationOffset.y
}, },
context: model.zakContent, context: model.zakContent,
pop: false pop: false
@ -69,23 +69,11 @@ export default class StationControl extends Group {
count: this.count, count: this.count,
drict: 1, drict: 1,
point: point, point: point,
x: model.position.x, x: model.position.x + this.style.StationControl.stationOffset.x,
y: model.position.y + this.style.StationControl.stationControlmodeR / 2, y: model.position.y + this.style.StationControl.stationControlmodeR / 2 + this.style.StationControl.stationOffset.y,
fill: this.style.StationControl.stationControlGrayColor, fill: this.style.StationControl.stationControlGrayColor,
lineWidth: 1, lineWidth: 1,
stroke: this.style.sidelineColor 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); 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'; import Text from 'zrender/src/graphic/Text';
/** 名称元素*/ /** 名称元素*/
export default class ETextName extends Group { export default function ETextName(model) {
constructor(model) { return new Text({
super(); _subType: model._subType,
this.model = model; zlevel: model.zlevel,
this.zlevel = model.zlevel; z: model.z,
this.z = model.z; silent: model.silent || false,
this._create(); style: {
} x: model.x,
y: model.y,
_create() { text: model.text,
this.TextName = new Text({ textFont: model.textFont,
_subType: this.model._subType, textFill: model.textFill,
zlevel: this.zlevel, textAlign: model.textAlign,
z: this.z, textPosition: model.textPosition || 'inside',
silent: this.model.silent || false, textVerticalAlign: model.textVerticalAlign || null
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 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] = { this[deviceType.StationControl] = {
singleControlNum: 3, singleControlNum: 3,
arrowsShow: false, stationOffset: {x: 20, y: 0},
arrowsShow: false, // 控制模式箭头显隐
/** 控制模式字体大小*/ /** 控制模式字体大小*/
stationControlTextSize: 10, stationControlTextSize: 10,
/** 控制模式灯的半径 */ /** 控制模式灯的半径 */

View File

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

View File

@ -12,7 +12,7 @@ export default {
data() { data() {
return { return {
id: '__jmap__', id: '__jmap__',
jmap: null, jmap: null
}; };
}, },
mounted() { mounted() {
@ -37,8 +37,8 @@ export default {
viewLoaded() { console.log('viewLoaded'); }, viewLoaded() { console.log('viewLoaded'); },
stateLoaded() { console.log('stateLoaded'); }, stateLoaded() { console.log('stateLoaded'); },
viewUpdate() { console.log('viewUpdate'); }, viewUpdate() { console.log('viewUpdate'); },
stateUpdate() { console.log('stateUpdate'); }, stateUpdate() { console.log('stateUpdate'); }
optionsUpdate() { console.log('optionsUpdate'); } // optionsUpdate() { console.log('optionsUpdate'); }
} }
}); });
@ -46,7 +46,7 @@ export default {
this.jmap.on('contextmenu', this.contextmenu); this.jmap.on('contextmenu', this.contextmenu);
// const list = []; // const list = [];
// for (let i = 1; i < 40; i++) { // for (let i = 1; i < 20; i++) {
// for (let j = 1; j < 1000; j++) { // 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 } }); // 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 }); // this.jmap.load({ skinVO: { code: '02' }, linkList: list });
getPublishMapDetail('02').then(resp => { getPublishMapDetail('03').then(resp => {
this.jmap.load(resp.data); this.jmap.load(resp.data);
// this.jmap.setDefaultState(); // this.jmap.setDefaultState();
this.jmap.setLevelInvisible([deviceType.Link]); this.jmap.setLevelInvisible([deviceType.Link]);