fix: settings drag gesture and dashboard popout regions
This commit is contained in:
+36
-39
@@ -11,19 +11,18 @@ CustomMouseArea {
|
||||
|
||||
required property Item bar
|
||||
required property real borderThickness
|
||||
required property ScreenState screenState
|
||||
property bool dashboardShortcutActive
|
||||
property point dragStart
|
||||
required property Drawing drawing
|
||||
required property EdgeGeometry geometry
|
||||
property bool osdShortcutActive
|
||||
required property Panels panels
|
||||
required property Wrapper popouts
|
||||
required property ShellScreen screen
|
||||
|
||||
property bool dashboardShortcutActive
|
||||
property bool osdShortcutActive
|
||||
required property ScreenState screenState
|
||||
property bool setInitialPoint: false
|
||||
property bool singleGestureTriggered: false
|
||||
property bool utilitiesShortcutActive
|
||||
property bool setInitialPoint: false
|
||||
property point dragStart
|
||||
|
||||
function inBottomPanel(panel: Item, x: real, y: real): bool {
|
||||
const panelHeight = panel.height * (1 - (panel.offsetScale ?? 0));
|
||||
@@ -60,39 +59,10 @@ CustomMouseArea {
|
||||
return x >= panelX && x <= panelX + panel.width;
|
||||
}
|
||||
|
||||
anchors.fill: parent
|
||||
acceptedButtons: bar.fullscreen ? Qt.NoButton : Qt.AllButtons
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
|
||||
onPressed: event => {
|
||||
dragStart = Qt.point(event.x, event.y);
|
||||
|
||||
if (screenState.isDrawing) {
|
||||
if (event.button & Qt.RightButton) {
|
||||
drawing.content.clear();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!inLeftPanel(panels.drawing, mouseX, mouseY))
|
||||
drawing.content.beginStroke(event.x, event.y);
|
||||
}
|
||||
}
|
||||
|
||||
onPressedChanged: {
|
||||
if (!pressed) {
|
||||
if (screenState.isDrawing) {
|
||||
setInitialPoint = false;
|
||||
drawing.content.endStroke();
|
||||
if (!inLeftPanel(panels.drawing, mouseX, mouseY))
|
||||
drawing.content.showHover(mouseX, mouseY);
|
||||
}
|
||||
} else {
|
||||
if (screenState.isDrawing) {
|
||||
panels.drawing.collapse();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onContainsMouseChanged: {
|
||||
if (!containsMouse) {
|
||||
if (!osdShortcutActive) {
|
||||
@@ -111,7 +81,6 @@ CustomMouseArea {
|
||||
screenState.dashboard = false;
|
||||
}
|
||||
}
|
||||
|
||||
onPositionChanged: event => {
|
||||
const x = event.x;
|
||||
const y = event.y;
|
||||
@@ -144,7 +113,8 @@ CustomMouseArea {
|
||||
if (pressed && dragStart.y >= screen.height - Config.bar.border && dragStart.x > screen.width / 5 && dragY < -Config.launcher.dragThreshold)
|
||||
screenState.launcher = true;
|
||||
|
||||
const showDashboard = Config.dashboard.showOnHover && inTopPanel(panels.dashboardWrapper, x, y);
|
||||
const entryAt = bar.entryAt(geometry.axisPos(x, y));
|
||||
const showDashboard = Config.dashboard.showOnHover && inTopPanel(panels.dashboardWrapper, x, y) && (!entryAt || entryAt === "activeWindow");
|
||||
|
||||
if (!dashboardShortcutActive) {
|
||||
screenState.dashboard = showDashboard;
|
||||
@@ -159,7 +129,7 @@ CustomMouseArea {
|
||||
screenState.dashboard = false;
|
||||
}
|
||||
|
||||
if (pressed && geometry.insetTop(borderThickness) > dragStart.y && (Config.dashboard.showOnHover || !inTopPanel(panels.dashboardWrapper, dragStart.x, dragStart.y))) {
|
||||
if (pressed && geometry.insetTop(borderThickness) > dragStart.y && !inTopPanel(panels.dashboardWrapper, dragStart.x, dragStart.y)) {
|
||||
if (dragY > 20) {
|
||||
screenState.settings = true;
|
||||
} else if (dragY < -20) {
|
||||
@@ -212,6 +182,33 @@ CustomMouseArea {
|
||||
if (geometry.barContains(x, y))
|
||||
bar.checkPopout(geometry.axisPos(x, y));
|
||||
}
|
||||
onPressed: event => {
|
||||
dragStart = Qt.point(event.x, event.y);
|
||||
|
||||
if (screenState.isDrawing) {
|
||||
if (event.button & Qt.RightButton) {
|
||||
drawing.content.clear();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!inLeftPanel(panels.drawing, mouseX, mouseY))
|
||||
drawing.content.beginStroke(event.x, event.y);
|
||||
}
|
||||
}
|
||||
onPressedChanged: {
|
||||
if (!pressed) {
|
||||
if (screenState.isDrawing) {
|
||||
setInitialPoint = false;
|
||||
drawing.content.endStroke();
|
||||
if (!inLeftPanel(panels.drawing, mouseX, mouseY))
|
||||
drawing.content.showHover(mouseX, mouseY);
|
||||
}
|
||||
} else {
|
||||
if (screenState.isDrawing) {
|
||||
panels.drawing.collapse();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: unhideTimer
|
||||
|
||||
@@ -36,8 +36,8 @@ CustomClippingRect {
|
||||
MaterialIcon {
|
||||
id: noUpdatesIcon
|
||||
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.top: parent.top
|
||||
anchors.centerIn: parent
|
||||
anchors.verticalCenterOffset: -noUpdatesText.implicitHeight
|
||||
color: Colors.tPalette.m3onSurfaceVariant
|
||||
fontStyle: Tokens.font.icon.builders.large.size(48).weight(Font.DemiBold).build()
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
@@ -45,6 +45,8 @@ CustomClippingRect {
|
||||
}
|
||||
|
||||
CustomText {
|
||||
id: noUpdatesText
|
||||
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.top: noUpdatesIcon.bottom
|
||||
color: Colors.tPalette.m3onSurfaceVariant
|
||||
|
||||
Reference in New Issue
Block a user