Skip to content

Commit 45caee1

Browse files
committed
Support for relative fields
1 parent 7fd96e9 commit 45caee1

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/dspf.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,19 @@ class DisplayFile {
7878
this.currentField.handleKeywords();
7979
this.currentFields.push(this.currentField);
8080
}
81+
82+
let totalX = Number(x);
83+
if (x.startsWith(`+`)) {
84+
totalX = this.currentFields[this.currentFields.length - 1].position.x + Number(x.substring(1));
85+
86+
if (this.currentFields[this.currentFields.length - 1].value) {
87+
totalX += this.currentFields[this.currentFields.length - 1].value.length;
88+
}
89+
}
8190

8291
this.currentField = new FieldInfo();
8392
this.currentField.position = {
84-
x: Number(x),
93+
x: totalX,
8594
y: 0
8695
};
8796
}

0 commit comments

Comments
 (0)