MCPcopy Create free account
hub / github.com/thetarnav/solid-devtools / Line

Function Line

packages/frontend/src/dgraph.tsx:180–215  ·  view source on GitHub ↗
(props: {
    length: number
    depth: number
    source_depth: number
    flow_index: number
    source_flow_index: number
    node_margin: number
    highlighted: boolean
})

Source from the content-addressed store, hash-verified

178}
179
180function Line(props: {
181 length: number
182 depth: number
183 source_depth: number
184 flow_index: number
185 source_flow_index: number
186 node_margin: number
187 highlighted: boolean
188}): s.JSX.Element {
189 const math = s.createMemo(() => {
190 const l = props.length
191 const x1 = props.depth / l
192 const x2 = props.source_depth / l
193 const y1 = props.flow_index / l
194 const y2 = props.source_flow_index / l
195 const d = Math.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2)
196 return {x1, x2, y1, y2, d}
197 })
198
199 return (
200 <line
201 x1={math().x1}
202 x2={math().x2}
203 y1={math().y1}
204 y2={math().y2}
205 stroke-width={0.05 / props.length}
206 stroke-dasharray={`${math().d - props.node_margin} 1`}
207 stroke-dashoffset={props.node_margin / -2}
208 marker-end="url(#head)"
209 class={clsx(
210 'stroke-dom stroke-cap-round transition-opacity duration-300 delay-75',
211 props.highlighted ? 'opacity-100' : 'opacity-50',
212 )}
213 />
214 )
215}
216
217export function Dgraph_View(): s.JSX.Element {
218 const ctx = useAppCtx()

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…