mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-30 02:58:05 +08:00
位置计算还得算上偏移量
This commit is contained in:
parent
42f2d1385f
commit
2392144f31
@ -85,10 +85,10 @@ export class ContextMenu extends React.Component<
|
||||
info: {x: number; y: number; align?: 'left' | 'right'},
|
||||
menus: Array<MenuItem>
|
||||
) {
|
||||
if (info.x + 200 > window.innerWidth) {
|
||||
info.x = window.innerWidth - 200;
|
||||
if (info.x + 200 > window.innerWidth + window.scrollX) {
|
||||
info.x = window.scrollX + window.innerWidth - 200;
|
||||
info.align = 'left';
|
||||
} else if (info.x + 300 > window.innerWidth) {
|
||||
} else if (info.x + 300 > window.innerWidth + window.scrollX) {
|
||||
info.align = 'left';
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user