恢复AUSTool坐标转换限制

This commit is contained in:
lVAL 2020-10-26 17:11:17 +08:00
parent ffab228863
commit baea2091ed

View File

@ -34,18 +34,22 @@ export default {
this.listenersOff(); this.listenersOff();
}, },
methods: { methods: {
pixelExecCb(e, cb) { pixelExecCb(e, cb=e => {}) {
const event = e.componentType ? e.event: e; const event = e.componentType ? e.event: e;
const pointInPixel = [event.offsetX, event.offsetY] const pointInPixel = [event.offsetX, event.offsetY]
const pointInGrid = this.myChart.convertFromPixel('grid', pointInPixel); const pointInGrid = this.myChart.convertFromPixel('grid', pointInPixel);
const xIndex = pointInGrid[0]; if (this.myChart.containPixel('grid', pointInPixel) && this.planUtil) {
const yIndex = pointInGrid[1]; const xIndex = pointInGrid[0];
const option = this.myChart.getOption(); const yIndex = pointInGrid[1];
const minY = option.yAxis[0].min; const option = this.myChart.getOption();
const xVal = option.xAxis[0].data[xIndex]; const minY = option.yAxis[0].min;
const yObj = this.planUtil.getStationByCoordinateY(this.stations, yIndex-minY); const xVal = option.xAxis[0].data[xIndex];
cb && cb({yObj, xVal, pointInPixel, pointInGrid, e}); const yObj = this.planUtil.getStationByCoordinateY(this.stations, yIndex-minY);
if (yObj) {
cb({yObj, xVal, pointInPixel, pointInGrid, e});
}
}
}, },
listenersBind() { listenersBind() {
if (this.myChart) { if (this.myChart) {