forward scrollConstraints prop from Excalidraw to App + fixed example app
This commit is contained in:
@@ -178,7 +178,7 @@ export default function ExampleApp({
|
||||
const newElement = cloneElement(
|
||||
Excalidraw,
|
||||
{
|
||||
excalidrawAPI: (api: ExcalidrawImperativeAPI) => setExcalidrawAPI(api),
|
||||
onExcalidrawAPI: (api: ExcalidrawImperativeAPI | null) => setExcalidrawAPI(api),
|
||||
initialData: initialStatePromiseRef.current.promise,
|
||||
onChange: (
|
||||
elements: NonDeletedExcalidrawElement[],
|
||||
|
||||
@@ -2967,6 +2967,7 @@ class App extends React.Component<AppProps, AppState> {
|
||||
if (this.props.scrollConstraints) {
|
||||
restoredAppState = {
|
||||
...restoredAppState,
|
||||
scrollConstraints: this.props.scrollConstraints,
|
||||
...calculateConstrainedScrollCenter(this.state, restoredAppState),
|
||||
};
|
||||
} else if (initialData?.scrollToContent) {
|
||||
|
||||
@@ -98,6 +98,7 @@ const ExcalidrawBase = (props: ExcalidrawProps) => {
|
||||
aiEnabled,
|
||||
showDeprecatedFonts,
|
||||
renderScrollbars,
|
||||
scrollConstraints,
|
||||
} = props;
|
||||
|
||||
const canvasActions = props.UIOptions?.canvasActions;
|
||||
@@ -208,6 +209,7 @@ const ExcalidrawBase = (props: ExcalidrawProps) => {
|
||||
aiEnabled={aiEnabled !== false}
|
||||
showDeprecatedFonts={showDeprecatedFonts}
|
||||
renderScrollbars={renderScrollbars}
|
||||
scrollConstraints={scrollConstraints}
|
||||
>
|
||||
{children}
|
||||
</App>
|
||||
|
||||
Reference in New Issue
Block a user