mirror of
https://github.com/ruilisi/fortune-sheet.git
synced 2025-01-07 03:16:50 +08:00
fix: position of float menu
This commit is contained in:
parent
1c104f6a9e
commit
0dd8314153
@ -1386,7 +1386,6 @@ export function handleContextMenu(
|
||||
ctx: Context,
|
||||
settings: Settings,
|
||||
e: MouseEvent,
|
||||
workbookContainer: HTMLDivElement,
|
||||
container: HTMLDivElement,
|
||||
area: "cell" | "rowHeader" | "columnHeader"
|
||||
) {
|
||||
@ -1400,7 +1399,6 @@ export function handleContextMenu(
|
||||
// //非编辑模式下禁止右键功能框
|
||||
// return;
|
||||
// }
|
||||
const workbookRect = workbookContainer.getBoundingClientRect();
|
||||
|
||||
const { cellContextMenu } = settings;
|
||||
|
||||
@ -1420,8 +1418,8 @@ export function handleContextMenu(
|
||||
}
|
||||
|
||||
// relative to the workbook container
|
||||
const x = e.pageX - workbookRect.left + workbookRect.x;
|
||||
const y = e.pageY - workbookRect.top + workbookRect.y;
|
||||
const x = e.pageX;
|
||||
const y = e.pageY;
|
||||
// showrightclickmenu($("#luckysheet-rightclick-menu"), x, y);
|
||||
ctx.contextMenu = {
|
||||
x,
|
||||
|
@ -429,7 +429,11 @@ const FilterMenu: React.FC = () => {
|
||||
className="fortune-context-menu luckysheet-cols-menu fortune-filter-menu"
|
||||
id="luckysheet-\${menuid}-menu"
|
||||
ref={containerRef}
|
||||
style={{ left: filterContextMenu.x, top: filterContextMenu.y }}
|
||||
style={{
|
||||
left: filterContextMenu.x,
|
||||
top: filterContextMenu.y,
|
||||
position: "fixed",
|
||||
}}
|
||||
>
|
||||
{settings.filterContextMenu?.map((name, i) => {
|
||||
if (name === "|") {
|
||||
|
@ -104,7 +104,12 @@ const SheetTabContextMenu: React.FC = () => {
|
||||
<div
|
||||
className="fortune-context-menu luckysheet-cols-menu"
|
||||
onContextMenu={(e) => e.stopPropagation()}
|
||||
style={{ left: position.x, top: position.y, overflow: "visible" }}
|
||||
style={{
|
||||
left: position.x,
|
||||
top: position.y,
|
||||
overflow: "visible",
|
||||
position: "fixed",
|
||||
}}
|
||||
ref={containerRef}
|
||||
>
|
||||
{settings.sheetTabContextMenu?.map((name, i) => {
|
||||
|
@ -673,7 +673,7 @@ const ContextMenu: React.FC = () => {
|
||||
className="fortune-context-menu luckysheet-cols-menu"
|
||||
ref={containerRef}
|
||||
onContextMenu={(e) => e.stopPropagation()}
|
||||
style={{ left: contextMenu.x, top: contextMenu.y }}
|
||||
style={{ left: contextMenu.x, top: contextMenu.y, position: "fixed" }}
|
||||
>
|
||||
{context.contextMenu.headerMenu === true
|
||||
? settings.headerContextMenu.map((menu, i) => getMenuElement(menu, i))
|
||||
|
@ -154,13 +154,12 @@ const ColumnHeader: React.FC = () => {
|
||||
draftCtx,
|
||||
settings,
|
||||
nativeEvent,
|
||||
refs.workbookContainer.current!,
|
||||
refs.cellArea.current!,
|
||||
"columnHeader"
|
||||
);
|
||||
});
|
||||
},
|
||||
[refs.workbookContainer, setContext, settings, refs.cellArea]
|
||||
[setContext, settings, refs.cellArea]
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
|
@ -143,13 +143,12 @@ const RowHeader: React.FC = () => {
|
||||
draftCtx,
|
||||
settings,
|
||||
nativeEvent,
|
||||
refs.workbookContainer.current!,
|
||||
refs.cellArea.current!,
|
||||
"rowHeader"
|
||||
);
|
||||
});
|
||||
},
|
||||
[refs.workbookContainer, setContext, settings, refs.cellArea]
|
||||
[setContext, settings, refs.cellArea]
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
|
@ -103,13 +103,12 @@ const SheetOverlay: React.FC = () => {
|
||||
draftCtx,
|
||||
settings,
|
||||
nativeEvent,
|
||||
refs.workbookContainer.current!,
|
||||
refs.cellArea.current!,
|
||||
"cell"
|
||||
);
|
||||
});
|
||||
},
|
||||
[refs.workbookContainer, setContext, settings, refs.cellArea]
|
||||
[setContext, settings, refs.cellArea]
|
||||
);
|
||||
|
||||
const cellAreaDoubleClick = useCallback(
|
||||
|
Loading…
Reference in New Issue
Block a user