fix usages of QmlRect.right and .bottom

This commit is contained in:
Peter Fajdiga
2023-12-10 21:16:02 +01:00
parent ce1b402bf2
commit 1824bcdf85
4 changed files with 11 additions and 15 deletions

View File

@@ -47,8 +47,8 @@ class Desktop {
return Qt.rect(
left,
top,
right - left + 1,
bottom - top + 1,
right - left,
bottom - top,
)
}

View File

@@ -89,10 +89,8 @@ class Grid {
}
public getLeftmostVisibleColumn(visibleRange: Desktop.Range, fullyVisible: boolean) {
const scrollX = visibleRange.getLeft();
for (const column of this.columns.iterator()) {
const x = fullyVisible ? column.getLeft() : column.getRight() + (this.config.gapsInnerHorizontal - 1);
if (x >= scrollX) {
if (column.isVisible(visibleRange, fullyVisible)) {
return column;
}
}
@@ -100,13 +98,11 @@ class Grid {
}
public getRightmostVisibleColumn(visibleRange: Desktop.Range, fullyVisible: boolean) {
const scrollX = visibleRange.getRight();
let last = null;
for (const column of this.columns.iterator()) {
const x = fullyVisible ? column.getRight() : column.getLeft() - (this.config.gapsInnerHorizontal - 1);
if (x <= scrollX) {
if (column.isVisible(visibleRange, fullyVisible)) {
last = column;
} else {
} else if (last !== null) {
break;
}
}

View File

@@ -122,10 +122,10 @@ class ClientWrapper {
return;
}
const frame = this.kwinClient.frameGeometry;
if (frame.left < 0) {
frame.x = 0;
} else if (frame.right > screenSize.width) {
frame.x = screenSize.width - frame.width;
if (frame.left < screenSize.left) {
frame.x = screenSize.left;
} else if (frame.right > screenSize.right) {
frame.x = screenSize.right - frame.width;
}
}

View File

@@ -75,8 +75,8 @@ namespace PinManager {
}
private contains(obstacle: QmlRect) {
return obstacle.right >= this.left && obstacle.left <= this.right &&
obstacle.bottom >= this.top && obstacle.top <= this.bottom;
return obstacle.right > this.left && obstacle.left < this.right &&
obstacle.bottom > this.top && obstacle.top < this.bottom;
}
public area() {