This commit is contained in:
Timon Schelling
2025-11-12 16:30:21 +01:00
parent 8d4bd90bdd
commit 4505a13f69
3 changed files with 15 additions and 8 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
use winit::event_loop::ActiveEventLoop; use winit::event_loop::ActiveEventLoop;
use winit::window::{Window, WindowAttributes};
use winit::platform::macos::{OptionAsAlt, WindowAttributesMacOS}; use winit::platform::macos::{OptionAsAlt, WindowAttributesMacOS};
use winit::window::{Window, WindowAttributes};
use crate::consts::APP_NAME; use crate::consts::APP_NAME;
use crate::event::AppEventScheduler; use crate::event::AppEventScheduler;
@@ -37,13 +37,16 @@ impl MessageHandler<ViewportMessage, ()> for ViewportMessageHandler {
ViewportMessage::RepropagateUpdate => {} ViewportMessage::RepropagateUpdate => {}
} }
let physical_bounds = self.bounds().to_physical(); #[cfg(not(target_family = "wasm"))]
responses.add(FrontendMessage::UpdateViewportPhysicalBounds { {
x: physical_bounds.x(), let physical_bounds = self.bounds().to_physical();
y: physical_bounds.y(), responses.add(FrontendMessage::UpdateViewportPhysicalBounds {
width: physical_bounds.width(), x: physical_bounds.x(),
height: physical_bounds.height(), y: physical_bounds.y(),
}); width: physical_bounds.width(),
height: physical_bounds.height(),
});
}
responses.add(NavigationMessage::CanvasPan { delta: DVec2::ZERO }); responses.add(NavigationMessage::CanvasPan { delta: DVec2::ZERO });
responses.add(NodeGraphMessage::SetGridAlignedEdges); responses.add(NodeGraphMessage::SetGridAlignedEdges);
+4
View File
@@ -10,6 +10,7 @@ import {
TriggerLoadFirstAutoSaveDocument, TriggerLoadFirstAutoSaveDocument,
TriggerLoadRestAutoSaveDocuments, TriggerLoadRestAutoSaveDocuments,
TriggerSaveActiveDocument, TriggerSaveActiveDocument,
TriggerOpenLaunchDocuments,
} from "@graphite/messages"; } from "@graphite/messages";
import { type PortfolioState } from "@graphite/state-providers/portfolio"; import { type PortfolioState } from "@graphite/state-providers/portfolio";
@@ -171,6 +172,9 @@ export function createPersistenceManager(editor: Editor, portfolio: PortfolioSta
editor.subscriptions.subscribeJsMessage(TriggerLoadRestAutoSaveDocuments, async () => { editor.subscriptions.subscribeJsMessage(TriggerLoadRestAutoSaveDocuments, async () => {
await loadRestDocuments(); await loadRestDocuments();
}); });
editor.subscriptions.subscribeJsMessage(TriggerOpenLaunchDocuments, async () => {
// TODO: Could be used to load documents from URL params or similar on launch
});
editor.subscriptions.subscribeJsMessage(TriggerSaveActiveDocument, async (triggerSaveActiveDocument) => { editor.subscriptions.subscribeJsMessage(TriggerSaveActiveDocument, async (triggerSaveActiveDocument) => {
const documentId = String(triggerSaveActiveDocument.documentId); const documentId = String(triggerSaveActiveDocument.documentId);
const previouslySavedDocuments = await get<Record<string, TriggerPersistenceWriteDocument>>("documents", graphiteStore); const previouslySavedDocuments = await get<Record<string, TriggerPersistenceWriteDocument>>("documents", graphiteStore);