From 277a87a53b24258db1b7f48b54fc24dc012e0f99 Mon Sep 17 00:00:00 2001 From: grendervill Date: Tue, 1 Sep 2026 22:37:40 +0300 Subject: [PATCH] =?UTF-8?q?UX:=20handles=2012px=20=D1=85=D0=B8=D1=82-?= =?UTF-8?q?=D0=B7=D0=BE=D0=BD=D0=B0=20=D0=BF=D0=BE=20=D0=B2=D1=81=D0=B5?= =?UTF-8?q?=D0=B9=20=D0=B2=D1=8B=D1=81=D0=BE=D1=82=D0=B5,=20=D0=BA=D0=B0?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=B4=D0=B0=D1=80=D1=8C=20=D1=88=D0=B8=D1=80?= =?UTF-8?q?=D0=B5,=20Enter=20=D0=BF=D0=BE=D1=87=D0=B8=D0=BD=D0=B5=D0=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - SplitView handle: implicit 12 (было 1/6), Rectangle fill parent + hit 16, cursor SplitH/VCursor, для файлового дерева/живого просмотра/графа-календаря — теперь легко попасть по всей высоте - MonthCalendar: header 28x28 radius 14, month Label fill 70-110 + year 42/38, font 11, elide, spacing 4 — 'сентябрь 2026' не налезает, кнопки 28 круглые opaque (surface/hover/selected) - RightPanel: удалён дубль 'Сегодня' ☷ из calBox header (оставлен только ⌂ в MonthCalendar) - EditorPanel: Enter через Keys.onReturnPressed/onEnterPressed handleEnter() (сохранение indent), убран дубль в onPressed — теперь новая строка работает --- qml/MainWindow.qml | 14 +++------ qml/panels/EditorPanel.qml | 63 ++++++++++++++++++-------------------- qml/panels/RightPanel.qml | 9 +++--- 3 files changed, 37 insertions(+), 49 deletions(-) diff --git a/qml/MainWindow.qml b/qml/MainWindow.qml index 1911e88..d342f6c 100644 --- a/qml/MainWindow.qml +++ b/qml/MainWindow.qml @@ -233,29 +233,23 @@ ApplicationWindow { id: mainSplit anchors.fill: parent orientation: Qt.Horizontal - // Увеличенная зона захвата для удобного перетаскивания + // Увеличенная зона захвата — работает по всей высоте handle: Rectangle { - implicitWidth: 6 - implicitHeight: 6 - color: Theme.divider - // Видимая тонкая линия по центру + implicitWidth: 12 + color: "transparent" Rectangle { anchors.centerIn: parent width: 1; height: parent.height color: Theme.divider } - // Большая невидимая зона для захвата мышью Rectangle { - anchors.centerIn: parent - width: 16; height: parent.height + anchors.fill: parent color: "transparent" MouseArea { anchors.fill: parent cursorShape: Qt.SplitHCursor hoverEnabled: true onPressed: mouse.accepted = false - ToolTip.visible: containsMouse - ToolTip.text: qsTr("Перетащите для изменения размера") } } } diff --git a/qml/panels/EditorPanel.qml b/qml/panels/EditorPanel.qml index 6cd6d3e..301cd17 100644 --- a/qml/panels/EditorPanel.qml +++ b/qml/panels/EditorPanel.qml @@ -242,9 +242,8 @@ Item { anchors.bottom: toolbar.top orientation: Qt.Horizontal handle: Rectangle { - implicitWidth: viewMode === "live" ? 6 : 0 - implicitHeight: viewMode === "live" ? 6 : 0 - color: Theme.divider + implicitWidth: viewMode === "live" ? 12 : 0 + color: "transparent" visible: viewMode === "live" Rectangle { anchors.centerIn: parent @@ -253,8 +252,7 @@ Item { visible: parent.visible } Rectangle { - anchors.centerIn: parent - width: 16; height: parent.height + anchors.fill: parent color: "transparent" visible: parent.visible MouseArea { @@ -351,8 +349,33 @@ Item { if (viewMode === "live") liveDebounce.restart() } function insertText(t) { insert(cursorPosition, t) } + function handleEnter() { + const pos = cursorPosition + let lineStart = text.lastIndexOf("\n", pos-1) + 1 + let line = text.substring(lineStart, pos) + let indent = "" + const m = line.match(/^(\s+)/) + if (m) indent = m[1] + const trimmed = line.trimEnd() + if (trimmed.endsWith("{") || trimmed.endsWith("[") || trimmed.endsWith("(") || trimmed.endsWith(":") || trimmed.endsWith(">")) { + indent += " " + } + let extra = "" + if (pos < text.length) { + const next = text[pos] + if (next === "}" || next === "]" || next === ")") { + extra = "\n" + indent.substring(0, Math.max(0, indent.length-4)) + } + } + const ins = "\n" + indent + extra + insert(pos, ins) + cursorPosition = pos + 1 + indent.length + if (documentManager.activeIndex >=0) documentManager.updateContent(documentManager.activeIndex, text) + } // Авто-отступ и скобки + Keys.onReturnPressed: handleEnter() + Keys.onEnterPressed: handleEnter() Keys.onPressed: (event) => { // Tab — 4 пробела, Shift+Tab — снять отступ if (event.key === Qt.Key_Tab) { @@ -408,35 +431,7 @@ Item { } } } - // Enter — сохранить отступ - if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter) { - event.accepted = true - const pos = cursorPosition - let lineStart = text.lastIndexOf("\n", pos-1) + 1 - let line = text.substring(lineStart, pos) - let indent = "" - const m = line.match(/^(\s+)/) - if (m) indent = m[1] - // Если предыдущая строка заканчивается на { [ ( или : — добавить отступ - const trimmed = line.trimEnd() - if (trimmed.endsWith("{") || trimmed.endsWith("[") || trimmed.endsWith("(") || trimmed.endsWith(":") || trimmed.endsWith(">")) { - // проверим не закрыта ли скобка сразу - indent += " " - } - // Если мы внутри скобок {} — добавить перенос и отступ для закрывающей - let extra = "" - if (pos < text.length) { - const next = text[pos] - if (next === "}" || next === "]" || next === ")") { - extra = "\n" + indent.substring(0, Math.max(0, indent.length-4)) - } - } - const insertText = "\n" + indent + extra - insert(pos, insertText) - cursorPosition = pos + 1 + indent.length - if (documentManager.activeIndex >=0) documentManager.updateContent(documentManager.activeIndex, text) - return - } + // Тег автозакрытие при вводе > — ДО проверки перепрыгивания, чтобы вставить if (event.text === ">") { const pos = cursorPosition diff --git a/qml/panels/RightPanel.qml b/qml/panels/RightPanel.qml index 78e7737..213b5d6 100644 --- a/qml/panels/RightPanel.qml +++ b/qml/panels/RightPanel.qml @@ -37,21 +37,20 @@ Item { Connections { target: vaultIndex; function onIndexChanged() { root.refreshLinksTags() } } Timer { id: rebuildDebounce; interval: 800; onTriggered: if (fileStore.ready) vaultIndex.rebuild(fileStore.vault) } - // Делаем панели ресайзабельными внутри правой колонки — увеличенная зона + // Делаем панели ресайзабельными внутри правой колонки — увеличенная зона по всей ширине SplitView { anchors.fill: parent orientation: Qt.Vertical handle: Rectangle { - implicitHeight: 6 - color: Theme.divider + implicitHeight: 12 + color: "transparent" Rectangle { anchors.centerIn: parent height: 1; width: parent.width color: Theme.divider } Rectangle { - anchors.centerIn: parent - height: 16; width: parent.width + anchors.fill: parent color: "transparent" MouseArea { anchors.fill: parent