feat: pass scrollConstraints via props

This commit is contained in:
Arnošt Pleskot 2023-07-07 15:35:10 +02:00
parent 381ef93956
commit 19ba107041
No known key found for this signature in database
8 changed files with 21 additions and 6 deletions

View file

@ -366,6 +366,7 @@ const ExcalidrawAppStateContext = React.createContext<AppState>({
height: 0,
offsetLeft: 0,
offsetTop: 0,
scrollConstraints: null,
});
ExcalidrawAppStateContext.displayName = "ExcalidrawAppStateContext";
@ -466,7 +467,9 @@ class App extends React.Component<AppProps, AppState> {
gridModeEnabled = false,
theme = defaultAppState.theme,
name = defaultAppState.name,
scrollConstraints,
} = props;
this.state = {
...defaultAppState,
theme,
@ -478,6 +481,7 @@ class App extends React.Component<AppProps, AppState> {
name,
width: window.innerWidth,
height: window.innerHeight,
scrollConstraints: scrollConstraints ?? null,
};
this.id = nanoid();
@ -1209,6 +1213,7 @@ class App extends React.Component<AppProps, AppState> {
height: this.state.height,
offsetTop: this.state.offsetTop,
offsetLeft: this.state.offsetLeft,
scrollConstraints: this.state.scrollConstraints,
},
null,
),