mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-25 10:18:12 +08:00
Parse description from node doc comments (#2089)
* Parse description from node doc comments * Add node description tooltips * Code review --------- Co-authored-by: Adam G <adamgerhant@gmail.com> Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
co-authored by
Adam G
Keavon Chambers
parent
8fdecaa487
commit
35f7cfac80
@@ -10,6 +10,7 @@ import {
|
||||
type FrontendNodeWire as FrontendNodeWire,
|
||||
type FrontendNodeType,
|
||||
type WirePath,
|
||||
SendUIMetadata,
|
||||
UpdateBox,
|
||||
UpdateClickTargets,
|
||||
UpdateContextMenuInformation,
|
||||
@@ -19,7 +20,6 @@ import {
|
||||
UpdateNodeGraph,
|
||||
UpdateNodeGraphSelection,
|
||||
UpdateNodeGraphTransform,
|
||||
UpdateNodeTypes,
|
||||
UpdateNodeThumbnail,
|
||||
UpdateWirePathInProgress,
|
||||
UpdateZoomWithScroll,
|
||||
@@ -38,6 +38,8 @@ export function createNodeGraphState(editor: Editor) {
|
||||
nodes: new Map<bigint, FrontendNode>(),
|
||||
wires: [] as FrontendNodeWire[],
|
||||
wirePathInProgress: undefined as WirePath | undefined,
|
||||
inputTypeDescriptions: new Map<string, string>(),
|
||||
nodeDescriptions: new Map<string, string>(),
|
||||
nodeTypes: [] as FrontendNodeType[],
|
||||
zoomWithScroll: false as boolean,
|
||||
thumbnails: new Map<bigint, string>(),
|
||||
@@ -47,6 +49,14 @@ export function createNodeGraphState(editor: Editor) {
|
||||
});
|
||||
|
||||
// Set up message subscriptions on creation
|
||||
editor.subscriptions.subscribeJsMessage(SendUIMetadata, (UIMetadata) => {
|
||||
update((state) => {
|
||||
state.inputTypeDescriptions = UIMetadata.inputTypeDescriptions;
|
||||
state.nodeDescriptions = UIMetadata.nodeDescriptions;
|
||||
state.nodeTypes = UIMetadata.nodeTypes;
|
||||
return state;
|
||||
});
|
||||
});
|
||||
editor.subscriptions.subscribeJsMessage(UpdateBox, (updateBox) => {
|
||||
update((state) => {
|
||||
state.box = updateBox.box;
|
||||
@@ -108,12 +118,6 @@ export function createNodeGraphState(editor: Editor) {
|
||||
return state;
|
||||
});
|
||||
});
|
||||
editor.subscriptions.subscribeJsMessage(UpdateNodeTypes, (updateNodeTypes) => {
|
||||
update((state) => {
|
||||
state.nodeTypes = updateNodeTypes.nodeTypes;
|
||||
return state;
|
||||
});
|
||||
});
|
||||
editor.subscriptions.subscribeJsMessage(UpdateNodeThumbnail, (updateNodeThumbnail) => {
|
||||
update((state) => {
|
||||
state.thumbnails.set(updateNodeThumbnail.id, updateNodeThumbnail.value);
|
||||
|
||||
Reference in New Issue
Block a user