From 4ac609cf15821d73efe8cb6d6dcd0da3be7ba2dc Mon Sep 17 00:00:00 2001 From: Just van Rossum Date: Thu, 14 Sep 2023 19:58:05 +0200 Subject: [PATCH] Sort axes, but lc first --- src/fontra/views/editor/panel-selection-info.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/fontra/views/editor/panel-selection-info.js b/src/fontra/views/editor/panel-selection-info.js index e16666e90..e7bed5a9c 100644 --- a/src/fontra/views/editor/panel-selection-info.js +++ b/src/fontra/views/editor/panel-selection-info.js @@ -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;