From f8c2be83dd7f4ffbc6b5d5dae836adfc73f21294 Mon Sep 17 00:00:00 2001 From: mfish33 <32677537+mfish33@users.noreply.github.com> Date: Fri, 11 Feb 2022 11:32:10 -0800 Subject: [PATCH] Properly show document bar on initialization (#535) * properly show document bar * updated comments --- editor/src/document/document_message_handler.rs | 2 +- frontend/src/components/panels/Document.vue | 4 ++++ frontend/src/state/documents.ts | 1 + frontend/wasm/src/api.rs | 6 ++++++ 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/editor/src/document/document_message_handler.rs b/editor/src/document/document_message_handler.rs index 510c7a60..b8b3520c 100644 --- a/editor/src/document/document_message_handler.rs +++ b/editor/src/document/document_message_handler.rs @@ -781,7 +781,7 @@ impl MessageHandler for Docum } } ExportDocument => { - // TODO(MFISH33): Add Dialog to select artboards + // TODO(mfish33): Add Dialog to select artboards let bbox = self.document_bounds().unwrap_or_else(|| [DVec2::ZERO, ipp.viewport_bounds.size()]); let size = bbox[1] - bbox[0]; let name = match self.name.ends_with(FILE_SAVE_SUFFIX) { diff --git a/frontend/src/components/panels/Document.vue b/frontend/src/components/panels/Document.vue index 40045e8f..82b12f7b 100644 --- a/frontend/src/components/panels/Document.vue +++ b/frontend/src/components/panels/Document.vue @@ -427,6 +427,10 @@ export default defineComponent({ this.documentBarLayout = updateDocumentBarLayout; }); this.editor.dispatcher.subscribeJsMessage(TriggerViewportResize, this.viewportResize); + + // TODO(mfish33): Replace with initialization system Issue:#524 + // Get initial Document Bar + this.editor.instance.init_document_bar(); }, data() { const documentModeEntries: SectionsOfMenuListEntries = [ diff --git a/frontend/src/state/documents.ts b/frontend/src/state/documents.ts index 0ecc8c08..90112aa3 100644 --- a/frontend/src/state/documents.ts +++ b/frontend/src/state/documents.ts @@ -104,6 +104,7 @@ export function createDocumentsState(editor: EditorState, dialogState: DialogSta download(triggerFileDownload.name, triggerFileDownload.document); }); + // TODO(mfish33): Replace with initialization system Issue:#524 // Get the initial documents editor.instance.get_open_documents_list(); diff --git a/frontend/wasm/src/api.rs b/frontend/wasm/src/api.rs index 59dcb836..7450eeb9 100644 --- a/frontend/wasm/src/api.rs +++ b/frontend/wasm/src/api.rs @@ -525,6 +525,12 @@ impl JsEditorHandle { let message = DocumentMessage::ZoomCanvasToFitAll; self.dispatch(message); } + + // TODO(mfish33): Replace with initialization system Issue:#524 + pub fn init_document_bar(&self) { + let message = PortfolioMessage::UpdateDocumentBar; + self.dispatch(message) + } } // Needed to make JsEditorHandle functions pub to rust. Do not fully