refactor: Rename prop scrollToCenter and setScrollToCenter to scrollToContent and setScrollToContent respectively (#3261)

* refactor: Rename prop scrollToCenter and setScrollToCenter to scrollToContent and setScrollToContent respectively

* fix

* update changelog/readme

* fix
This commit is contained in:
Aakansha Doshi 2021-03-16 23:02:17 +05:30 committed by GitHub
parent e90e56452f
commit 052b73d95b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 16 additions and 14 deletions

View file

@ -271,7 +271,7 @@ export type ExcalidrawImperativeAPI = {
history: {
clear: InstanceType<typeof App>["resetHistory"];
};
setScrollToCenter: InstanceType<typeof App>["setScrollToCenter"];
setScrollToContent: InstanceType<typeof App>["setScrollToContent"];
getSceneElements: InstanceType<typeof App>["getSceneElements"];
getAppState: () => InstanceType<typeof App>["state"];
readyPromise: ResolvablePromise<ExcalidrawImperativeAPI>;
@ -330,7 +330,7 @@ class App extends React.Component<ExcalidrawProps, AppState> {
history: {
clear: this.resetHistory,
},
setScrollToCenter: this.setScrollToCenter,
setScrollToContent: this.setScrollToContent,
getSceneElements: this.getSceneElements,
getAppState: () => this.state,
} as const;
@ -685,7 +685,7 @@ class App extends React.Component<ExcalidrawProps, AppState> {
...scene.appState,
isLoading: false,
};
if (initialData?.scrollToCenter) {
if (initialData?.scrollToContent) {
scene.appState = {
...scene.appState,
...calculateScrollCenter(
@ -1281,7 +1281,7 @@ class App extends React.Component<ExcalidrawProps, AppState> {
this.actionManager.executeAction(actionToggleStats);
};
setScrollToCenter = (remoteElements: readonly ExcalidrawElement[]) => {
setScrollToContent = (remoteElements: readonly ExcalidrawElement[]) => {
this.setState({
...calculateScrollCenter(
getNonDeletedElements(remoteElements),