mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-15 22:28:10 +08:00
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:
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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> {
|
||||
|
||||
Reference in New Issue
Block a user