perf: 优化菜单显示位置

This commit is contained in:
Pang 2024-01-16 11:15:19 +08:00
parent b3a30720fa
commit 96b0cb8aa0
8 changed files with 20 additions and 25 deletions

View File

@ -1053,12 +1053,11 @@ export default {
this.operateVisible = false;
this.operateItem = $A.isJson(projectItem) ? projectItem : {};
this.$nextTick(() => {
const projectRect = el.getBoundingClientRect();
const wrapRect = this.$refs.menuProject.getBoundingClientRect();
const rect = el.getBoundingClientRect();
this.operateStyles = {
left: `${event.clientX - wrapRect.left}px`,
top: `${projectRect.top + this.windowScrollY}px`,
height: projectRect.height + 'px',
left: `${event.clientX}px`,
top: `${rect.top + this.windowScrollY}px`,
height: rect.height + 'px',
}
this.operateVisible = true;
})

View File

@ -2680,12 +2680,11 @@ export default {
}
}
this.$nextTick(() => {
const projectRect = el.getBoundingClientRect();
const wrapRect = this.$el.getBoundingClientRect();
const rect = el.getBoundingClientRect();
this.operateStyles = {
left: `${event.clientX - wrapRect.left}px`,
top: `${projectRect.top + this.windowScrollY}px`,
height: projectRect.height + 'px',
left: `${event.clientX}px`,
top: `${rect.top + this.windowScrollY}px`,
height: rect.height + 'px',
}
this.operateClient = {x: event.clientX, y: event.clientY};
this.operateVisible = true;

View File

@ -179,12 +179,11 @@ export default {
this.operateVisible = false;
this.operateItem = $A.isJson(projectItem) ? projectItem : {};
this.$nextTick(() => {
const projectRect = el.getBoundingClientRect();
const wrapRect = this.$el.getBoundingClientRect();
const rect = el.getBoundingClientRect();
this.operateStyles = {
left: `${event.clientX - wrapRect.left}px`,
top: `${projectRect.top + this.windowScrollY}px`,
height: projectRect.height + 'px',
left: `${event.clientX}px`,
top: `${rect.top + this.windowScrollY}px`,
height: rect.height + 'px',
}
this.operateVisible = true;
})

View File

@ -977,12 +977,11 @@ export default {
this.operateVisible = false;
this.operateItem = $A.isJson(dialogItem) ? dialogItem : {};
this.$nextTick(() => {
const dialogRect = el.getBoundingClientRect();
const wrapRect = this.$refs.list.$el.getBoundingClientRect();
const rect = el.getBoundingClientRect();
this.operateStyles = {
left: `${event.clientX - wrapRect.left}px`,
top: `${dialogRect.top - dialogRect.height + this.windowScrollY}px`,
height: dialogRect.height + 'px',
left: `${event.clientX}px`,
top: `${rect.top + this.windowScrollY}px`,
height: rect.height + 'px',
}
this.operateVisible = true;
})

View File

@ -1754,7 +1754,7 @@
}
.operate-position {
position: absolute;
position: fixed;
top: 0;
left: 0;
width: 1px;

View File

@ -183,7 +183,7 @@
}
.operate-position {
position: absolute;
position: fixed;
top: 0;
left: 0;
width: 1px;

View File

@ -206,7 +206,7 @@
}
}
.operate-position {
position: absolute;
position: fixed;
top: 0;
left: 0;
width: 1px;

View File

@ -463,12 +463,11 @@
}
}
.operate-position {
position: absolute;
position: fixed;
top: 0;
left: 0;
width: 1px;
opacity: 0;
margin-top: -4px;
visibility: hidden;
pointer-events: none;
}