fix: scrollToContent only on visible elements (#3466)
This commit is contained in:
@ -1,6 +1,10 @@
|
||||
import { AppState, PointerCoords, Zoom } from "../types";
|
||||
import { ExcalidrawElement } from "../element/types";
|
||||
import { getCommonBounds, getClosestElementBounds } from "../element";
|
||||
import {
|
||||
getCommonBounds,
|
||||
getClosestElementBounds,
|
||||
getVisibleElements,
|
||||
} from "../element";
|
||||
|
||||
import {
|
||||
sceneCoordsToViewportCoords,
|
||||
@ -53,6 +57,8 @@ export const calculateScrollCenter = (
|
||||
appState: AppState,
|
||||
canvas: HTMLCanvasElement | null,
|
||||
): { scrollX: number; scrollY: number } => {
|
||||
elements = getVisibleElements(elements);
|
||||
|
||||
if (!elements.length) {
|
||||
return {
|
||||
scrollX: 0,
|
||||
|
Reference in New Issue
Block a user