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