Remove console spam (#1400)

* Remove console spam

* CSS Style

* Slight cleanup

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
0HyperCube
2023-08-27 16:12:32 -07:00
committed by GitHub
co-authored by Keavon Chambers
parent 226b96260c
commit e77782aadb
16 changed files with 61 additions and 77 deletions
+21
View File
@@ -13,6 +13,8 @@ import {
UpdateWorkingColorsLayout,
UpdateGraphViewOverlayButtonLayout,
UpdateNodeGraphBarLayout,
UpdateDocumentTransform,
TriggerGraphViewOverlay,
} from "@graphite/wasm-communication/messages";
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
@@ -26,6 +28,10 @@ export function createDocumentState(editor: Editor) {
graphViewOverlayButtonLayout: defaultWidgetLayout(),
workingColorsLayout: defaultWidgetLayout(),
nodeGraphBarLayout: defaultWidgetLayout(),
// Graph view overlay
graphViewOverlayOpen: false,
// CSS transform property to be applied to artwork
artworkTransform: "",
});
const { subscribe, update } = state;
@@ -100,6 +106,21 @@ export function createDocumentState(editor: Editor) {
// Request a resize event so the viewport gets measured now that the canvas is populated and positioned correctly
window.dispatchEvent(new CustomEvent("resize"));
});
editor.subscriptions.subscribeJsMessage(UpdateDocumentTransform, async (data) => {
await tick();
update((state) => {
state.artworkTransform = data.transform;
return state;
});
});
// Show or hide the graph view overlay
editor.subscriptions.subscribeJsMessage(TriggerGraphViewOverlay, (triggerGraphViewOverlay) => {
update((state) => {
state.graphViewOverlayOpen = triggerGraphViewOverlay.open;
return state;
});
});
return {
subscribe,