Update App.tsx

This commit is contained in:
zsviczian 2024-09-28 13:05:40 +02:00 committed by GitHub
parent a977dd1bf5
commit 5c8adfa1a9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -3857,40 +3857,53 @@ class App extends React.Component<AppProps, AppState> {
public getEditorUIOffsets = (): Offsets => {
const toolbarBottom =
this.excalidrawContainerRef?.current
(this.excalidrawContainerRef?.current
?.querySelector(".App-toolbar")
?.getBoundingClientRect()?.bottom ?? 0;
?.getBoundingClientRect()?.bottom ?? 0) - this.state.offsetTop;
const sidebarRect = this.excalidrawContainerRef?.current
?.querySelector(".sidebar")
?.getBoundingClientRect();
const propertiesPanelRect = this.excalidrawContainerRef?.current
?.querySelector(".App-menu__left")
?.getBoundingClientRect();
const PADDING = 16;
const adjustRectValueForOffset = (
value: number | undefined,
fallback: number,
) => (value ?? fallback + this.state.offsetLeft) - this.state.offsetLeft;
return getLanguage().rtl
? {
top: toolbarBottom + PADDING,
right:
Math.max(
this.state.width -
(propertiesPanelRect?.left ?? this.state.width),
adjustRectValueForOffset(
propertiesPanelRect?.left,
this.state.width,
),
0,
) + PADDING,
bottom: PADDING,
left: Math.max(sidebarRect?.right ?? 0, 0) + PADDING,
left:
Math.max(adjustRectValueForOffset(sidebarRect?.right, 0), 0) +
PADDING,
}
: {
top: toolbarBottom + PADDING,
right: Math.max(
this.state.width -
(sidebarRect?.left ?? this.state.width) +
adjustRectValueForOffset(sidebarRect?.left, this.state.width) +
PADDING,
0,
),
bottom: PADDING,
left: Math.max(propertiesPanelRect?.right ?? 0, 0) + PADDING,
left:
Math.max(
adjustRectValueForOffset(propertiesPanelRect?.right, 0),
0,
) + PADDING,
};
};