Add handler for deferred execution of messages (#2951)

* Add Handler for defered execution of messages

* Cleanup

* Track graph execution id to associate messages with their corresponding execution id

* Rename ViewportReady -> NavigationReady

* Defer layer deselection
This commit is contained in:
Dennis Kobert
2025-07-29 01:57:11 +02:00
committed by GitHub
parent 2247dd9818
commit 35ab266bbb
21 changed files with 182 additions and 131 deletions

View File

@@ -791,8 +791,6 @@ export class TriggerImport extends JsMessage {}
export class TriggerPaste extends JsMessage {}
export class TriggerDelayedZoomCanvasToFitAll extends JsMessage {}
export class TriggerDownloadImage extends JsMessage {
readonly svg!: string;
@@ -1649,7 +1647,6 @@ export const messageMakers: Record<string, MessageMaker> = {
DisplayRemoveEditableTextbox,
SendUIMetadata,
TriggerAboutGraphiteLocalizedCommitDate,
TriggerDelayedZoomCanvasToFitAll,
TriggerDownloadImage,
TriggerDownloadTextFile,
TriggerFetchAndOpenDocument,

View File

@@ -13,7 +13,6 @@ import {
UpdateWorkingColorsLayout,
UpdateNodeGraphControlBarLayout,
UpdateGraphViewOverlay,
TriggerDelayedZoomCanvasToFitAll,
UpdateGraphFadeArtwork,
} from "@graphite/messages";
@@ -94,12 +93,6 @@ export function createDocumentState(editor: Editor) {
return state;
});
});
editor.subscriptions.subscribeJsMessage(TriggerDelayedZoomCanvasToFitAll, () => {
// TODO: This is horribly hacky
[0, 1, 10, 50, 100, 200, 300, 400, 500].forEach((delay) => {
setTimeout(() => editor.handle.zoomCanvasToFitAll(), delay);
});
});
return {
subscribe,