import { Utility } from "@hpcc-js/common"; import * as React from "@hpcc-js/preact-shim"; import { Icon } from "./icon"; import { TextBox } from "./text"; import { Annotations, VertexProps } from "./vertex"; export const Vertex2: React.FunctionComponent = ({ categoryID = "", text = "", textHeight = 12, textPadding = 4, icon = {}, textFill = "black", textboxFill = "white", textboxStroke = "black", textFontFamily, annotationsHeight = 12, annotationIDs = [] }) => { icon = { imageChar: "fa-question", imageCharFill: "white", height: 32, fill: "black", shape: "square", ...icon }; const textBoxHeight = textHeight + textPadding * 2; const { width } = React.useMemo(() => { return Utility.textSize(text, textFontFamily, textHeight, false); }, [text, textFontFamily, textHeight]); const stepSize = annotationsHeight; const textboxStrokeWidth = 1; const halfTextboxHeight = textBoxHeight / 2; const offsetX = 0; const offsetY = -(icon.height * 2 / 6 + textHeight + 8) / 2; const iconOffsetX = - icon.height / 2; const iconOffsetY = 0; const textboxOffsetX = Math.ceil((width / 2) + textPadding); const textboxOffsetY = halfTextboxHeight - (icon.height / 2); const annotationOffsetX = stepSize / 2; const annotationOffsetY = halfTextboxHeight; return categoryID ? : <> ; };