Skip to content

Commit

Permalink
Pasted mappings were being added incorrectly
Browse files Browse the repository at this point in the history
(the axes not being set by the mapping should have been set to default values, rather than undefined)
  • Loading branch information
Lorp committed Jun 7, 2024
1 parent 111dbe7 commit 9a4aa41
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/fencer.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Element.prototype.attr = function (attrs) {
}

Element.prototype.setPosition = function (position) {
this.setAttribute("transform", `translate(${position[0]}, ${position[1]})`)
this.setAttribute("transform", `translate(${position[0]},${position[1]})`)
}

function simpleNormalize(axis, value) {
Expand Down Expand Up @@ -1317,7 +1317,12 @@ function xmlChanged(e) {
}
else {
xmlDoc.querySelectorAll("mappings>mapping").forEach(mappingEl => {
const mapping = [[],[]];

// initialize the mapping to be the default location for all axes, on input and output
const mapping = [];
mapping[0] = GLOBAL.font.fvar.axes.map(axis => axis.defaultValue);
mapping[1] = [...mapping[0]];

mappingEl.querySelectorAll("input>dimension").forEach(dimEl => {
const axisName = dimEl.getAttribute("name");
const axis = GLOBAL.font.fvar.axes.find(axis => axis.name === axisName);
Expand Down

0 comments on commit 9a4aa41

Please sign in to comment.