fix: table elements position when zooming

This commit is contained in:
Hufe921
2023-03-23 17:44:27 +08:00
committed by Hufe
parent 5c529b76ca
commit 3ff0eea948
+5 -4
View File
@@ -290,13 +290,14 @@ export class Position {
let curPositionIndex = -1 let curPositionIndex = -1
// 判断是否在表格内 // 判断是否在表格内
if (isTable) { if (isTable) {
const { scale } = this.options
const { td, tablePosition } = payload const { td, tablePosition } = payload
if (td && tablePosition) { if (td && tablePosition) {
const { leftTop } = tablePosition.coordinate const { leftTop } = tablePosition.coordinate
const tdX = td.x! + leftTop[0] const tdX = td.x! * scale + leftTop[0]
const tdY = td.y! + leftTop[1] const tdY = td.y! * scale + leftTop[1]
const tdWidth = td.width! const tdWidth = td.width! * scale
const tdHeight = td.height! const tdHeight = td.height! * scale
if (!(tdX < x && x < tdX + tdWidth && tdY < y && y < tdY + tdHeight)) { if (!(tdX < x && x < tdX + tdWidth && tdY < y && y < tdY + tdHeight)) {
return { return {
index: curPositionIndex index: curPositionIndex