From 1beafc524a5cbdbd8d3c44811d96fdf78f64a009 Mon Sep 17 00:00:00 2001 From: Olli Meier Date: Wed, 25 Sep 2024 17:39:55 +0200 Subject: [PATCH 1/7] Adding editor-behavior-panel to application settings --- .../client/core/experimental-features.js | 11 ++++++ src/fontra/client/lang/en.json | 1 + src/fontra/client/lang/zh-CN.json | 1 + .../applicationsettings.js | 2 ++ .../panel-editor-behavior.js | 35 +++++++++++++++++++ src/fontra/views/editor/editor.js | 13 +++---- 6 files changed, 55 insertions(+), 8 deletions(-) create mode 100644 src/fontra/client/core/experimental-features.js create mode 100644 src/fontra/views/applicationsettings/panel-editor-behavior.js diff --git a/src/fontra/client/core/experimental-features.js b/src/fontra/client/core/experimental-features.js new file mode 100644 index 000000000..72ec864c7 --- /dev/null +++ b/src/fontra/client/core/experimental-features.js @@ -0,0 +1,11 @@ +import { ObservableController } from "./observable-object.js"; + +export const experimentalFeaturesController = new ObservableController({ + scalingEditBehavior: false, + quadPenTool: false, + rectSelectLiveModifiers: false, +}); + +experimentalFeaturesController.synchronizeWithLocalStorage( + "fontra-editor-experimental-features." +); diff --git a/src/fontra/client/lang/en.json b/src/fontra/client/lang/en.json index 05a9de831..0e93069e5 100644 --- a/src/fontra/client/lang/en.json +++ b/src/fontra/client/lang/en.json @@ -30,6 +30,7 @@ "application-settings.clipboard.title": "Clipboard", "application-settings.display-language.title": "Display Language", "application-settings.plugins-manager.title": "Plugin Manager", + "application-settings.editor-behavior.title": "Editor Behavior", "application-settings.server-info.title": "Server info", "application-settings.shortcuts.title": "Shortcuts", "application-settings.theme-settings.title": "Theme settings", diff --git a/src/fontra/client/lang/zh-CN.json b/src/fontra/client/lang/zh-CN.json index 961af8cb2..efb6d4688 100644 --- a/src/fontra/client/lang/zh-CN.json +++ b/src/fontra/client/lang/zh-CN.json @@ -29,6 +29,7 @@ "application-settings.clipboard.title": "剪贴板导出格式", "application-settings.display-language.title": "Display Language", "application-settings.plugins-manager.title": "插件管理器", + "application-settings.editor-behavior.title": "Editor Behavior", "application-settings.server-info.title": "服务器信息", "application-settings.shortcuts.title": "Shortcuts", "application-settings.theme-settings.title": "主题设置", diff --git a/src/fontra/views/applicationsettings/applicationsettings.js b/src/fontra/views/applicationsettings/applicationsettings.js index f523dfd57..3319559af 100644 --- a/src/fontra/views/applicationsettings/applicationsettings.js +++ b/src/fontra/views/applicationsettings/applicationsettings.js @@ -2,6 +2,7 @@ import * as html from "../core/html-utils.js"; import { ClipboardPanel } from "./panel-clipboard.js"; import { DisplayLanguagePanel } from "./panel-display-language.js"; import { PluginsManagerPanel } from "./panel-plugins-manager.js"; +import { EditorBehaviorPanel } from "./panel-editor-behavior.js"; import { ServerInfoPanel } from "./panel-server-info.js"; import { ShortCutsPanel } from "./panel-shortcuts.js"; import { ThemeSettingsPanel } from "./panel-theme-settings.js"; @@ -29,6 +30,7 @@ export class ApplicationSettingsController { ThemeSettingsPanel, DisplayLanguagePanel, ClipboardPanel, + EditorBehaviorPanel, PluginsManagerPanel, ServerInfoPanel, ]) { diff --git a/src/fontra/views/applicationsettings/panel-editor-behavior.js b/src/fontra/views/applicationsettings/panel-editor-behavior.js new file mode 100644 index 000000000..30af0d24b --- /dev/null +++ b/src/fontra/views/applicationsettings/panel-editor-behavior.js @@ -0,0 +1,35 @@ +import { experimentalFeaturesController } from "../core/experimental-features.js"; +import * as html from "../core/html-utils.js"; +import { addStyleSheet } from "../core/html-utils.js"; +import { labeledCheckbox } from "../core/ui-utils.js"; +import { BaseInfoPanel } from "./panel-base.js"; + +addStyleSheet(` + .fontra-ui-editor-behavior-panel-card { + background-color: var(--ui-element-background-color); + border-radius: 0.5em; + padding: 1em; + } + `); + +export class EditorBehaviorPanel extends BaseInfoPanel { + static title = "application-settings.editor-behavior.title"; + static id = "editor-behavior-panel"; + + async setupUI() { + this.panelElement.innerHTML = ""; + const container = html.createDomElement("div", { + class: "fontra-ui-editor-behavior-panel-card", + }); + + container.appendChild( + labeledCheckbox( + "Rect-select live modifier keys", + experimentalFeaturesController, + "rectSelectLiveModifierKeys", + {} + ) + ); + this.panelElement.appendChild(container); + } +} diff --git a/src/fontra/views/editor/editor.js b/src/fontra/views/editor/editor.js index 067f1232d..250af8c53 100644 --- a/src/fontra/views/editor/editor.js +++ b/src/fontra/views/editor/editor.js @@ -87,6 +87,7 @@ import TransformationPanel from "./panel-transformation.js"; import UserSettingsPanel from "./panel-user-settings.js"; import Panel from "./panel.js"; import { clipboardFormatController } from "/core/clipboard-format.js"; +import { experimentalFeaturesController } from "/core/experimental-features.js"; import { ensureLanguageHasLoaded, translate } from "/core/localization.js"; const MIN_CANVAS_SPACE = 200; @@ -129,14 +130,10 @@ export class EditorController { async (...args) => await this.editListenerCallback(...args) ); - this.experimentalFeaturesController = new ObservableController({ - scalingEditBehavior: false, - quadPenTool: false, - rectSelectLiveModifiers: false, - }); - this.experimentalFeaturesController.synchronizeWithLocalStorage( - "fontra-editor-experimental-features." - ); + this.clipboardFormatController = new ObservableController({ format: "glif" }); + this.clipboardFormatController.synchronizeWithLocalStorage("fontra-clipboard-"); + + this.experimentalFeaturesController = experimentalFeaturesController; this.sceneController = new SceneController( this.fontController, From b11fd9d9e0eb28bee38295b1cf318de1bcaed9ba Mon Sep 17 00:00:00 2001 From: Olli Meier Date: Tue, 1 Oct 2024 16:54:31 +0200 Subject: [PATCH 2/7] Add "editor-behavior" to menubar and panel --- src/fontra/client/core/experimental-features.js | 2 +- .../views/applicationsettings/applicationsettings.js | 5 +---- src/fontra/views/editor/editor.js | 8 ++------ src/fontra/views/editor/panel-user-settings.js | 3 ++- 4 files changed, 6 insertions(+), 12 deletions(-) diff --git a/src/fontra/client/core/experimental-features.js b/src/fontra/client/core/experimental-features.js index 72ec864c7..3207d373f 100644 --- a/src/fontra/client/core/experimental-features.js +++ b/src/fontra/client/core/experimental-features.js @@ -3,7 +3,7 @@ import { ObservableController } from "./observable-object.js"; export const experimentalFeaturesController = new ObservableController({ scalingEditBehavior: false, quadPenTool: false, - rectSelectLiveModifiers: false, + rectSelectLiveModifierKeys: false, }); experimentalFeaturesController.synchronizeWithLocalStorage( diff --git a/src/fontra/views/applicationsettings/applicationsettings.js b/src/fontra/views/applicationsettings/applicationsettings.js index 3319559af..a8c564d88 100644 --- a/src/fontra/views/applicationsettings/applicationsettings.js +++ b/src/fontra/views/applicationsettings/applicationsettings.js @@ -1,8 +1,8 @@ import * as html from "../core/html-utils.js"; import { ClipboardPanel } from "./panel-clipboard.js"; import { DisplayLanguagePanel } from "./panel-display-language.js"; -import { PluginsManagerPanel } from "./panel-plugins-manager.js"; import { EditorBehaviorPanel } from "./panel-editor-behavior.js"; +import { PluginsManagerPanel } from "./panel-plugins-manager.js"; import { ServerInfoPanel } from "./panel-server-info.js"; import { ShortCutsPanel } from "./panel-shortcuts.js"; import { ThemeSettingsPanel } from "./panel-theme-settings.js"; @@ -24,9 +24,6 @@ export class ApplicationSettingsController { for (const panelClass of [ ShortCutsPanel, - // TODO: Add more panels here: - // EditorAppearancePanel, - // ExtensionsPanel, ThemeSettingsPanel, DisplayLanguagePanel, ClipboardPanel, diff --git a/src/fontra/views/editor/editor.js b/src/fontra/views/editor/editor.js index 250af8c53..8592677ce 100644 --- a/src/fontra/views/editor/editor.js +++ b/src/fontra/views/editor/editor.js @@ -130,15 +130,10 @@ export class EditorController { async (...args) => await this.editListenerCallback(...args) ); - this.clipboardFormatController = new ObservableController({ format: "glif" }); - this.clipboardFormatController.synchronizeWithLocalStorage("fontra-clipboard-"); - - this.experimentalFeaturesController = experimentalFeaturesController; - this.sceneController = new SceneController( this.fontController, canvasController, - this.experimentalFeaturesController + experimentalFeaturesController ); this.sceneSettingsController = this.sceneController.sceneSettingsController; @@ -663,6 +658,7 @@ export class EditorController { "theme-settings", "display-language", "clipboard", + "editor-behavior", "plugins-manager", "server-info", ]; diff --git a/src/fontra/views/editor/panel-user-settings.js b/src/fontra/views/editor/panel-user-settings.js index 3523e4463..31bd15205 100644 --- a/src/fontra/views/editor/panel-user-settings.js +++ b/src/fontra/views/editor/panel-user-settings.js @@ -1,6 +1,7 @@ import { loaderSpinner } from "../core/loader-spinner.js"; import Panel from "./panel.js"; import { clipboardFormatController } from "/core/clipboard-format.js"; +import { experimentalFeaturesController } from "/core/experimental-features.js"; import * as html from "/core/html-utils.js"; import { languageController, translate } from "/core/localization.js"; import { themeController } from "/core/theme-settings.js"; @@ -92,7 +93,7 @@ export default class UserSettingsPanel extends Panel { items.push({ displayName: translate("sidebar.user-settings.experimental"), - controller: this.editorController.experimentalFeaturesController, + controller: experimentalFeaturesController, descriptions: [ { key: "scalingEditBehavior", From 0255ac0ed7ff0a689969b126ce82f85b9b09095b Mon Sep 17 00:00:00 2001 From: Olli Meier Date: Tue, 1 Oct 2024 16:59:41 +0200 Subject: [PATCH 3/7] Fix language json files --- src/fontra/client/lang/en.json | 2 +- src/fontra/client/lang/zh-CN.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/fontra/client/lang/en.json b/src/fontra/client/lang/en.json index 0e93069e5..3a3cf2aca 100644 --- a/src/fontra/client/lang/en.json +++ b/src/fontra/client/lang/en.json @@ -29,8 +29,8 @@ "action.undo": "Undo", "application-settings.clipboard.title": "Clipboard", "application-settings.display-language.title": "Display Language", - "application-settings.plugins-manager.title": "Plugin Manager", "application-settings.editor-behavior.title": "Editor Behavior", + "application-settings.plugins-manager.title": "Plugin Manager", "application-settings.server-info.title": "Server info", "application-settings.shortcuts.title": "Shortcuts", "application-settings.theme-settings.title": "Theme settings", diff --git a/src/fontra/client/lang/zh-CN.json b/src/fontra/client/lang/zh-CN.json index efb6d4688..6762a3b33 100644 --- a/src/fontra/client/lang/zh-CN.json +++ b/src/fontra/client/lang/zh-CN.json @@ -28,8 +28,8 @@ "action.undo": "撤销", "application-settings.clipboard.title": "剪贴板导出格式", "application-settings.display-language.title": "Display Language", - "application-settings.plugins-manager.title": "插件管理器", "application-settings.editor-behavior.title": "Editor Behavior", + "application-settings.plugins-manager.title": "插件管理器", "application-settings.server-info.title": "服务器信息", "application-settings.shortcuts.title": "Shortcuts", "application-settings.theme-settings.title": "主题设置", From eea873c355ca572824b8a1b5d57ada040a5e2bc3 Mon Sep 17 00:00:00 2001 From: Olli Meier Date: Wed, 2 Oct 2024 10:02:12 +0200 Subject: [PATCH 4/7] Get rid of "Experimental": Bundle clipboard-format.js and experimental-features.js to application-settings.js and export applicationSettingsController. --- src/fontra/client/core/application-settings.js | 12 ++++++++++++ src/fontra/client/core/clipboard-format.js | 5 ----- src/fontra/client/core/experimental-features.js | 11 ----------- .../views/applicationsettings/panel-clipboard.js | 6 +++--- .../applicationsettings/panel-editor-behavior.js | 4 ++-- src/fontra/views/editor/edit-tools-pointer.js | 10 +++++----- src/fontra/views/editor/editor.js | 7 +++---- src/fontra/views/editor/panel-transformation.js | 4 ++-- src/fontra/views/editor/panel-user-settings.js | 9 ++++----- src/fontra/views/editor/scene-controller.js | 6 +++--- 10 files changed, 34 insertions(+), 40 deletions(-) create mode 100644 src/fontra/client/core/application-settings.js delete mode 100644 src/fontra/client/core/clipboard-format.js delete mode 100644 src/fontra/client/core/experimental-features.js diff --git a/src/fontra/client/core/application-settings.js b/src/fontra/client/core/application-settings.js new file mode 100644 index 000000000..67616db69 --- /dev/null +++ b/src/fontra/client/core/application-settings.js @@ -0,0 +1,12 @@ +import { ObservableController } from "./observable-object.js"; + +export const applicationSettingsController = new ObservableController({ + clipboardFormat: "glif", + scalingEditBehavior: false, + quadPenTool: false, + rectSelectLiveModifierKeys: false, +}); + +applicationSettingsController.synchronizeWithLocalStorage( + "fontra-application-settings-" +); diff --git a/src/fontra/client/core/clipboard-format.js b/src/fontra/client/core/clipboard-format.js deleted file mode 100644 index f37b7358b..000000000 --- a/src/fontra/client/core/clipboard-format.js +++ /dev/null @@ -1,5 +0,0 @@ -import { ObservableController } from "./observable-object.js"; - -export const clipboardFormatController = new ObservableController({ format: "glif" }); - -clipboardFormatController.synchronizeWithLocalStorage("fontra-clipboard-"); diff --git a/src/fontra/client/core/experimental-features.js b/src/fontra/client/core/experimental-features.js deleted file mode 100644 index 3207d373f..000000000 --- a/src/fontra/client/core/experimental-features.js +++ /dev/null @@ -1,11 +0,0 @@ -import { ObservableController } from "./observable-object.js"; - -export const experimentalFeaturesController = new ObservableController({ - scalingEditBehavior: false, - quadPenTool: false, - rectSelectLiveModifierKeys: false, -}); - -experimentalFeaturesController.synchronizeWithLocalStorage( - "fontra-editor-experimental-features." -); diff --git a/src/fontra/views/applicationsettings/panel-clipboard.js b/src/fontra/views/applicationsettings/panel-clipboard.js index aa6c3090c..ca7b7f6f9 100644 --- a/src/fontra/views/applicationsettings/panel-clipboard.js +++ b/src/fontra/views/applicationsettings/panel-clipboard.js @@ -1,4 +1,4 @@ -import { clipboardFormatController } from "../core/clipboard-format.js"; +import { applicationSettingsController } from "../core/application-settings.js"; import * as html from "../core/html-utils.js"; import { addStyleSheet } from "../core/html-utils.js"; import { translate } from "../core/localization.js"; @@ -33,10 +33,10 @@ export class ClipboardPanel extends BaseInfoPanel { return [ { displayName: translate("sidebar.user-settings.clipboard"), - controller: clipboardFormatController, + controller: applicationSettingsController, descriptions: [ { - key: "format", + key: "clipboardFormat", ui: "radio", options: [ { key: "glif", displayName: "GLIF (RoboFont)" }, diff --git a/src/fontra/views/applicationsettings/panel-editor-behavior.js b/src/fontra/views/applicationsettings/panel-editor-behavior.js index 30af0d24b..8adbd5098 100644 --- a/src/fontra/views/applicationsettings/panel-editor-behavior.js +++ b/src/fontra/views/applicationsettings/panel-editor-behavior.js @@ -1,4 +1,4 @@ -import { experimentalFeaturesController } from "../core/experimental-features.js"; +import { applicationSettingsController } from "../core/application-settings.js"; import * as html from "../core/html-utils.js"; import { addStyleSheet } from "../core/html-utils.js"; import { labeledCheckbox } from "../core/ui-utils.js"; @@ -25,7 +25,7 @@ export class EditorBehaviorPanel extends BaseInfoPanel { container.appendChild( labeledCheckbox( "Rect-select live modifier keys", - experimentalFeaturesController, + applicationSettingsController, "rectSelectLiveModifierKeys", {} ) diff --git a/src/fontra/views/editor/edit-tools-pointer.js b/src/fontra/views/editor/edit-tools-pointer.js index 4bab67aa2..b554e7be2 100644 --- a/src/fontra/views/editor/edit-tools-pointer.js +++ b/src/fontra/views/editor/edit-tools-pointer.js @@ -290,7 +290,7 @@ export class PointerTool extends BaseTool { const sceneController = this.sceneController; const initialPoint = sceneController.localPoint(initialEvent); for await (const event of eventStream) { - const modifierEvent = sceneController.experimentalFeatures + const modifierEvent = sceneController.applicationSettings .rectSelectLiveModifierKeys ? event : initialEvent; @@ -333,7 +333,7 @@ export class PointerTool extends BaseTool { const behaviorFactory = new EditBehaviorFactory( layerGlyph, sceneController.selection, - sceneController.experimentalFeatures.scalingEditBehavior + sceneController.applicationSettings.scalingEditBehavior ); return { layerName, @@ -482,7 +482,7 @@ export class PointerTool extends BaseTool { const behaviorFactory = new EditBehaviorFactory( layerGlyph, sceneController.selection, - sceneController.experimentalFeatures.scalingEditBehavior + sceneController.applicationSettings.scalingEditBehavior ); const layerBounds = staticGlyphControllers[layerName].getSelectionBounds(selection); @@ -770,11 +770,11 @@ export class PointerToolScale extends PointerTool { activate() { this.setCursor(); - this.sceneController.experimentalFeatures.scalingEditBehavior = true; + this.sceneController.applicationSettings.scalingEditBehavior = true; } deactivate() { - this.sceneController.experimentalFeatures.scalingEditBehavior = false; + this.sceneController.applicationSettings.scalingEditBehavior = false; } } diff --git a/src/fontra/views/editor/editor.js b/src/fontra/views/editor/editor.js index 8592677ce..48f44d610 100644 --- a/src/fontra/views/editor/editor.js +++ b/src/fontra/views/editor/editor.js @@ -86,8 +86,7 @@ import TextEntryPanel from "./panel-text-entry.js"; import TransformationPanel from "./panel-transformation.js"; import UserSettingsPanel from "./panel-user-settings.js"; import Panel from "./panel.js"; -import { clipboardFormatController } from "/core/clipboard-format.js"; -import { experimentalFeaturesController } from "/core/experimental-features.js"; +import { applicationSettingsController } from "/core/application-settings.js"; import { ensureLanguageHasLoaded, translate } from "/core/localization.js"; const MIN_CANVAS_SPACE = 200; @@ -133,7 +132,7 @@ export class EditorController { this.sceneController = new SceneController( this.fontController, canvasController, - experimentalFeaturesController + applicationSettingsController ); this.sceneSettingsController = this.sceneController.sceneSettingsController; @@ -1711,7 +1710,7 @@ export class EditorController { const mapping = { "svg": svgString, "glif": glifString, "fontra-json": jsonString }; const plainTextString = - mapping[clipboardFormatController.model.format] || glifString; + mapping[applicationSettingsController.model.clipboardFormat] || glifString; localStorage.setItem("clipboardSelection.text-plain", plainTextString); localStorage.setItem("clipboardSelection.glyph", jsonString); diff --git a/src/fontra/views/editor/panel-transformation.js b/src/fontra/views/editor/panel-transformation.js index d452ce6c7..21725445a 100644 --- a/src/fontra/views/editor/panel-transformation.js +++ b/src/fontra/views/editor/panel-transformation.js @@ -641,7 +641,7 @@ export default class TransformationPanel extends Panel { const behaviorFactory = new EditBehaviorFactory( layerGlyph, this.sceneController.selection, - this.sceneController.experimentalFeatures.scalingEditBehavior + this.sceneController.applicationSettings.scalingEditBehavior ); return { layerName, @@ -903,7 +903,7 @@ class MovableObject { const behaviorFactory = new EditBehaviorFactory( layerGlyph, this.selection, - sceneController.experimentalFeatures.scalingEditBehavior + sceneController.applicationSettings.scalingEditBehavior ); const editBehavior = behaviorFactory.getBehavior("default"); diff --git a/src/fontra/views/editor/panel-user-settings.js b/src/fontra/views/editor/panel-user-settings.js index 31bd15205..8a8cf8cc9 100644 --- a/src/fontra/views/editor/panel-user-settings.js +++ b/src/fontra/views/editor/panel-user-settings.js @@ -1,7 +1,6 @@ import { loaderSpinner } from "../core/loader-spinner.js"; import Panel from "./panel.js"; -import { clipboardFormatController } from "/core/clipboard-format.js"; -import { experimentalFeaturesController } from "/core/experimental-features.js"; +import { applicationSettingsController } from "/core/application-settings.js"; import * as html from "/core/html-utils.js"; import { languageController, translate } from "/core/localization.js"; import { themeController } from "/core/theme-settings.js"; @@ -60,10 +59,10 @@ export default class UserSettingsPanel extends Panel { items.push({ displayName: translate("sidebar.user-settings.clipboard"), - controller: clipboardFormatController, + controller: applicationSettingsController, descriptions: [ { - key: "format", + key: "clipboardFormat", ui: "radio", options: [ { key: "glif", displayName: "GLIF (RoboFont)" }, @@ -93,7 +92,7 @@ export default class UserSettingsPanel extends Panel { items.push({ displayName: translate("sidebar.user-settings.experimental"), - controller: experimentalFeaturesController, + controller: applicationSettingsController, descriptions: [ { key: "scalingEditBehavior", diff --git a/src/fontra/views/editor/scene-controller.js b/src/fontra/views/editor/scene-controller.js index fb9855a0b..618a64216 100644 --- a/src/fontra/views/editor/scene-controller.js +++ b/src/fontra/views/editor/scene-controller.js @@ -36,9 +36,9 @@ import { translate, translatePlural } from "/core/localization.js"; import { dialog, message } from "/web-components/modal-dialog.js"; export class SceneController { - constructor(fontController, canvasController, experimentalFeaturesController) { + constructor(fontController, canvasController, applicationSettingsController) { this.canvasController = canvasController; - this.experimentalFeatures = experimentalFeaturesController.model; + this.applicationSettings = applicationSettingsController.model; this.fontController = fontController; this.autoViewBox = true; @@ -598,7 +598,7 @@ export class SceneController { const behaviorFactory = new EditBehaviorFactory( layerGlyph, this.selection, - this.experimentalFeatures.scalingEditBehavior + this.applicationSettings.scalingEditBehavior ); return { layerName, From 3554145373ee5708319406800fa231dafb37e61e Mon Sep 17 00:00:00 2001 From: Olli Meier Date: Wed, 2 Oct 2024 11:02:40 +0200 Subject: [PATCH 5/7] Removing scalingEditBehavior and quadPenTool from controller and gear panel --- .../client/core/application-settings.js | 2 -- src/fontra/views/editor/edit-tools-pointer.js | 9 ++++---- .../views/editor/panel-transformation.js | 4 ++-- .../views/editor/panel-user-settings.js | 21 ++++++++++--------- src/fontra/views/editor/scene-controller.js | 2 +- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/fontra/client/core/application-settings.js b/src/fontra/client/core/application-settings.js index 67616db69..e573514ae 100644 --- a/src/fontra/client/core/application-settings.js +++ b/src/fontra/client/core/application-settings.js @@ -2,8 +2,6 @@ import { ObservableController } from "./observable-object.js"; export const applicationSettingsController = new ObservableController({ clipboardFormat: "glif", - scalingEditBehavior: false, - quadPenTool: false, rectSelectLiveModifierKeys: false, }); diff --git a/src/fontra/views/editor/edit-tools-pointer.js b/src/fontra/views/editor/edit-tools-pointer.js index b554e7be2..5cd6f33a5 100644 --- a/src/fontra/views/editor/edit-tools-pointer.js +++ b/src/fontra/views/editor/edit-tools-pointer.js @@ -333,7 +333,7 @@ export class PointerTool extends BaseTool { const behaviorFactory = new EditBehaviorFactory( layerGlyph, sceneController.selection, - sceneController.applicationSettings.scalingEditBehavior + this.scalingEditBehavior ); return { layerName, @@ -482,7 +482,7 @@ export class PointerTool extends BaseTool { const behaviorFactory = new EditBehaviorFactory( layerGlyph, sceneController.selection, - sceneController.applicationSettings.scalingEditBehavior + this.scalingEditBehavior ); const layerBounds = staticGlyphControllers[layerName].getSelectionBounds(selection); @@ -656,6 +656,7 @@ export class PointerTool extends BaseTool { activate() { super.activate(); + this.scalingEditBehavior = false; this.sceneController.sceneModel.showTransformSelection = true; this.canvasController.requestUpdate(); } @@ -770,11 +771,11 @@ export class PointerToolScale extends PointerTool { activate() { this.setCursor(); - this.sceneController.applicationSettings.scalingEditBehavior = true; + this.scalingEditBehavior = true; } deactivate() { - this.sceneController.applicationSettings.scalingEditBehavior = false; + this.scalingEditBehavior = false; } } diff --git a/src/fontra/views/editor/panel-transformation.js b/src/fontra/views/editor/panel-transformation.js index 21725445a..913c8e4b8 100644 --- a/src/fontra/views/editor/panel-transformation.js +++ b/src/fontra/views/editor/panel-transformation.js @@ -641,7 +641,7 @@ export default class TransformationPanel extends Panel { const behaviorFactory = new EditBehaviorFactory( layerGlyph, this.sceneController.selection, - this.sceneController.applicationSettings.scalingEditBehavior + this.sceneController.selectedTool.scalingEditBehavior ); return { layerName, @@ -903,7 +903,7 @@ class MovableObject { const behaviorFactory = new EditBehaviorFactory( layerGlyph, this.selection, - sceneController.applicationSettings.scalingEditBehavior + sceneController.selectedTool.scalingEditBehavior ); const editBehavior = behaviorFactory.getBehavior("default"); diff --git a/src/fontra/views/editor/panel-user-settings.js b/src/fontra/views/editor/panel-user-settings.js index 8a8cf8cc9..ecc9f002b 100644 --- a/src/fontra/views/editor/panel-user-settings.js +++ b/src/fontra/views/editor/panel-user-settings.js @@ -1,3 +1,4 @@ +// TODO: This whole "gear" sidebar panel will be removed soon. import { loaderSpinner } from "../core/loader-spinner.js"; import Panel from "./panel.js"; import { applicationSettingsController } from "/core/application-settings.js"; @@ -94,16 +95,16 @@ export default class UserSettingsPanel extends Panel { displayName: translate("sidebar.user-settings.experimental"), controller: applicationSettingsController, descriptions: [ - { - key: "scalingEditBehavior", - displayName: "Scaling edit tool behavior", - ui: "checkbox", - }, - { - key: "quadPenTool", - displayName: "Pen tool draws quadratics", - ui: "checkbox", - }, + // { + // key: "scalingEditBehavior", + // displayName: "Scaling edit tool behavior", + // ui: "checkbox", + // }, + // { + // key: "quadPenTool", + // displayName: "Pen tool draws quadratics", + // ui: "checkbox", + // }, { key: "rectSelectLiveModifierKeys", displayName: "Rect-select live modifier keys", diff --git a/src/fontra/views/editor/scene-controller.js b/src/fontra/views/editor/scene-controller.js index 618a64216..a38bb557a 100644 --- a/src/fontra/views/editor/scene-controller.js +++ b/src/fontra/views/editor/scene-controller.js @@ -598,7 +598,7 @@ export class SceneController { const behaviorFactory = new EditBehaviorFactory( layerGlyph, this.selection, - this.applicationSettings.scalingEditBehavior + this.selectedTool.scalingEditBehavior ); return { layerName, From ee0f88c15d8e58f49f22e8022f0daae59cb5e187 Mon Sep 17 00:00:00 2001 From: Olli Meier Date: Thu, 3 Oct 2024 11:17:59 +0200 Subject: [PATCH 6/7] introduce "get scalingEditBehavior()", similar to "get curveType()" --- src/fontra/views/editor/edit-tools-pointer.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/fontra/views/editor/edit-tools-pointer.js b/src/fontra/views/editor/edit-tools-pointer.js index 5cd6f33a5..0b39c543b 100644 --- a/src/fontra/views/editor/edit-tools-pointer.js +++ b/src/fontra/views/editor/edit-tools-pointer.js @@ -654,9 +654,12 @@ export class PointerTool extends BaseTool { return undefined; } + get scalingEditBehavior() { + return false; + } + activate() { super.activate(); - this.scalingEditBehavior = false; this.sceneController.sceneModel.showTransformSelection = true; this.canvasController.requestUpdate(); } @@ -769,13 +772,8 @@ export class PointerToolScale extends PointerTool { iconPath = "/images/pointerscale.svg"; identifier = "pointer-tool-scale"; - activate() { - this.setCursor(); - this.scalingEditBehavior = true; - } - - deactivate() { - this.scalingEditBehavior = false; + get scalingEditBehavior() { + return true; } } From 624343e666c86d91d814ed1aaa59274023403133 Mon Sep 17 00:00:00 2001 From: Olli Meier Date: Thu, 3 Oct 2024 11:19:05 +0200 Subject: [PATCH 7/7] Remove commented out code --- src/fontra/views/editor/panel-user-settings.js | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/fontra/views/editor/panel-user-settings.js b/src/fontra/views/editor/panel-user-settings.js index ecc9f002b..cc7f81ea1 100644 --- a/src/fontra/views/editor/panel-user-settings.js +++ b/src/fontra/views/editor/panel-user-settings.js @@ -95,16 +95,6 @@ export default class UserSettingsPanel extends Panel { displayName: translate("sidebar.user-settings.experimental"), controller: applicationSettingsController, descriptions: [ - // { - // key: "scalingEditBehavior", - // displayName: "Scaling edit tool behavior", - // ui: "checkbox", - // }, - // { - // key: "quadPenTool", - // displayName: "Pen tool draws quadratics", - // ui: "checkbox", - // }, { key: "rectSelectLiveModifierKeys", displayName: "Rect-select live modifier keys",