Skip to content

Commit

Permalink
Merge pull request #1742 from googlefonts/issue-1720-shortcuts-for-pr…
Browse files Browse the repository at this point in the history
…evious-next-reference-font

Shortcuts for previous/next reference font
  • Loading branch information
ollimeier authored Oct 23, 2024
2 parents 0b18ab1 + 249b7f4 commit e2748b6
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 17 deletions.
11 changes: 6 additions & 5 deletions src/fontra/client/lang/de.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export const strings = {
"action-topics.glyph-editor-appearance": "Glyph Editor Ansicht",
"action-topics.menu.edit": "Bearbeiten",
"action-topics.menu.view": "Ansicht",
"action-topics.reference-font": "Referenz-Font",
"action-topics.selection-transformations": "Selektion transformieren",
"action-topics.sidebars": "Seitenleisten",
"action-topics.tools": "Werkzeuge",
Expand Down Expand Up @@ -45,7 +46,7 @@ export const strings = {
"application-settings.plugins-manager.title": "Plugin Manager",
"application-settings.server-info.title": "Server Info",
"application-settings.shortcuts.title": "Tastaturkurzbefehle",
"application-settings.theme-settings.title": "Design Einstellungen",
"application-settings.theme-settings.title": "Design-Einstellungen",
"axes.add": "Neue Achse hinzufügen",
"axes.axis-values": "Achsen Werte",
"axes.create": "Neue Achse",
Expand Down Expand Up @@ -81,8 +82,6 @@ export const strings = {
"axes.range.values": "Werte",
"axes.title": "Achsen",
"canvas.clean-view-and-hand-tool": "Ungehinderte Sicht und Hand Werkzeug",
"cross-axis-mapping.new": "Neues achsübergreifendes Mapping erstellen",
"cross-axis-mapping.title": "Achsübergreifendes Mapping",
"designspace-navigation.edit-all-compatible-sources":
"Bearbeite alle kompatiblen Sourcen",
"development-status-definitions.title": "Status Definitionen",
Expand Down Expand Up @@ -137,7 +136,7 @@ export const strings = {
"menubar.glyph.edit-axes": "Glyph-Achse bearbeiten...",
"menubar.help": "Hilfe",
"menubar.help.documentation": "Dokumentation",
"menubar.help.homepage": "Internetseite",
"menubar.help.homepage": "Homepage",
"menubar.view": "Ansicht",
"menubar.view.add-glyph-after-selected-glyph": "Glyphen hinzufügen (nach Auswahl) ",
"menubar.view.add-glyph-before-selected-glyph": "Glyphen hinzufügen (vor Auswahl) ",
Expand All @@ -148,6 +147,8 @@ export const strings = {
"Ersetze ausgewählten Glyphen auf der Zeichenfläche",
"menubar.view.select-next-source": "Nächste Source",
"menubar.view.select-previous-source": "Vorherige Source",
"reference-font.select-next-reference-font": "Vorheriger Referenz-Font",
"reference-font.select-previous-reference-font": "Nächster Referenz-Font",
"selection.none": "(Keine Auswahl)",
"sidebar.designspace-navigation": "Designspace Navigation",
"sidebar.designspace-navigation.font-axes": "Font-Achsen",
Expand Down Expand Up @@ -209,7 +210,7 @@ export const strings = {
"sidebar.selection-transformation.origin.top.center": "Ursprung oben zentriert",
"sidebar.selection-transformation.origin.top.left": "Ursprung oben links",
"sidebar.selection-transformation.origin.top.right": "Ursprung oben rechts",
"sidebar.selection-transformation.path-operations": "Pfad Anwendungen",
"sidebar.selection-transformation.path-operations": "Pfad-Anwendungen",
"sidebar.selection-transformation.path-operations.exclude": "Konturen ausschließen",
"sidebar.selection-transformation.path-operations.intersect": "Konturen schneiden",
"sidebar.selection-transformation.path-operations.subtract": "Konturen subtrahieren",
Expand Down
5 changes: 3 additions & 2 deletions src/fontra/client/lang/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export const strings = {
"action-topics.glyph-editor-appearance": "Glyph editor appearance",
"action-topics.menu.edit": "Edit",
"action-topics.menu.view": "View",
"action-topics.reference-font": "Reference font",
"action-topics.selection-transformations": "Selection Transformations",
"action-topics.sidebars": "Sidebars",
"action-topics.tools": "Tools",
Expand Down Expand Up @@ -81,8 +82,6 @@ export const strings = {
"axes.range.values": "Values",
"axes.title": "Axes",
"canvas.clean-view-and-hand-tool": "Clean View and Hand Tool",
"cross-axis-mapping.new": "New cross-axis mapping",
"cross-axis-mapping.title": "Cross-axis mapping",
"designspace-navigation.edit-all-compatible-sources": "Edit all compatible sources",
"development-status-definitions.title": "Status definitions",
"dialog.add": "Add",
Expand Down Expand Up @@ -145,6 +144,8 @@ export const strings = {
"menubar.view.replace-selected-glyph-on-canvas": "Replace selected glyph on canvas",
"menubar.view.select-next-source": "Select next source",
"menubar.view.select-previous-source": "Select previous source",
"reference-font.select-next-reference-font": "Select previous reference font",
"reference-font.select-previous-reference-font": "Select next reference font",
"selection.none": "(No selection)",
"sidebar.designspace-navigation": "Designspace Navigation",
"sidebar.designspace-navigation.font-axes": "Font axes",
Expand Down
7 changes: 4 additions & 3 deletions src/fontra/client/lang/fr.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export const strings = {
"action-topics.glyph-editor-appearance": "Glyphe édition apparence",
"action-topics.menu.edit": "Édition",
"action-topics.menu.view": "Affichage",
"action-topics.reference-font": "Fonte de référence",
"action-topics.selection-transformations": "Transformation de la sélection",
"action-topics.sidebars": "Barres latérales",
"action-topics.tools": "Outils",
Expand Down Expand Up @@ -81,11 +82,9 @@ export const strings = {
"axes.range.values": "Valeurs",
"axes.title": "Axes",
"canvas.clean-view-and-hand-tool": "Prévisualisation et outil de déplacement",
"cross-axis-mapping.new": "New cross-axis mapping",
"cross-axis-mapping.title": "Cross-axis mapping",
"designspace-navigation.edit-all-compatible-sources":
"Éditer toutes les sources compatibles",
"development-status-definitions.title": "Status definitions",
"development-status-definitions.title": "Définition des statuts",
"dialog.add": "Ajouter",
"dialog.cancel": "Annuler",
"dialog.create": "Créer",
Expand Down Expand Up @@ -150,6 +149,8 @@ export const strings = {
"Remplacer le glyphe sélectionné du canvas",
"menubar.view.select-next-source": "Sélectionner la source suivante ",
"menubar.view.select-previous-source": "Sélectionner la source précédente",
"reference-font.select-next-reference-font": "Select previous reference font",
"reference-font.select-previous-reference-font": "Select next reference font",
"selection.none": "(Pas de sélection)",
"sidebar.designspace-navigation": "Navigation du designspace",
"sidebar.designspace-navigation.font-axes": "Axes de la fonte",
Expand Down
9 changes: 5 additions & 4 deletions src/fontra/client/lang/nl.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export const strings = {
"action-topics.glyph-editor-appearance": "Glyph editor uiterlijk",
"action-topics.menu.edit": "Wijzig",
"action-topics.menu.view": "Weergave",
"action-topics.reference-font": "Referentiefont",
"action-topics.selection-transformations": "Selectie transformaties ",
"action-topics.sidebars": "Zijbalken",
"action-topics.tools": "Gereedschappen",
Expand Down Expand Up @@ -81,11 +82,9 @@ export const strings = {
"axes.range.values": "Waarden",
"axes.title": "Assen",
"canvas.clean-view-and-hand-tool": "Schone weergave en Hand gereedschap",
"cross-axis-mapping.new": "New cross-axis mapping",
"cross-axis-mapping.title": "Cross-axis mapping",
"designspace-navigation.edit-all-compatible-sources":
"Wijzig alle compatibele sources",
"development-status-definitions.title": "Status definitions",
"development-status-definitions.title": "Statusdefinities",
"dialog.add": "Voeg toe",
"dialog.cancel": "Annuleren",
"dialog.create": "Creëer",
Expand Down Expand Up @@ -149,6 +148,8 @@ export const strings = {
"Vervang de geselecteerde glyph op het canvas",
"menubar.view.select-next-source": "Selecteer de volgende source",
"menubar.view.select-previous-source": "Selecteer de vorige source",
"reference-font.select-next-reference-font": "Select previous reference font",
"reference-font.select-previous-reference-font": "Select next reference font",
"selection.none": "(Geen selectie)",
"sidebar.designspace-navigation": "Designspace navigatie",
"sidebar.designspace-navigation.font-axes": "Font assen",
Expand All @@ -158,7 +159,7 @@ export const strings = {
"sidebar.designspace-navigation.glyph-axes.edit": "Wijzig glyph assen",
"sidebar.designspace-navigation.glyph-axes.reset": "Reset glyph assen",
"sidebar.designspace-navigation.glyph-sources": "Glyph sources",
"sidebar.designspace-navigation.glyph-sources.name": "source naam",
"sidebar.designspace-navigation.glyph-sources.name": "sourcenaam",
"sidebar.designspace-navigation.glyph-sources.status": "status",
"sidebar.glyph-note": "Glyph notitie",
"sidebar.glyph-search": "Zoek glyphs",
Expand Down
5 changes: 3 additions & 2 deletions src/fontra/client/lang/zh-CN.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export const strings = {
"action-topics.glyph-editor-appearance": "字符形编辑器外观",
"action-topics.menu.edit": "编辑",
"action-topics.menu.view": "视图",
"action-topics.reference-font": "参考字体",
"action-topics.selection-transformations": "Selection Transformations",
"action-topics.sidebars": "Sidebars",
"action-topics.tools": "工具",
Expand Down Expand Up @@ -81,8 +82,6 @@ export const strings = {
"axes.range.values": "可选值",
"axes.title": "参数轴",
"canvas.clean-view-and-hand-tool": "Clean View and Hand Tool",
"cross-axis-mapping.new": "New cross-axis mapping",
"cross-axis-mapping.title": "Cross-axis mapping",
"designspace-navigation.edit-all-compatible-sources": "编辑所有匹配的图层",
"development-status-definitions.title": "Status definitions",
"dialog.add": "添加",
Expand Down Expand Up @@ -144,6 +143,8 @@ export const strings = {
"menubar.view.replace-selected-glyph-on-canvas": "在编辑区域中替换选中字符形",
"menubar.view.select-next-source": "选择下一个源",
"menubar.view.select-previous-source": "选择上一个源",
"reference-font.select-next-reference-font": "Select previous reference font",
"reference-font.select-previous-reference-font": "Select next reference font",
"selection.none": "(未选择)",
"sidebar.designspace-navigation": "Designspace 导航",
"sidebar.designspace-navigation.font-axes": "字体参数轴",
Expand Down
40 changes: 39 additions & 1 deletion src/fontra/views/editor/panel-reference-font.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { registerAction } from "../core/actions.js";
import Panel from "./panel.js";

import { getSelectedGlyphInfo } from "./scene-model.js";
Expand All @@ -11,7 +12,7 @@ import {
span,
} from "/core/html-utils.js";
import { ObservableController } from "/core/observable-object.js";
import { fetchJSON, fileNameExtension, withTimeout } from "/core/utils.js";
import { fetchJSON, fileNameExtension, modulo, withTimeout } from "/core/utils.js";
import { dialog, message } from "/web-components/modal-dialog.js";
import "/web-components/range-slider.js";
import { UIList } from "/web-components/ui-list.js";
Expand Down Expand Up @@ -322,6 +323,43 @@ export default class ReferenceFontPanel extends Panel {
cssString;
this.editorController.canvasController.requestUpdate();
});

this.initActions();
}

initActions() {
const topic = "0200-action-topics.reference-font";
registerAction(
"action.select-previous-reference-font",
{
topic,
titleKey: "reference-font.select-previous-reference-font",
defaultShortCuts: [],
},
() => this.doSelectPreviousNextReferenceFont(true)
);

registerAction(
"action.select-next-reference-font",
{
topic,
titleKey: "reference-font.select-next-reference-font",
defaultShortCuts: [],
},
() => this.doSelectPreviousNextReferenceFont(false)
);
}

async doSelectPreviousNextReferenceFont(selectPrevious) {
const listLength = this.filesUIList.items.length;
if (listLength < 2) {
return;
}

const index = this.filesUIList.getSelectedItemIndex() || 0;
const newIndex = modulo(index + (selectPrevious ? -1 : 1), listLength);

this.filesUIList.setSelectedItemIndex(newIndex, true);
}

async requestReferenceFontsPreview() {
Expand Down

0 comments on commit e2748b6

Please sign in to comment.