fix: context menu positioning (#4025)

This commit is contained in:
Shubham Shah 2021-10-04 15:43:17 +05:30 committed by GitHub
parent bea4a1e066
commit 75aeaa6c38
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4092,6 +4092,7 @@ class App extends React.Component<AppProps, AppState> {
actionToggleStats,
];
if (this.state.viewModeEnabled) {
ContextMenu.push({
options: viewModeOptions,
top,
@ -4100,11 +4101,7 @@ class App extends React.Component<AppProps, AppState> {
appState: this.state,
container: this.excalidrawContainerRef.current!,
});
if (this.state.viewModeEnabled) {
return;
}
} else {
ContextMenu.push({
options: [
this.isMobile &&
@ -4144,9 +4141,8 @@ class App extends React.Component<AppProps, AppState> {
appState: this.state,
container: this.excalidrawContainerRef.current!,
});
return;
}
} else if (type === "element") {
if (this.state.viewModeEnabled) {
ContextMenu.push({
options: [navigator.clipboard && actionCopy, ...options],
@ -4156,9 +4152,7 @@ class App extends React.Component<AppProps, AppState> {
appState: this.state,
container: this.excalidrawContainerRef.current!,
});
return;
}
} else {
ContextMenu.push({
options: [
this.isMobile && actionCut,
@ -4202,6 +4196,8 @@ class App extends React.Component<AppProps, AppState> {
appState: this.state,
container: this.excalidrawContainerRef.current!,
});
}
}
};
private handleWheel = withBatchedUpdates((event: WheelEvent) => {