Fixing tons of bugs.
All checks were successful
continuous-integration/drone/push Build is passing

1. Height of object list items should be adaptable to image's heights.
2. Fixed object positioning
3. Buttons of object rows are now vertically centered.
4. Fixing expr-eval not recognizing certain characters as part of the variable.
5. Fixing silent error when misentering variables preventing you from changing the expression again.
6. Fixing points in gains and phases having name-related issues.
7. (in the previous commit) Fixing invisible buttons at the end of the object row when not changing tabs.
This commit is contained in:
Ad5001 2022-10-18 02:55:15 +02:00
parent 9facc2389c
commit f76b601139
Signed by: Ad5001
GPG key ID: 7251B1AF90B960F9
7 changed files with 34 additions and 22 deletions

View file

@ -46,8 +46,9 @@ Item {
property var posPicker
property alias objVisible: objVisibilityCheckBox.checked
property int minHeight: 40
height: 40
height: objDescription.height
width: obj.typeList.width
CheckBox {
@ -74,17 +75,18 @@ Item {
id: objDescription
anchors.left: objVisibilityCheckBox.right
anchors.right: deleteButton.left
height: parent.height
height: LatexJS.enabled ? Math.max(parent.minHeight, latexDescription.height+4) : parent.minHeight
verticalAlignment: TextInput.AlignVCenter
text: LatexJS.enabled ? "" : obj.getReadableString()
font.pixelSize: 14
Image {
id: latexDescription
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
visible: LatexJS.enabled
property double depth: 2
property var ltxInfo: visible ? Latex.render(obj.getLatexLabel(), depth*parent.font.pixelSize, parent.color).split(",") : ["","0","0"]
property var ltxInfo: visible ? Latex.render(obj.getLatexString(), depth*parent.font.pixelSize+4, parent.color).split(",") : ["","0","0"]
source: visible ? ltxInfo[0] : ""
width: parseInt(ltxInfo[1])/depth
height: parseInt(ltxInfo[2])/depth
@ -94,7 +96,7 @@ Item {
anchors.fill: parent
onClicked: {
objEditor.obj = Objects.currentObjects[obj.type][index]
objEditor.obj.type = obj.type
objEditor.objType = obj.type
objEditor.objIndex = index
//objEditor.editingRow = objectRow
objEditor.show()
@ -108,7 +110,7 @@ Item {
height: width
anchors.right: deleteButton.left
anchors.rightMargin: 5
anchors.topMargin: 5
anchors.verticalCenter: parent.verticalCenter
Setting.Icon {
id: icon
@ -127,6 +129,7 @@ Item {
ToolTip.text: qsTr("Set %1 %2 position").arg(obj.constructor.displayType()).arg(obj.name)
onClicked: {
console.log(obj.type, obj.name)
posPicker.objType = obj.type
posPicker.objName = obj.name
posPicker.pickX = hasXProp
@ -140,11 +143,11 @@ Item {
Button {
id: deleteButton
width: parent.height - 10
width: parent.minHeight - 10
height: width
anchors.right: colorPickRect.left
anchors.rightMargin: 5
anchors.topMargin: 5
anchors.verticalCenter: parent.verticalCenter
icon.name: 'delete'
icon.source: '../icons/common/delete.svg'
icon.color: sysPalette.buttonText
@ -164,9 +167,9 @@ Item {
id: colorPickRect
anchors.right: parent.right
anchors.rightMargin: 5
anchors.topMargin: 5
anchors.verticalCenter: parent.verticalCenter
color: obj.color
width: parent.height - 10
width: parent.minHeight - 10
height: width
radius: Math.min(width, height)
border.width: 2

View file

@ -49,7 +49,7 @@ Item {
//smooth: true
visible: false
sourceSize.width: width*2
sourceSize.height: sourceSize.width
sourceSize.height: width*2
}
ColorOverlay {
anchors.fill: img

View file

@ -165,7 +165,6 @@ Item {
"ₜ","¹","²","³","⁴","⁵","⁶",
"⁷","⁸","⁹","⁰","₁","₂","₃",
"₄","₅","₆","₇","₈","₉","₀"
]
Repeater {
model: parent.insertChars.length

View file

@ -16,6 +16,19 @@ var IMEMBER = 'IMEMBER';
var IENDSTATEMENT = 'IENDSTATEMENT';
var IARRAY = 'IARRAY';
// Additional variable characters.
var ADDITIONAL_VARCHARS = [
"α","β","γ","δ","ε","ζ","η",
"π","θ","κ","λ","μ","ξ","ρ",
"ς","σ","τ","φ","χ","ψ","ω",
"Γ","Δ","Θ","Λ","Ξ","Π","Σ",
"Φ","Ψ","Ω","ₐ","ₑ","ₒ","ₓ",
"ₕ","ₖ","ₗ","ₘ","ₙ","ₚ","ₛ",
"ₜ","¹","²","³","⁴","⁵","⁶",
"⁷","⁸","⁹","⁰","₁","₂","₃",
"₄","₅","₆","₇","₈","₉","₀"
]
function Instruction(type, value) {
this.type = type;
this.value = (value !== undefined && value !== null) ? value : 0;
@ -707,7 +720,7 @@ TokenStream.prototype.isName = function () {
var hasLetter = false;
for (; i < this.expression.length; i++) {
var c = this.expression.charAt(i);
if (c.toUpperCase() === c.toLowerCase()) {
if (c.toUpperCase() === c.toLowerCase() && !ADDITIONAL_VARCHARS.includes(c)) {
if (i === this.pos && (c === '$' || c === '_')) {
if (c === '_') {
hasLetter = true;

View file

@ -200,8 +200,10 @@ class DrawableObject {
if(properties[property] == 'Expression' && this[property] != null) {
// Expressions with dependencies
for(let objName of this[property].requiredObjects()) {
this.requires.push(C.currentObjectsByName[objName])
C.currentObjectsByName[objName].requiredBy.push(this)
if(objName in C.currentObjectsByName) {
this.requires.push(C.currentObjectsByName[objName])
C.currentObjectsByName[objName].requiredBy.push(this)
}
}
if(this[property].cached && this[property].requiredObjects().length > 0)
// Recalculate

View file

@ -52,11 +52,9 @@ class GainBode extends Common.ExecutableObject {
om_0 = Objects.currentObjectsByName[om_0]
if(om_0 == null) {
// Create new point
om_0 = Objects.createNewRegisteredObject('Point')
om_0.name = Common.getNewName('ω')
om_0.labelContent = 'name'
om_0.color = this.color
om_0 = Objects.createNewRegisteredObject('Point', [Common.getNewName('ω'), true, this.color, 'name'])
HistoryLib.history.addToHistory(new HistoryLib.CreateNewObject(om_0.name, 'Point', om_0.export()))
om_0.update()
labelPosition = 'below'
}
om_0.requiredBy.push(this)

View file

@ -51,10 +51,7 @@ class PhaseBode extends Common.ExecutableObject {
om_0 = Objects.currentObjectsByName[om_0]
if(om_0 == null) {
// Create new point
om_0 = Objects.createNewRegisteredObject('Point')
om_0.name = Common.getNewName('ω')
om_0.color = this.color
om_0.labelContent = 'name'
om_0 = Objects.createNewRegisteredObject('Point', [Common.getNewName('ω'), this.color, 'name'])
om_0.labelPosition = this.phase.execute() >= 0 ? 'above' : 'below'
HistoryLib.history.addToHistory(new HistoryLib.CreateNewObject(om_0.name, 'Point', om_0.export()))
labelPosition = 'below'