Context menu: improve right click

-Improve right click
-Disable context pin menu with 0 pins

Change-Id: I8f53710d85c09a624acdac370af980f3c0947190
Reviewed-by: spyro-adb <adb@spyro-soft.com>
This commit is contained in:
Andrzej Biniek
2024-12-26 22:21:15 +01:00
committed by spyro-adb
parent 9651a7ca70
commit 1c64cff458
2 changed files with 14 additions and 1 deletions

View File

@@ -294,6 +294,19 @@ Item {
graph.removeSelection();
}
}
onNodeRightClicked: node => {
if (NodeGraphEditorBackend.nodeGraphEditorModel.currentFileName !== "") {
contextMenu.node = node;
var selectedNodes = graphView.graph.selectedNodes;
if (selectedNodes && selectedNodes.length > 0) {
contextMenu.node = selectedNodes.at(0);
}
const factor = (1.0 / graphView.zoom);
contextMenu.newPosition = Qt.point(-graphView.containerItem.x * factor + node.item.x * factor, -graphView.containerItem.y * factor + node.item.y * factor);
contextMenu.popup();
}
}
onRightClicked: pos => {
if (NodeGraphEditorBackend.nodeGraphEditorModel.currentFileName !== "") {
contextMenu.node = null;

View File

@@ -113,7 +113,7 @@ StudioControls.Menu {
}
StudioControls.Menu {
enabled: node !== null
enabled: node !== null && pinRepeater.count > 0
title: "Pins"
Repeater {