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

View File

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

View File

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