From c76bf9c5beefe991c0a6571c9bf9e88719cd4d33 Mon Sep 17 00:00:00 2001 From: reionwong Date: Tue, 7 Sep 2021 16:57:31 +0800 Subject: [PATCH] Fix size tooltip position --- qml/main.qml | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/qml/main.qml b/qml/main.qml index edecd11..64b831e 100644 --- a/qml/main.qml +++ b/qml/main.qml @@ -171,6 +171,7 @@ Item { } MouseArea { + id: selectLayerMouseArea anchors.fill: parent cursorShape: Qt.SizeAllCursor acceptedButtons: Qt.LeftButton @@ -185,14 +186,26 @@ Item { width: sizeLabel.implicitWidth + FishUI.Units.largeSpacing height: sizeLabel.implicitHeight + FishUI.Units.largeSpacing + z: 999 x: selectLayer.x - y: selectLayer.y - sizeToolTip.height - FishUI.Units.smallSpacing + y: { + var newY = selectLayer.y - sizeToolTip.height - FishUI.Units.smallSpacing + + if (newY < control.y) + newY = control.y + + return newY + } radius: FishUI.Theme.smallRadius color: Qt.rgba(FishUI.Theme.backgroundColor.r, FishUI.Theme.backgroundColor.g, - FishUI.Theme.backgroundColor.b, 0.8) + FishUI.Theme.backgroundColor.b, 0.9) + border.width: 1 + border.color: Qt.rgba(FishUI.Theme.textColor.r, + FishUI.Theme.textColor.g, + FishUI.Theme.textColor.b, 0.15) Label { id: sizeLabel @@ -207,7 +220,7 @@ Item { width: toolsLayout.implicitWidth + FishUI.Units.largeSpacing height: 36 + FishUI.Units.smallSpacing - visible: sizeToolTip.visible + visible: selectLayer.visible && selectLayer.width > 1 && selectLayer.height > 1 z: 999 // 放在右侧