perf : 弹框位置调整

This commit is contained in:
likexuan
2022-07-05 16:32:57 +08:00
parent 76ceabe639
commit 581dff59c2
2 changed files with 8 additions and 4 deletions

View File

@@ -778,12 +778,14 @@ export default {
if (position.top > clientHeight / 2) { if (position.top > clientHeight / 2) {
labelPosition = { labelPosition = {
left: `${position.left + position.width + leftOffSet}px`, left: `${position.left + position.width + leftOffSet}px`,
top: `${position.top - this.heightList - topOffSetView}px` // top: `${position.top - this.heightList - topOffSetView}px`
top: `${position.top - this.heightList - topOffSetView + position.height / 2}px`
} }
} else { } else {
labelPosition = { labelPosition = {
left: `${position.left + position.width + leftOffSet}px`, left: `${position.left + position.width + leftOffSet}px`,
top: `${position.top + topOffSet}px` // top: `${position.top + topOffSet}px`
top: `${position.top + position.height / 2}px`
} }
} }
if (position.left > clientWidth / 2) { if (position.left > clientWidth / 2) {

View File

@@ -124,12 +124,14 @@ export default {
if (position.top > windowHeight / 2) { if (position.top > windowHeight / 2) {
return { return {
left: `${position.left + position.width + leftOffSetView}px`, left: `${position.left + position.width + leftOffSetView}px`,
top: `${position.top - boxHeight}px` // top: `${position.top - boxHeight}px`
top: `${position.top + (position.height / 2) - boxHeight}px`
} }
} else { } else {
return { return {
left: `${position.left + position.width + leftOffSetView}px`, left: `${position.left + position.width + leftOffSetView}px`,
top: `${position.top}px` // top: `${position.top}px`
top: `${position.top + position.height / 2}px`
} }
} }
} }