mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Add button when scrolled outside of visible area (#643)
With the infinite scroll behavior, it's easy to scroll super far away from where the content is and have a hard time getting back. This PR adds a button to refocus on the center of the scene when no elements are visible anymore.
This commit is contained in:
parent
7c9e6dd3f1
commit
be97bd980e
8 changed files with 44 additions and 8 deletions
|
@ -46,7 +46,7 @@ export function serializeAsJSON(
|
|||
);
|
||||
}
|
||||
|
||||
function calculateScrollCenter(
|
||||
export function calculateScrollCenter(
|
||||
elements: readonly ExcalidrawElement[],
|
||||
): { scrollX: number; scrollY: number } {
|
||||
let [x1, y1, x2, y2] = getCommonBounds(elements);
|
||||
|
|
|
@ -17,6 +17,7 @@ export {
|
|||
importFromBackend,
|
||||
addToLoadedScenes,
|
||||
loadedScenes,
|
||||
calculateScrollCenter,
|
||||
} from "./data";
|
||||
export {
|
||||
hasBackground,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue