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

View File

@@ -1,6 +1,6 @@
use winit::event_loop::ActiveEventLoop;
use winit::window::{Window, WindowAttributes};
use winit::platform::macos::{OptionAsAlt, WindowAttributesMacOS};
use winit::window::{Window, WindowAttributes};
use crate::consts::APP_NAME;
use crate::event::AppEventScheduler;

View File

@@ -37,13 +37,16 @@ impl MessageHandler<ViewportMessage, ()> for ViewportMessageHandler {
ViewportMessage::RepropagateUpdate => {}
}
let physical_bounds = self.bounds().to_physical();
responses.add(FrontendMessage::UpdateViewportPhysicalBounds {
x: physical_bounds.x(),
y: physical_bounds.y(),
width: physical_bounds.width(),
height: physical_bounds.height(),
});
#[cfg(not(target_family = "wasm"))]
{
let physical_bounds = self.bounds().to_physical();
responses.add(FrontendMessage::UpdateViewportPhysicalBounds {
x: physical_bounds.x(),
y: physical_bounds.y(),
width: physical_bounds.width(),
height: physical_bounds.height(),
});
}
responses.add(NavigationMessage::CanvasPan { delta: DVec2::ZERO });
responses.add(NodeGraphMessage::SetGridAlignedEdges);

View File

@@ -10,6 +10,7 @@ import {
TriggerLoadFirstAutoSaveDocument,
TriggerLoadRestAutoSaveDocuments,
TriggerSaveActiveDocument,
TriggerOpenLaunchDocuments,
} from "@graphite/messages";
import { type PortfolioState } from "@graphite/state-providers/portfolio";
@@ -171,6 +172,9 @@ export function createPersistenceManager(editor: Editor, portfolio: PortfolioSta
editor.subscriptions.subscribeJsMessage(TriggerLoadRestAutoSaveDocuments, async () => {
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) => {
const documentId = String(triggerSaveActiveDocument.documentId);
const previouslySavedDocuments = await get<Record<string, TriggerPersistenceWriteDocument>>("documents", graphiteStore);