Skip to content

Commit

Permalink
Merge pull request #810 from googlefonts/info-sort-axes
Browse files Browse the repository at this point in the history
Sort axes, but lc first
  • Loading branch information
justvanrossum authored Sep 14, 2023
2 parents e0cac56 + 4ac609c commit 9593eb7
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/fontra/views/editor/panel-selection-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,18 @@ export default class SelectionInfoPanel extends Panel {
axes[axis.name] = axis;
}
}
for (const axis of Object.values(axes)) {
const axisList = Object.values(axes);
// Sort axes: lowercase first, uppercase last
axisList.sort((a, b) => {
const firstCharAIsUpper = a.name[0] === a.name[0].toUpperCase();
const firstCharBIsUpper = b.name[0] === b.name[0].toUpperCase();
if (firstCharAIsUpper != firstCharBIsUpper) {
return firstCharBIsUpper ? -1 : 1;
} else {
return a.name < b.name ? -1 : +1;
}
});
for (const axis of axisList) {
let value = component.location[axis.name];
if (value === undefined) {
value = axis.defaultValue;
Expand Down

0 comments on commit 9593eb7

Please sign in to comment.