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.operateVisible = false;
this.operateItem = $A.isJson(projectItem) ? projectItem : {}; this.operateItem = $A.isJson(projectItem) ? projectItem : {};
this.$nextTick(() => { this.$nextTick(() => {
const projectRect = el.getBoundingClientRect(); const rect = el.getBoundingClientRect();
const wrapRect = this.$refs.menuProject.getBoundingClientRect();
this.operateStyles = { this.operateStyles = {
left: `${event.clientX - wrapRect.left}px`, left: `${event.clientX}px`,
top: `${projectRect.top + this.windowScrollY}px`, top: `${rect.top + this.windowScrollY}px`,
height: projectRect.height + 'px', height: rect.height + 'px',
} }
this.operateVisible = true; this.operateVisible = true;
}) })

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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