[nostalgia/core/studio] Fix TileSheetEditor not to display context menu when right click is not on tile

This commit is contained in:
Gary Talent 2020-06-13 03:37:38 -05:00
parent 53358d2e03
commit 5c5c62dc55

View File

@ -23,7 +23,10 @@ Rectangle {
onClicked: { onClicked: {
if (mouse.button === Qt.RightButton) { if (mouse.button === Qt.RightButton) {
contextMenu.popup(); var tile = mouseArea.tileAt(mouseX, mouseY);
if (tile) {
contextMenu.popup();
}
} else { } else {
contextMenu.dismiss(); contextMenu.dismiss();
} }
@ -92,7 +95,9 @@ Rectangle {
text: "Insert Tile" text: "Insert Tile"
onTriggered: { onTriggered: {
var tile = mouseArea.tileAt(contextMenu.x, contextMenu.y); var tile = mouseArea.tileAt(contextMenu.x, contextMenu.y);
sheetData.insertTileCmd(tile.tileNumber); if (tile) {
sheetData.insertTileCmd(tile.tileNumber);
}
} }
} }