mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-19 10:58:04 +08:00
merge onto master
This commit is contained in:
@@ -124,10 +124,10 @@ export class SendUIMetadata extends JsMessage {
|
||||
readonly nodeTypes!: FrontendNodeType[];
|
||||
}
|
||||
|
||||
export class UpdateNodeThumbnail extends JsMessage {
|
||||
readonly id!: bigint;
|
||||
export class UpdateThumbnails extends JsMessage {
|
||||
readonly add!: [bigint, string][];
|
||||
|
||||
readonly value!: string;
|
||||
readonly clear!: bigint[];
|
||||
}
|
||||
|
||||
export class UpdateNodeGraphSelection extends JsMessage {
|
||||
@@ -1683,7 +1683,7 @@ export const messageMakers: Record<string, MessageMaker> = {
|
||||
UpdateNodeGraphTransform,
|
||||
UpdateNodeGraphControlBarLayout,
|
||||
UpdateNodeGraphSelection,
|
||||
UpdateNodeThumbnail,
|
||||
UpdateThumbnails: UpdateThumbnail,
|
||||
UpdateOpenDocumentsList,
|
||||
UpdatePropertyPanelSectionsLayout,
|
||||
UpdateSpreadsheetLayout,
|
||||
|
||||
@@ -24,7 +24,7 @@ import {
|
||||
UpdateNodeGraphWires,
|
||||
UpdateNodeGraphSelection,
|
||||
UpdateNodeGraphTransform,
|
||||
UpdateNodeThumbnail,
|
||||
UpdateThumbnails,
|
||||
UpdateWirePathInProgress,
|
||||
} from "@graphite/messages";
|
||||
|
||||
@@ -168,9 +168,14 @@ export function createNodeGraphState(editor: Editor) {
|
||||
return state;
|
||||
});
|
||||
});
|
||||
editor.subscriptions.subscribeJsMessage(UpdateNodeThumbnail, (updateNodeThumbnail) => {
|
||||
editor.subscriptions.subscribeJsMessage(UpdateThumbnails, (updateThumbnail) => {
|
||||
update((state) => {
|
||||
state.thumbnails.set(updateNodeThumbnail.id, updateNodeThumbnail.value);
|
||||
for (const [id, value] of updateThumbnail.add) {
|
||||
state.thumbnails.set(id, value);
|
||||
}
|
||||
for (const id of updateThumbnail.clear) {
|
||||
state.thumbnails.set(id, "");
|
||||
}
|
||||
return state;
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user