Desktop: Add "Disable UI Acceleration" to preferences (#3774)

* Deskltop: Add Disable UI Accelaration preference

* Fixup

* Fix typo

* Code review and update strings

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
Timon
2026-02-19 01:54:01 +00:00
committed by GitHub
parent 6824f55929
commit 3f999bf231
32 changed files with 310 additions and 133 deletions

View File

@@ -140,7 +140,7 @@ export function createInputManager(editor: Editor, dialog: DialogState, portfoli
}
if (get(dialog).visible && key === "Escape") {
dialog.dismissDialog();
editor.handle.onDialogDismiss();
}
}
@@ -185,7 +185,7 @@ export function createInputManager(editor: Editor, dialog: DialogState, portfoli
const inTextInput = target === textToolInteractiveInputElement;
if (get(dialog).visible && !inDialog) {
dialog.dismissDialog();
editor.handle.onDialogDismiss();
e.preventDefault();
e.stopPropagation();
}

View File

@@ -884,7 +884,7 @@ export class LayerPanelEntry {
clippable!: boolean;
}
export class DisplayDialogDismiss extends JsMessage {}
export class DialogClose extends JsMessage {}
export class Font {
fontFamily!: string;
@@ -1671,7 +1671,7 @@ type MessageMaker = typeof JsMessage | JSMessageFactory;
export const messageMakers: Record<string, MessageMaker> = {
ClearAllNodeGraphWires,
DisplayDialog,
DisplayDialogDismiss,
DialogClose,
DisplayDialogPanic,
DisplayEditableTextbox,
DisplayEditableTextboxTransform,

View File

@@ -2,7 +2,7 @@ import { writable } from "svelte/store";
import { type Editor } from "@graphite/editor";
import { type IconName } from "@graphite/icons";
import { DisplayDialog, DisplayDialogDismiss, UpdateDialogButtons, UpdateDialogColumn1, UpdateDialogColumn2, patchLayout, TriggerDisplayThirdPartyLicensesDialog } from "@graphite/messages";
import { DisplayDialog, DialogClose, UpdateDialogButtons, UpdateDialogColumn1, UpdateDialogColumn2, patchLayout, TriggerDisplayThirdPartyLicensesDialog } from "@graphite/messages";
import type { Layout } from "@graphite/messages";
export function createDialogState(editor: Editor) {
@@ -76,7 +76,7 @@ export function createDialogState(editor: Editor) {
return state;
});
});
editor.subscriptions.subscribeJsMessage(DisplayDialogDismiss, dismissDialog);
editor.subscriptions.subscribeJsMessage(DialogClose, dismissDialog);
editor.subscriptions.subscribeJsMessage(TriggerDisplayThirdPartyLicensesDialog, async () => {
const BACKUP_URL = "https://editor.graphite.art/third-party-licenses.txt";

View File

@@ -384,18 +384,14 @@ impl EditorHandle {
#[wasm_bindgen(js_name = loadPreferences)]
pub fn load_preferences(&self, preferences: Option<String>) {
let preferences = if let Some(preferences) = preferences {
if let Some(preferences) = preferences {
let Ok(preferences) = serde_json::from_str(&preferences) else {
log::error!("Failed to deserialize preferences");
return;
};
Some(preferences)
} else {
None
};
let message = PreferencesMessage::Load { preferences };
self.dispatch(message);
let message = PreferencesMessage::Load { preferences };
self.dispatch(message);
}
}
#[wasm_bindgen(js_name = selectDocument)]
@@ -602,6 +598,13 @@ impl EditorHandle {
Ok(())
}
/// Dialog got dismissed
#[wasm_bindgen(js_name = onDialogDismiss)]
pub fn on_dialog_dismiss(&self) {
let message = DialogMessage::Dismiss;
self.dispatch(message);
}
/// A text box was changed
#[wasm_bindgen(js_name = updateBounds)]
pub fn update_bounds(&self, new_text: String) -> Result<(), JsValue> {