Skip to content

Commit

Permalink
Put 'select glyph/source/layer' menu items under submenu
Browse files Browse the repository at this point in the history
  • Loading branch information
justvanrossum committed Nov 27, 2024
1 parent 5c7903b commit 6489a2b
Showing 1 changed file with 36 additions and 10 deletions.
46 changes: 36 additions & 10 deletions src/fontra/views/editor/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,28 @@ export class EditorController {
() => this.doSelectPreviousNextSource(false)
);

registerAction(
"action.select-previous-source-layer",
{
topic,
titleKey: "menubar.view.select-previous-source-layer",
defaultShortCuts: [{ baseKey: "ArrowUp", commandKey: true, shiftKey: true }],
},
() => this.doSelectPreviousNextSourceLayer(true)
);

registerAction(
"action.select-next-source-layer",
{
topic,
titleKey: "menubar.view.select-next-source-layer",
defaultShortCuts: [
{ baseKey: "ArrowDown", commandKey: true, shiftKey: true },
],
},
() => this.doSelectPreviousNextSourceLayer(false)
);

registerAction(
"action.select-previous-glyph",
{
Expand Down Expand Up @@ -1586,17 +1608,17 @@ export class EditorController {
this.glyphSelectedContextMenuItems = [];

this.glyphSelectedContextMenuItems.push({
actionIdentifier: "action.select-previous-source",
});
this.glyphSelectedContextMenuItems.push({
actionIdentifier: "action.select-next-source",
});
this.glyphSelectedContextMenuItems.push({
actionIdentifier: "action.select-previous-glyph",
});
this.glyphSelectedContextMenuItems.push({
actionIdentifier: "action.select-next-glyph",
title: "Select glyph/source/layer",
getItems: () => [
{ actionIdentifier: "action.select-previous-glyph" },
{ actionIdentifier: "action.select-next-glyph" },
{ actionIdentifier: "action.select-previous-source" },
{ actionIdentifier: "action.select-next-source" },
{ actionIdentifier: "action.select-previous-source-layer" },
{ actionIdentifier: "action.select-next-source-layer" },
],
});

this.glyphSelectedContextMenuItems.push({
title: () =>
translate(
Expand Down Expand Up @@ -3079,6 +3101,10 @@ export class EditorController {
this.sceneSettings.selectedSourceIndex = newSourceIndex;
}

async doSelectPreviousNextSourceLayer(selectPrevious) {
console.log("next source layer", selectPrevious);
}

async doSelectPreviousNextGlyph(selectPrevious) {
const panel = this.getSidebarPanel("glyph-search");
const glyphNames = panel.glyphsSearch.getFilteredGlyphNames();
Expand Down

0 comments on commit 6489a2b

Please sign in to comment.