Skip to content

Commit

Permalink
Update disabled-state of glyph axes reset button appropriately
Browse files Browse the repository at this point in the history
  • Loading branch information
justvanrossum committed May 16, 2024
1 parent 4ea87bf commit 7f311ca
Showing 1 changed file with 20 additions and 12 deletions.
32 changes: 20 additions & 12 deletions src/fontra/views/editor/panel-designspace-navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -425,20 +425,28 @@ export default class DesignspaceNavigationPanel extends Panel {
}

_updateResetAllAxesButtonState() {
const location = this.sceneSettings.location;
let locationEmpty = true;
for (const axis of this.fontAxesElement.axes) {
if (
axis.name &&
axis.name in location &&
location[axis.name] !== axis.defaultValue
) {
locationEmpty = false;
break;
for (const [location, axesElement, buttonID] of [
[this.sceneSettings.location, this.fontAxesElement, "reset-font-axes-button"],
[
this.sceneSettings.glyphLocation,
this.glyphAxesElement,
"reset-glyph-axes-button",
],
]) {
let locationEmpty = true;
for (const axis of axesElement.axes) {
if (
axis.name &&
axis.name in location &&
location[axis.name] !== axis.defaultValue
) {
locationEmpty = false;
break;
}
}
const button = this.qs(`#${buttonID}`);
button.disabled = locationEmpty;
}
const button = this.qs("#reset-font-axes-button");
button.disabled = locationEmpty;
}

async onVisibilityHeaderClick(event) {
Expand Down

0 comments on commit 7f311ca

Please sign in to comment.