MCPcopy
hub / github.com/opentrace/opentrace / drawEdge

Method drawEdge

ui/src/components/pixi/PixiRenderer.ts:1376–1399  ·  view source on GitHub ↗

Draw an edge between two points, using the current breakpoint's edge style.

(
    gfx: Graphics,
    sx: number,
    sy: number,
    tx: number,
    ty: number,
  )

Source from the content-addressed store, hash-verified

1374
1375 /** Draw an edge between two points, using the current breakpoint's edge style. */
1376 private drawEdge(
1377 gfx: Graphics,
1378 sx: number,
1379 sy: number,
1380 tx: number,
1381 ty: number,
1382 ): void {
1383 if (this.bp.edgeStyle === 'curve') {
1384 const mx = (sx + tx) / 2;
1385 const my = (sy + ty) / 2;
1386 const dx = tx - sx;
1387 const dy = ty - sy;
1388 const len = Math.sqrt(dx * dx + dy * dy);
1389 if (len < 0.001) return;
1390 const offset = len * this.curvature;
1391 const cpx = mx + (-dy / len) * offset;
1392 const cpy = my + (dx / len) * offset;
1393 gfx.moveTo(sx, sy);
1394 gfx.quadraticCurveTo(cpx, cpy, tx, ty);
1395 } else {
1396 gfx.moveTo(sx, sy);
1397 gfx.lineTo(tx, ty);
1398 }
1399 }
1400
1401 /** Check if a point is within the visible viewport (with margin). */
1402 private isInViewport(wx: number, wy: number): boolean {

Callers 3

redrawAllEdgesMethod · 0.95
redrawDragEdgesMethod · 0.95
redrawAllEdges3DMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected