mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-04-14 01:32:29 -04:00
@@ -523,6 +523,7 @@ Singleton {
|
|||||||
property var activeDisplayProfile: ({})
|
property var activeDisplayProfile: ({})
|
||||||
property bool displayProfileAutoSelect: false
|
property bool displayProfileAutoSelect: false
|
||||||
property bool displayShowDisconnected: false
|
property bool displayShowDisconnected: false
|
||||||
|
property bool displaySnapToEdge: true
|
||||||
|
|
||||||
property var barConfigs: [
|
property var barConfigs: [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -351,6 +351,7 @@ var SPEC = {
|
|||||||
activeDisplayProfile: { def: {} },
|
activeDisplayProfile: { def: {} },
|
||||||
displayProfileAutoSelect: { def: false },
|
displayProfileAutoSelect: { def: false },
|
||||||
displayShowDisconnected: { def: false },
|
displayShowDisconnected: { def: false },
|
||||||
|
displaySnapToEdge: { def: true },
|
||||||
|
|
||||||
barConfigs: {
|
barConfigs: {
|
||||||
def: [{
|
def: [{
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ Rectangle {
|
|||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: snapPreview
|
id: snapPreview
|
||||||
visible: root.isDragging && root.isValidPosition
|
visible: root.isDragging && root.isValidPosition && SettingsData.displaySnapToEdge
|
||||||
x: root.snappedLogical.x * root.canvasScaleFactor + root.canvasOffset.x - root.x
|
x: root.snappedLogical.x * root.canvasScaleFactor + root.canvasOffset.x - root.x
|
||||||
y: root.snappedLogical.y * root.canvasScaleFactor + root.canvasOffset.y - root.y
|
y: root.snappedLogical.y * root.canvasScaleFactor + root.canvasOffset.y - root.y
|
||||||
width: parent.width
|
width: parent.width
|
||||||
@@ -124,9 +124,9 @@ Rectangle {
|
|||||||
|
|
||||||
const size = DisplayConfigState.getLogicalSize(root.outputData);
|
const size = DisplayConfigState.getLogicalSize(root.outputData);
|
||||||
|
|
||||||
const snapped = DisplayConfigState.snapToEdges(root.outputName, posX, posY, size.w, size.h);
|
const snapped = SettingsData.displaySnapToEdge ? DisplayConfigState.snapToEdges(root.outputName, posX, posY, size.w, size.h) : Qt.point(posX, posY);
|
||||||
root.snappedLogical = snapped;
|
root.snappedLogical = snapped;
|
||||||
root.isValidPosition = !DisplayConfigState.checkOverlap(root.outputName, snapped.x, snapped.y, size.w, size.h);
|
root.isValidPosition = SettingsData.displaySnapToEdge ? !DisplayConfigState.checkOverlap(root.outputName, snapped.x, snapped.y, size.w, size.h) : true;
|
||||||
}
|
}
|
||||||
|
|
||||||
onReleased: {
|
onReleased: {
|
||||||
@@ -138,7 +138,7 @@ Rectangle {
|
|||||||
const finalX = root.snappedLogical.x;
|
const finalX = root.snappedLogical.x;
|
||||||
const finalY = root.snappedLogical.y;
|
const finalY = root.snappedLogical.y;
|
||||||
|
|
||||||
if (DisplayConfigState.checkOverlap(root.outputName, finalX, finalY, size.w, size.h)) {
|
if (SettingsData.displaySnapToEdge && DisplayConfigState.checkOverlap(root.outputName, finalX, finalY, size.w, size.h)) {
|
||||||
root.isValidPosition = true;
|
root.isValidPosition = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -348,7 +348,7 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
width: parent.width - Theme.iconSize - Theme.spacingM - (displayFormatColumn.visible ? displayFormatColumn.width + Theme.spacingM : 0)
|
width: parent.width - Theme.iconSize - Theme.spacingM - (displayFormatColumn.visible ? displayFormatColumn.width + Theme.spacingM : 0) - (snapColumn.visible ? snapColumn.width + Theme.spacingM : 0)
|
||||||
spacing: Theme.spacingXS
|
spacing: Theme.spacingXS
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
@@ -368,6 +368,29 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
id: snapColumn
|
||||||
|
visible: true
|
||||||
|
spacing: Theme.spacingXS
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: I18n.tr("Snap")
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceVariantText
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
DankToggle {
|
||||||
|
id: snapToggle
|
||||||
|
checked: SettingsData.displaySnapToEdge
|
||||||
|
onToggled: checked => {
|
||||||
|
SettingsData.displaySnapToEdge = checked;
|
||||||
|
SettingsData.saveSettings();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
id: displayFormatColumn
|
id: displayFormatColumn
|
||||||
visible: !CompositorService.isDwl
|
visible: !CompositorService.isDwl
|
||||||
|
|||||||
Reference in New Issue
Block a user