mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-04-03 20:32:07 -04:00
dock: fix tooltip positioning
This commit is contained in:
@@ -378,21 +378,27 @@ Variants {
|
|||||||
const screenY = dock.screen ? (dock.screen.y || 0) : 0;
|
const screenY = dock.screen ? (dock.screen.y || 0) : 0;
|
||||||
const screenHeight = dock.screen ? dock.screen.height : 0;
|
const screenHeight = dock.screen ? dock.screen.height : 0;
|
||||||
|
|
||||||
|
const gap = Theme.spacingS;
|
||||||
|
const bgMargin = barSpacing + SettingsData.dockMargin + 1 + dock.borderThickness;
|
||||||
|
const btnW = dock.hoveredButton.width;
|
||||||
|
const btnH = dock.hoveredButton.height;
|
||||||
|
|
||||||
if (!dock.isVertical) {
|
if (!dock.isVertical) {
|
||||||
const isBottom = SettingsData.dockPosition === SettingsData.Position.Bottom;
|
const isBottom = SettingsData.dockPosition === SettingsData.Position.Bottom;
|
||||||
const globalX = buttonGlobalPos.x + dock.hoveredButton.width / 2 + adjacentLeftBarWidth;
|
const globalX = buttonGlobalPos.x + btnW / 2 + adjacentLeftBarWidth;
|
||||||
const tooltipHeight = 32;
|
const tooltipHeight = 32;
|
||||||
const tooltipOffset = dock.effectiveBarHeight + SettingsData.dockSpacing + SettingsData.dockBottomGap + SettingsData.dockMargin + barSpacing + Theme.spacingM;
|
const totalFromEdge = bgMargin + dockBackground.height + dock.borderThickness + gap;
|
||||||
const screenRelativeY = isBottom ? (screenHeight - tooltipOffset - tooltipHeight) : tooltipOffset;
|
const screenRelativeY = isBottom ? (screenHeight - totalFromEdge - tooltipHeight) : totalFromEdge;
|
||||||
dockTooltip.show(tooltipText, globalX, screenRelativeY, dock.screen, false, false);
|
dockTooltip.show(tooltipText, globalX, screenRelativeY, dock.screen, false, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const isLeft = SettingsData.dockPosition === SettingsData.Position.Left;
|
const isLeft = SettingsData.dockPosition === SettingsData.Position.Left;
|
||||||
const tooltipOffset = dock.effectiveBarHeight + SettingsData.dockSpacing + SettingsData.dockBottomGap + SettingsData.dockMargin + barSpacing + Theme.spacingM;
|
const screenWidth = dock.screen ? dock.screen.width : 0;
|
||||||
const tooltipX = isLeft ? tooltipOffset : (dock.screen.width - tooltipOffset);
|
const totalFromEdge = bgMargin + dockBackground.width + dock.borderThickness + gap;
|
||||||
const screenRelativeY = buttonGlobalPos.y - screenY + dock.hoveredButton.height / 2 + adjacentTopBarHeight;
|
const tooltipX = isLeft ? (screenX + totalFromEdge) : (screenX + screenWidth - totalFromEdge);
|
||||||
dockTooltip.show(tooltipText, screenX + tooltipX, screenRelativeY, dock.screen, isLeft, !isLeft);
|
const screenRelativeY = buttonGlobalPos.y - screenY + btnH / 2 + adjacentTopBarHeight;
|
||||||
|
dockTooltip.show(tooltipText, tooltipX, screenRelativeY, dock.screen, isLeft, !isLeft);
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
|
|||||||
Reference in New Issue
Block a user