恢复AUSTool坐标转换限制
This commit is contained in:
parent
ffab228863
commit
baea2091ed
@ -34,18 +34,22 @@ export default {
|
||||
this.listenersOff();
|
||||
},
|
||||
methods: {
|
||||
pixelExecCb(e, cb) {
|
||||
pixelExecCb(e, cb=e => {}) {
|
||||
const event = e.componentType ? e.event: e;
|
||||
const pointInPixel = [event.offsetX, event.offsetY]
|
||||
const pointInGrid = this.myChart.convertFromPixel('grid', pointInPixel);
|
||||
|
||||
const xIndex = pointInGrid[0];
|
||||
const yIndex = pointInGrid[1];
|
||||
const option = this.myChart.getOption();
|
||||
const minY = option.yAxis[0].min;
|
||||
const xVal = option.xAxis[0].data[xIndex];
|
||||
const yObj = this.planUtil.getStationByCoordinateY(this.stations, yIndex-minY);
|
||||
cb && cb({yObj, xVal, pointInPixel, pointInGrid, e});
|
||||
if (this.myChart.containPixel('grid', pointInPixel) && this.planUtil) {
|
||||
const xIndex = pointInGrid[0];
|
||||
const yIndex = pointInGrid[1];
|
||||
const option = this.myChart.getOption();
|
||||
const minY = option.yAxis[0].min;
|
||||
const xVal = option.xAxis[0].data[xIndex];
|
||||
const yObj = this.planUtil.getStationByCoordinateY(this.stations, yIndex-minY);
|
||||
if (yObj) {
|
||||
cb({yObj, xVal, pointInPixel, pointInGrid, e});
|
||||
}
|
||||
}
|
||||
},
|
||||
listenersBind() {
|
||||
if (this.myChart) {
|
||||
|
Loading…
Reference in New Issue
Block a user