fix: panel interaction hitbox code
This commit is contained in:
parent
f62e017536
commit
e82bdbc9a2
1 changed files with 10 additions and 7 deletions
|
|
@ -21,29 +21,32 @@ CustomMouseArea {
|
|||
property bool dashboardShortcutActive
|
||||
|
||||
anchors.fill: parent
|
||||
// HACK: Fixes weird pixel alignment issues that drop mouse events
|
||||
anchors.rightMargin: -1
|
||||
anchors.bottomMargin: -1
|
||||
|
||||
hoverEnabled: true
|
||||
|
||||
function withinPanelWidth(panel: Item, x: real): bool {
|
||||
const panelX = panel.x;
|
||||
const panelX = panel.x + Config.border.thickness;
|
||||
return x >= panelX - Config.border.rounding && x <= panelX + panel.width + Config.border.rounding;
|
||||
}
|
||||
|
||||
function withinPanelHeight(panel: Item, y: real): bool {
|
||||
const panelY = panel.y;
|
||||
return y >= panelY + Config.bar.height - Config.border.rounding
|
||||
&& y <= panelY + panel.height + Config.bar.height + Config.border.rounding;
|
||||
const panelY = panel.y + Config.bar.height;
|
||||
return y >= panelY - Config.border.rounding && y <= panelY + panel.height + Config.border.rounding;
|
||||
}
|
||||
|
||||
function inBottomPanel(panel: Item, x: real, y: real): bool {
|
||||
return y > root.height - Config.border.thickness - panel.height - Config.border.rounding && withinPanelWidth(panel, x);
|
||||
return y > panel.y + Config.bar.height && withinPanelWidth(panel, x);
|
||||
}
|
||||
|
||||
function inLeftPanel(panel: Item, x: real, y: real): bool {
|
||||
return x < Config.border.thickness + panel.x + panel.width && withinPanelHeight(panel, y);
|
||||
return x < panel.x + panel.width + Config.border.thickness && withinPanelHeight(panel, y);
|
||||
}
|
||||
|
||||
function inRightPanel(panel: Item, x: real, y: real): bool {
|
||||
return x > Config.border.thickness + panel.x && withinPanelHeight(panel, y);
|
||||
return x > panel.x + Config.border.thickness && withinPanelHeight(panel, y);
|
||||
}
|
||||
|
||||
// Handling Mouse Input
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue