Fix termselect overshoot
This commit is contained in:
parent
eeb47e9dc1
commit
85ca402006
|
@ -14,7 +14,7 @@ Item {
|
|||
selectionArea.startY = mouseY;
|
||||
selectionArea.endX = mouseX;
|
||||
selectionArea.endY = mouseY;
|
||||
selectionArea.selecting = true;
|
||||
selectionArea.startSelection(false);
|
||||
}
|
||||
|
||||
onPositionChanged: {
|
||||
|
|
|
@ -23,6 +23,7 @@ WlrLayershell {
|
|||
id: area
|
||||
property bool selecting: false
|
||||
property bool initializing: false
|
||||
property bool locked: false
|
||||
property real startX: 0
|
||||
property real startY: 0
|
||||
property real endX: 0
|
||||
|
@ -41,7 +42,13 @@ WlrLayershell {
|
|||
width: Math.max(startX, endX) - x + border.width * 2
|
||||
height: Math.max(startY, endY) - y + border.width * 2
|
||||
|
||||
function startSelection() {
|
||||
function startSelection(initialize: bool) {
|
||||
locked = false;
|
||||
if (!initialize) {
|
||||
selecting = true;
|
||||
return;
|
||||
}
|
||||
|
||||
initializing = true
|
||||
if (selecting) {
|
||||
area.startX = mouseArea.mouseX;
|
||||
|
@ -56,6 +63,7 @@ WlrLayershell {
|
|||
initializing = false;
|
||||
|
||||
if (wasSelecting && bigEnough) {
|
||||
locked = true;
|
||||
selectionComplete(x + 1, y + 1, width - 2, height - 2);
|
||||
} else {
|
||||
selecting = false;
|
||||
|
@ -81,7 +89,7 @@ WlrLayershell {
|
|||
area.selecting = true;
|
||||
}
|
||||
|
||||
if (selectionArea.selecting) {
|
||||
if (!selectionArea.locked) {
|
||||
area.endX = mouseX;
|
||||
area.endY = mouseY;
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ ShellRoot {
|
|||
|
||||
function onTermSelectChanged() {
|
||||
if (ShellIpc.termSelect) {
|
||||
selectionLayer.selectionArea.startSelection();
|
||||
selectionLayer.selectionArea.startSelection(true);
|
||||
} else {
|
||||
selectionLayer.selectionArea.endSelection();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue