Commit 643e32c2 authored by Roman Gilg's avatar Roman Gilg
Browse files

feat(kcm): zoom preview automatically

Summary:
On output size and position changes reset the relative output position in the
overview automatically.

This way the outputs are always movable with ease and the "center view" button
is not necessary anymore.

Test Plan: Moved outputs in multi monitor environment. Overview zoomed automatically.

Reviewers: #plasma

Subscribers: davidedmundson, ngraham, plasma-devel

Tags: #plasma

Maniphest Tasks: T11929

Differential Revision: https://phabricator.kde.org/D25027
parent fb170c3a
......@@ -24,6 +24,7 @@ Rectangle {
id: output
property bool isSelected: root.selectedOutput === model.index
property size outputSize: model.size
onIsSelectedChanged: {
if (isSelected) {
......@@ -39,7 +40,9 @@ Rectangle {
}
visible: model.enabled && model.replicationSourceIndex === 0
onVisibleChanged: screen.resetTotalSize()
onOutputSizeChanged: screen.resetTotalSize()
x: model.position ? model.position.x / screen.relativeFactor + screen.xOffset : 0
y: model.position ? model.position.y / screen.relativeFactor + screen.yOffset : 0
......@@ -262,6 +265,11 @@ Rectangle {
var newY = dragStartPosition.y + translation.y;
model.position = getAbsolutePosition(Qt.point(newX, newY));
}
onActiveChanged: {
if (!active) {
screen.resetTotalSize();
}
}
}
// So we can show a grabby hand cursor when hovered over
......
......@@ -64,29 +64,19 @@ Controls.ScrollView {
visible: kcm.outputModel && kcm.outputModel.rowCount() > 1
}
Row {
z: 90
Controls.Button {
anchors {
bottom: parent.bottom
horizontalCenter: parent.horizontalCenter
margins: units.smallSpacing
}
spacing: units.smallSpacing
Controls.Button {
onClicked: kcm.identifyOutputs()
text: i18n("Identify")
icon.name: "documentinfo"
focusPolicy: Qt.NoFocus
visible: kcm.outputModel && kcm.outputModel.rowCount() > 1
}
Controls.Button {
enabled: !kcm.screenNormalized
onClicked: resetTotalSize()
text: i18n("Center View")
icon.name: "zoom-original"
focusPolicy: Qt.NoFocus
visible: kcm.outputModel && kcm.outputModel.rowCount() > 1
}
z: 90
onClicked: kcm.identifyOutputs()
text: i18n("Identify")
icon.name: "documentinfo"
focusPolicy: Qt.NoFocus
visible: kcm.outputModel && kcm.outputModel.rowCount() > 1
}
Repeater {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment