update prop name to detectPosition

This commit is contained in:
Aakansha Doshi 2021-04-11 13:49:40 +05:30
parent 4fb906baad
commit ac08f433e9
3 changed files with 9 additions and 9 deletions

View File

@ -306,7 +306,7 @@ class App extends React.Component<AppProps, AppState> {
private scene: Scene; private scene: Scene;
private resizeObserver: ResizeObserver | undefined; private resizeObserver: ResizeObserver | undefined;
private nearestScrollableContainer: HTMLElement | Document | undefined; private nearestScrollableContainer: HTMLElement | Document | undefined;
private detectPositionChangeIntervalId: NodeJS.Timeout | undefined; private detectPositionIntervalId: NodeJS.Timeout | undefined;
constructor(props: AppProps) { constructor(props: AppProps) {
super(props); super(props);
@ -791,8 +791,8 @@ class App extends React.Component<AppProps, AppState> {
this.scene.addCallback(this.onSceneUpdated); this.scene.addCallback(this.onSceneUpdated);
this.addEventListeners(); this.addEventListeners();
if (this.props.detectPositionChange) { if (this.props.detectPosition) {
this.detectPositionChangeIntervalId = setInterval( this.detectPositionIntervalId = setInterval(
this.updateOffsetsIfChanged, this.updateOffsetsIfChanged,
DETECT_POSITION_CHANGE_INTERVAL, DETECT_POSITION_CHANGE_INTERVAL,
); );
@ -839,8 +839,8 @@ class App extends React.Component<AppProps, AppState> {
this.removeEventListeners(); this.removeEventListeners();
this.scene.destroy(); this.scene.destroy();
clearTimeout(touchTimeout); clearTimeout(touchTimeout);
if (this.detectPositionChangeIntervalId) { if (this.detectPositionIntervalId) {
clearInterval(this.detectPositionChangeIntervalId); clearInterval(this.detectPositionIntervalId);
} }
touchTimeout = 0; touchTimeout = 0;
} }

View File

@ -31,7 +31,7 @@ const Excalidraw = (props: ExcalidrawProps) => {
renderCustomStats, renderCustomStats,
onPaste, onPaste,
detectScroll = true, detectScroll = true,
detectPositionChange = false, detectPosition = false,
} = props; } = props;
const canvasActions = props.UIOptions?.canvasActions; const canvasActions = props.UIOptions?.canvasActions;
@ -83,7 +83,7 @@ const Excalidraw = (props: ExcalidrawProps) => {
UIOptions={UIOptions} UIOptions={UIOptions}
onPaste={onPaste} onPaste={onPaste}
detectScroll={detectScroll} detectScroll={detectScroll}
detectPositionChange={detectPositionChange} detectPosition={detectPosition}
/> />
</InitializeApp> </InitializeApp>
); );

View File

@ -196,7 +196,7 @@ export interface ExcalidrawProps {
) => JSX.Element; ) => JSX.Element;
UIOptions?: UIOptions; UIOptions?: UIOptions;
detectScroll?: boolean; detectScroll?: boolean;
detectPositionChange?: boolean; detectPosition?: boolean;
} }
export type SceneData = { export type SceneData = {
@ -231,5 +231,5 @@ export type AppProps = ExcalidrawProps & {
canvasActions: Required<CanvasActions>; canvasActions: Required<CanvasActions>;
}; };
detectScroll: boolean; detectScroll: boolean;
detectPositionChange: boolean; detectPosition: boolean;
}; };