|
@@ -1,6 +1,10 @@
|
|
import { AppState, PointerCoords, Zoom } from "../types";
|
|
import { AppState, PointerCoords, Zoom } from "../types";
|
|
import { ExcalidrawElement } from "../element/types";
|
|
import { ExcalidrawElement } from "../element/types";
|
|
-import { getCommonBounds, getClosestElementBounds } from "../element";
|
|
|
|
|
|
+import {
|
|
|
|
+ getCommonBounds,
|
|
|
|
+ getClosestElementBounds,
|
|
|
|
+ getVisibleElements,
|
|
|
|
+} from "../element";
|
|
|
|
|
|
import {
|
|
import {
|
|
sceneCoordsToViewportCoords,
|
|
sceneCoordsToViewportCoords,
|
|
@@ -53,6 +57,8 @@ export const calculateScrollCenter = (
|
|
appState: AppState,
|
|
appState: AppState,
|
|
canvas: HTMLCanvasElement | null,
|
|
canvas: HTMLCanvasElement | null,
|
|
): { scrollX: number; scrollY: number } => {
|
|
): { scrollX: number; scrollY: number } => {
|
|
|
|
+ elements = getVisibleElements(elements);
|
|
|
|
+
|
|
if (!elements.length) {
|
|
if (!elements.length) {
|
|
return {
|
|
return {
|
|
scrollX: 0,
|
|
scrollX: 0,
|