mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-29 11:08:12 +08:00
Remove console spam (#1400)
* Remove console spam * CSS Style * Slight cleanup --------- Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
co-authored by
Keavon Chambers
parent
226b96260c
commit
e77782aadb
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user