asciiroute

package
v0.7.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 19, 2025 License: MPL-2.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

View Source
const (
	MaxRouteAttempts = 200
	LabelOffsetX     = 2
)

Variables

This section is empty.

Functions

func DrawRoute

func DrawRoute(rd RouteDrawer, conn d2target.Connection)

Types

type Boundary

type Boundary struct {
	TL Point
	BR Point
}

func NewBoundary

func NewBoundary(tl, br Point) *Boundary

func (*Boundary) Contains

func (b *Boundary) Contains(x int, y int) bool

type Point

type Point struct {
	X int
	Y int
}

type RouteDrawer

type RouteDrawer interface {
	GetCanvas() *asciicanvas.Canvas
	GetChars() charset.Set
	GetDiagram() *d2target.Diagram
	GetFontWidth() float64
	GetFontHeight() float64
	GetScale() float64
	GetBoundaryForShape(s d2target.Shape) (Point, Point)
	CalibrateXY(x, y float64) (float64, float64)
	GetContext() context.Context
}

type RouteLabelPosition

type RouteLabelPosition struct {
	I       int     // Index of route segment
	X       int     // X coordinate for label
	Y       int     // Y coordinate offset
	MaxDiff float64 // Maximum difference for the segment
}

RouteLabelPosition holds calculated position for route label

func (*RouteLabelPosition) ShouldDrawAt

func (pos *RouteLabelPosition) ShouldDrawAt(currentIndex, x, y int, ax, ay, sx, sy float64) bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL