fix: right-click context menu positioning
This commit is contained in:
parent
666a79fcde
commit
961dd073f6
1 changed files with 15 additions and 8 deletions
|
|
@ -179,9 +179,23 @@ frappe.ui.menu = class ContextMenu {
|
|||
|
||||
show(event) {
|
||||
this.make();
|
||||
const parent_rect = this.parent.get(0).getBoundingClientRect();
|
||||
this.gap = 4;
|
||||
|
||||
if (this.opts.right_click && event) {
|
||||
this.template.css({
|
||||
display: "block",
|
||||
position: "fixed",
|
||||
left: `${event.clientX}px`,
|
||||
top: `${event.clientY}px`,
|
||||
});
|
||||
this.visible = true;
|
||||
frappe.visible_menus.push(this);
|
||||
return;
|
||||
}
|
||||
|
||||
const parent_rect = this.parent.get(0).getBoundingClientRect();
|
||||
let top, left;
|
||||
|
||||
if (this.opts.nested && this.opts.parent_menu) {
|
||||
let parent_menu_el = frappe.menu_map[this.opts.parent_menu].template;
|
||||
let parent_menu_rect = parent_menu_el.get(0).getBoundingClientRect();
|
||||
|
|
@ -201,13 +215,6 @@ frappe.ui.menu = class ContextMenu {
|
|||
|
||||
if (left < 0) left = 10;
|
||||
|
||||
if (this.opts.right_click) {
|
||||
this.template.css({
|
||||
left: `${event.clientX}px`,
|
||||
top: `${event.clientY}px`,
|
||||
});
|
||||
}
|
||||
|
||||
this.template.css({
|
||||
display: "block",
|
||||
position: "fixed",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue