mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-30 15:48:11 +08:00
Separate graph error diagnostics from frontend node metadata (#3385)
* Separate error popup from node * Improve context menu data * Code review --------- Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
co-authored by
Keavon Chambers
parent
548e0df1a1
commit
7afbeaa1f9
+18
-23
@@ -33,23 +33,6 @@ export class UpdateClickTargets extends JsMessage {
|
||||
readonly clickTargets!: FrontendClickTargets | undefined;
|
||||
}
|
||||
|
||||
const ContextTupleToVec2 = Transform((data) => {
|
||||
if (data.obj.contextMenuInformation === undefined) return undefined;
|
||||
const contextMenuCoordinates = { x: data.obj.contextMenuInformation.contextMenuCoordinates[0], y: data.obj.contextMenuInformation.contextMenuCoordinates[1] };
|
||||
let contextMenuData = data.obj.contextMenuInformation.contextMenuData;
|
||||
if (contextMenuData.ToggleLayer !== undefined) {
|
||||
contextMenuData = { nodeId: contextMenuData.ToggleLayer.nodeId, currentlyIsNode: contextMenuData.ToggleLayer.currentlyIsNode };
|
||||
} else if (contextMenuData.CreateNode !== undefined) {
|
||||
contextMenuData = { type: "CreateNode", compatibleType: contextMenuData.CreateNode.compatibleType };
|
||||
}
|
||||
return { contextMenuCoordinates, contextMenuData };
|
||||
});
|
||||
|
||||
export class UpdateContextMenuInformation extends JsMessage {
|
||||
@ContextTupleToVec2
|
||||
readonly contextMenuInformation!: ContextMenuInformation | undefined;
|
||||
}
|
||||
|
||||
export class UpdateImportsExports extends JsMessage {
|
||||
readonly imports!: (FrontendGraphOutput | undefined)[];
|
||||
|
||||
@@ -94,6 +77,15 @@ export class UpdateNodeGraphNodes extends JsMessage {
|
||||
readonly nodes!: FrontendNode[];
|
||||
}
|
||||
|
||||
export class UpdateNodeGraphErrorDiagnostic extends JsMessage {
|
||||
readonly error!: NodeGraphError | undefined;
|
||||
}
|
||||
|
||||
export class NodeGraphError {
|
||||
readonly position!: XY;
|
||||
readonly error!: string;
|
||||
}
|
||||
|
||||
export class UpdateVisibleNodes extends JsMessage {
|
||||
readonly nodes!: bigint[];
|
||||
}
|
||||
@@ -173,9 +165,13 @@ export type FrontendClickTargets = {
|
||||
|
||||
export type ContextMenuInformation = {
|
||||
contextMenuCoordinates: XY;
|
||||
contextMenuData: "CreateNode" | { type: "CreateNode"; compatibleType: string } | { nodeId: bigint; currentlyIsNode: boolean };
|
||||
contextMenuData: { type: "CreateNode"; data: { compatibleType: string | undefined } } | { type: "ModifyNode"; data: { canBeLayer: boolean; currentlyIsNode: boolean; nodeId: bigint } };
|
||||
};
|
||||
|
||||
export class UpdateContextMenuInformation extends JsMessage {
|
||||
readonly contextMenuInformation!: ContextMenuInformation | undefined;
|
||||
}
|
||||
|
||||
export type FrontendGraphDataType = "General" | "Number" | "Artboard" | "Graphic" | "Raster" | "Vector" | "Color" | "Invalid";
|
||||
|
||||
export class FrontendGraphInput {
|
||||
@@ -205,12 +201,12 @@ export class FrontendGraphOutput {
|
||||
}
|
||||
|
||||
export class FrontendNode {
|
||||
readonly id!: bigint;
|
||||
|
||||
readonly isLayer!: boolean;
|
||||
|
||||
readonly canBeLayer!: boolean;
|
||||
|
||||
readonly id!: bigint;
|
||||
|
||||
readonly reference!: string | undefined;
|
||||
|
||||
readonly displayName!: string;
|
||||
@@ -236,9 +232,7 @@ export class FrontendNode {
|
||||
|
||||
readonly visible!: boolean;
|
||||
|
||||
readonly unlocked!: boolean;
|
||||
|
||||
readonly errors!: string | undefined;
|
||||
readonly locked!: boolean;
|
||||
}
|
||||
|
||||
export class FrontendNodeType {
|
||||
@@ -1700,6 +1694,7 @@ export const messageMakers: Record<string, MessageMaker> = {
|
||||
UpdateMouseCursor,
|
||||
UpdateNodeGraphControlBarLayout,
|
||||
UpdateNodeGraphNodes,
|
||||
UpdateNodeGraphErrorDiagnostic,
|
||||
UpdateNodeGraphSelection,
|
||||
UpdateNodeGraphTransform,
|
||||
UpdateNodeGraphWires,
|
||||
|
||||
Reference in New Issue
Block a user