File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
apps/roam/src/components/canvas Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -770,7 +770,23 @@ const ClipboardPageSection = ({
770770 const zoomLevel = editor . getZoomLevel ( ) ;
771771 const screenW = w * zoomLevel ;
772772 const screenH = h * zoomLevel ;
773- const containerRect = containerRef . getBoundingClientRect ( ) ;
773+
774+ let scrollableContainer : HTMLElement | null = containerRef ;
775+ while ( scrollableContainer ) {
776+ const style = window . getComputedStyle ( scrollableContainer ) ;
777+ if (
778+ style . overflowY === "auto" ||
779+ style . overflowY === "scroll" ||
780+ style . overflow === "auto" ||
781+ style . overflow === "scroll"
782+ ) {
783+ break ;
784+ }
785+ scrollableContainer = scrollableContainer . parentElement ;
786+ }
787+
788+ const checkContainer = scrollableContainer || containerRef ;
789+ const containerRect = checkContainer . getBoundingClientRect ( ) ;
774790 const box = new Box (
775791 containerRect . x ,
776792 containerRect . y ,
You can’t perform that action at this time.
0 commit comments