Added the ability to cancel the position setting with right click.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Adsooi 2021-08-15 17:18:50 +02:00
parent 63d9f00e96
commit 9fd584f881
Signed by: Ad5001
GPG key ID: EF45F9C6AFE20160
2 changed files with 34 additions and 29 deletions

View file

@ -136,7 +136,7 @@ ListView {
onClicked: { onClicked: {
positionPicker.objType = objType positionPicker.objType = objType
positionPicker.objName = Objects.currentObjects[objType][index].name positionPicker.objName = obj.name
positionPicker.pickX = hasXProp positionPicker.pickX = hasXProp
positionPicker.pickY = hasYProp positionPicker.pickY = hasYProp
positionPicker.propertyX = 'x' positionPicker.propertyX = 'x'
@ -154,10 +154,12 @@ ListView {
anchors.rightMargin: 5 anchors.rightMargin: 5
anchors.topMargin: 5 anchors.topMargin: 5
icon.name: 'delete' icon.name: 'delete'
ToolTip.visible: hovered
ToolTip.text: 'Delete ' + Objects.types[objType].displayType() + '.'
onClicked: { onClicked: {
history.addToHistory(new HistoryLib.DeleteObject( history.addToHistory(new HistoryLib.DeleteObject(
Objects.currentObjects[objType][index].name, objType, Objects.currentObjects[objType][index].export() obj.name, objType, obj.export()
)) ))
Objects.currentObjects[objType][index].delete() Objects.currentObjects[objType][index].delete()
Objects.currentObjects[objType].splice(index, 1) Objects.currentObjects[objType].splice(index, 1)

View file

@ -46,7 +46,9 @@ Item {
anchors.fill: parent anchors.fill: parent
hoverEnabled: parent.visible hoverEnabled: parent.visible
cursorShape: Qt.CrossCursor cursorShape: Qt.CrossCursor
acceptedButtons: Qt.LeftButton | Qt.RightButton
onClicked: { onClicked: {
if(mouse.button == Qt.LeftButton) { // Validate
if(parent.pickX) { if(parent.pickX) {
var newValue = canvas.px2x(picker.mouseX).toFixed(parent.precision) var newValue = canvas.px2x(picker.mouseX).toFixed(parent.precision)
newValue = { newValue = {
@ -75,6 +77,7 @@ Item {
obj.update() obj.update()
objectLists.update() objectLists.update()
} }
}
pickerRoot.visible = false; pickerRoot.visible = false;
} }
} }