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