/** * @author Martin Karkowski * @email m.karkowski@zema.de * @create date 2021-06-22 09:33:55 * @modify date 2021-06-22 09:33:55 * @desc [description] */ import * as go from "gojs"; const make = go.GraphObject.make; // for conciseness in defining templates /** * * @param label * @param callback * @returns */ export function createNextButton(label: string, callback: (e: go.InputEvent, g: go.GraphObject) => void) { return { selectionAdornmentTemplate: make(go.Adornment, "Spot", make(go.Panel, "Auto", // this Adornment has a rectangular blue Shape around the selected node make(go.Shape, { fill: null, stroke: "dodgerblue", strokeWidth: 3 }), make(go.Placeholder) ), // and this Adornment has a Button to the right of the selected node make("Button", { alignment: go.Spot.Right, alignmentFocus: go.Spot.Left, click: (event, graph) => { const node = graph.part.adornedPart; const diagram = node.diagram; console.log(event, graph); } }, // define click behavior for Button in Adornment make(go.TextBlock, label, // the Button content { font: "bold 6pt sans-serif" }) ) ) // end Adornment }; }