mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-31 17:02:51 -05:00
@@ -523,6 +523,7 @@ Singleton {
|
||||
property var activeDisplayProfile: ({})
|
||||
property bool displayProfileAutoSelect: false
|
||||
property bool displayShowDisconnected: false
|
||||
property bool displaySnapToEdge: true
|
||||
|
||||
property var barConfigs: [
|
||||
{
|
||||
|
||||
@@ -351,6 +351,7 @@ var SPEC = {
|
||||
activeDisplayProfile: { def: {} },
|
||||
displayProfileAutoSelect: { def: false },
|
||||
displayShowDisconnected: { def: false },
|
||||
displaySnapToEdge: { def: true },
|
||||
|
||||
barConfigs: {
|
||||
def: [{
|
||||
|
||||
@@ -55,7 +55,7 @@ Rectangle {
|
||||
|
||||
Rectangle {
|
||||
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
|
||||
y: root.snappedLogical.y * root.canvasScaleFactor + root.canvasOffset.y - root.y
|
||||
width: parent.width
|
||||
@@ -124,9 +124,9 @@ Rectangle {
|
||||
|
||||
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.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: {
|
||||
@@ -138,7 +138,7 @@ Rectangle {
|
||||
const finalX = root.snappedLogical.x;
|
||||
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;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -348,7 +348,7 @@ Item {
|
||||
}
|
||||
|
||||
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
|
||||
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 {
|
||||
id: displayFormatColumn
|
||||
visible: !CompositorService.isDwl
|
||||
|
||||
Reference in New Issue
Block a user