| | |
| | | getCellByTouch(touch, cb) { |
| | | this.getGridRect(rect => { |
| | | if (!rect) return |
| | | const x = touch.clientX - rect.left + this.scrollLeft |
| | | const x = touch.clientX + this.scrollLeft |
| | | const y = touch.clientY - rect.top |
| | | const colCount = this.width * (this.modeVal == 2 ? 10 : 1) |
| | | const cellWidth = rect.width / colCount |
| | | const cellHeight = rect.height / this.height |
| | | const colIndex = Math.floor(x / cellWidth) |
| | | const rowIndex = Math.floor(y / cellHeight) |
| | | console.log('colCount', colCount, 'rowIndex', rowIndex, 'colIndex', colIndex) |
| | | //console.log('colCount', colCount, 'rowIndex', rowIndex, 'colIndex', colIndex, x, cellWidth) |
| | | if ( |
| | | colIndex >= 0 && colIndex < colCount && |
| | | rowIndex >= 0 && rowIndex < this.height |