dream-num / univer

Univer is an open-source alternative to Google Sheets, Slides, and Docs
https://univer.ai
Apache License 2.0
5.75k stars 476 forks source link

[Feature] [Feature] We can get the position of the table relative to the edge of the table through const react = range.getCellRect();, but because the table may be scrolled, how do we know the position of the table on the current screen? #2680

Open feige-2011 opened 4 days ago

feige-2011 commented 4 days ago

初始清单

问题

我需要自定义空间在表格外部,需要获取表格相对于屏幕的位置,但是目前我通过 const react = range.getCellRect();拿到的位置是相对于表格的位置,不是相对于外层容器的位置

解决方案

在range.getCellRect 中加上相对于表格屏幕边缘的位置,或者其他获取位置的方法

univer-bot[bot] commented 4 days ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿

Origin Title: [Feature] [Feature] 我们能通过 const react = range.getCellRect(); 获取表格相对于表格边缘的位置,但因为表格可能是滚动过的,我们怎么知道表格在当前屏幕的位置啊?

Title: [Feature] [Feature] We can get the position of the table relative to the edge of the table through const react = range.getCellRect();, but because the table may be scrolled, how do we know the position of the table on the current screen?


Initial list

question

I need to customize the space outside the table, and I need to get the position of the table relative to the screen, but currently the position I get through const react = range.getCellRect(); is relative to the position of the table, not the position relative to the outer container.

solution

Add the position relative to the edge of the table screen in range.getCellRect, or other methods of obtaining the position.