NPanel positioning fixes
This commit is contained in:
parent
ee50d84a53
commit
6fba9d9f22
5 changed files with 141 additions and 28 deletions
|
|
@ -46,17 +46,35 @@ Window {
|
|||
return
|
||||
}
|
||||
|
||||
if (positionLeft) {
|
||||
// Auto-detect positioning based on bar position if not explicitly set
|
||||
var shouldPositionLeft = positionLeft
|
||||
var shouldPositionRight = positionRight
|
||||
var shouldPositionAbove = positionAbove
|
||||
|
||||
// If no explicit positioning is set, auto-detect based on bar position
|
||||
if (!positionLeft && !positionRight && !positionAbove) {
|
||||
var barPosition = BarService.position
|
||||
if (barPosition === "left") {
|
||||
shouldPositionRight = true
|
||||
} else if (barPosition === "right") {
|
||||
shouldPositionLeft = true
|
||||
} else if (barPosition === "bottom") {
|
||||
shouldPositionAbove = true
|
||||
}
|
||||
// For "top" bar, default to below (no change needed)
|
||||
}
|
||||
|
||||
if (shouldPositionLeft) {
|
||||
// Position tooltip to the left of the target
|
||||
var pos = target.mapToGlobal(0, 0)
|
||||
x = pos.x - width - 12 // 12 px margin to the left
|
||||
y = pos.y - height / 2 + target.height / 2
|
||||
} else if (positionRight) {
|
||||
} else if (shouldPositionRight) {
|
||||
// Position tooltip to the right of the target
|
||||
var pos = target.mapToGlobal(target.width, 0)
|
||||
x = pos.x + 12 // 12 px margin to the right
|
||||
y = pos.y - height / 2 + target.height / 2
|
||||
} else if (positionAbove) {
|
||||
} else if (shouldPositionAbove) {
|
||||
// Position tooltip above the target
|
||||
var pos = target.mapToGlobal(0, 0)
|
||||
x = pos.x - width / 2 + target.width / 2
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue