diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/ObjectLists/ObjectLists.qml b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/ObjectLists/ObjectLists.qml index 63db337..101d9ed 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/ObjectLists/ObjectLists.qml +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/ObjectLists/ObjectLists.qml @@ -136,7 +136,7 @@ ListView { onClicked: { positionPicker.objType = objType - positionPicker.objName = Objects.currentObjects[objType][index].name + positionPicker.objName = obj.name positionPicker.pickX = hasXProp positionPicker.pickY = hasYProp positionPicker.propertyX = 'x' @@ -154,10 +154,12 @@ ListView { anchors.rightMargin: 5 anchors.topMargin: 5 icon.name: 'delete' + ToolTip.visible: hovered + ToolTip.text: 'Delete ' + Objects.types[objType].displayType() + '.' onClicked: { 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].splice(index, 1) diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/PickLocationOverlay.qml b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/PickLocationOverlay.qml index 1de03dc..42545cb 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/PickLocationOverlay.qml +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/PickLocationOverlay.qml @@ -46,34 +46,37 @@ Item { anchors.fill: parent hoverEnabled: parent.visible cursorShape: Qt.CrossCursor + acceptedButtons: Qt.LeftButton | Qt.RightButton onClicked: { - if(parent.pickX) { - var newValue = canvas.px2x(picker.mouseX).toFixed(parent.precision) - newValue = { - 'Expression': () => new MathLib.Expression(newValue), - 'number': () => parseFloat(newValue) - }[Objects.types[objType].properties()[propertyX]]() - var obj = Objects.getObjectByName(objName, objType) - history.addToHistory(new HistoryLib.EditedProperty( - objName, objType, propertyX, obj[propertyX], newValue - )) - obj[propertyX] = newValue - obj.update() - objectLists.update() - } - if(parent.pickY) { - var newValue = canvas.px2y(picker.mouseY).toFixed(parent.precision) - newValue = { - 'Expression': () => new MathLib.Expression(newValue), - 'number': () => parseFloat(newValue) - }[Objects.types[objType].properties()[propertyY]]() - var obj = Objects.getObjectByName(objName, objType) - history.addToHistory(new HistoryLib.EditedProperty( - objName, objType, propertyY, obj[propertyY], newValue - )) - obj[propertyY] = newValue - obj.update() - objectLists.update() + if(mouse.button == Qt.LeftButton) { // Validate + if(parent.pickX) { + var newValue = canvas.px2x(picker.mouseX).toFixed(parent.precision) + newValue = { + 'Expression': () => new MathLib.Expression(newValue), + 'number': () => parseFloat(newValue) + }[Objects.types[objType].properties()[propertyX]]() + var obj = Objects.getObjectByName(objName, objType) + history.addToHistory(new HistoryLib.EditedProperty( + objName, objType, propertyX, obj[propertyX], newValue + )) + obj[propertyX] = newValue + obj.update() + objectLists.update() + } + if(parent.pickY) { + var newValue = canvas.px2y(picker.mouseY).toFixed(parent.precision) + newValue = { + 'Expression': () => new MathLib.Expression(newValue), + 'number': () => parseFloat(newValue) + }[Objects.types[objType].properties()[propertyY]]() + var obj = Objects.getObjectByName(objName, objType) + history.addToHistory(new HistoryLib.EditedProperty( + objName, objType, propertyY, obj[propertyY], newValue + )) + obj[propertyY] = newValue + obj.update() + objectLists.update() + } } pickerRoot.visible = false; }