Documentation ¶
Index ¶
- type GraphEdge
- type GraphNode
- func (n *GraphNode) Center() fyne.Position
- func (n *GraphNode) CreateRenderer() fyne.WidgetRenderer
- func (n *GraphNode) Cursor() desktop.Cursor
- func (n *GraphNode) Displace(delta fyne.Position)
- func (n *GraphNode) DragEnd()
- func (n *GraphNode) Dragged(event *fyne.DragEvent)
- func (n *GraphNode) MouseIn(event *desktop.MouseEvent)
- func (n *GraphNode) MouseMoved(event *desktop.MouseEvent)
- func (n *GraphNode) MouseOut()
- func (n *GraphNode) R2Box() r2.Box
- func (n *GraphNode) R2Center() r2.Vec2
- func (n *GraphNode) R2Position() r2.Vec2
- type GraphWidget
- func (g *GraphWidget) CreateRenderer() fyne.WidgetRenderer
- func (g *GraphWidget) Cursor() desktop.Cursor
- func (g *GraphWidget) DragEnd()
- func (g *GraphWidget) Dragged(event *fyne.DragEvent)
- func (g *GraphWidget) GetEdges(n *GraphNode) []*GraphEdge
- func (g *GraphWidget) MouseIn(event *desktop.MouseEvent)
- func (g *GraphWidget) MouseMoved(event *desktop.MouseEvent)
- func (g *GraphWidget) MouseOut()
- func (g *GraphWidget) StepForceLayout(targetLength float64)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GraphEdge ¶
type GraphEdge struct { widget.BaseWidget Graph *GraphWidget EdgeColor color.Color Width float32 Origin *GraphNode Target *GraphNode Directed bool }
func NewGraphEdge ¶
func NewGraphEdge(g *GraphWidget, v, u *GraphNode) *GraphEdge
func (*GraphEdge) CreateRenderer ¶
func (e *GraphEdge) CreateRenderer() fyne.WidgetRenderer
type GraphNode ¶
type GraphNode struct { widget.BaseWidget Graph *GraphWidget // InnerSize stores size that the inner object should have, may not // be respected if not large enough for the object. InnerSize fyne.Size // InnerObject is the canvas object that should be drawn inside of // the graph node. InnerObject fyne.CanvasObject // Padding is the distance between the inner object's drawing area // and the box. Padding int // BoxStrokeWidth is the stroke width of the box which delineates the // node. Defaults to 1. BoxStrokeWidth float32 // BoxFill is the fill color of the node, the inner object will be // drawn on top of this. Defaults to the theme.BackgroundColor(). BoxFillColor color.Color // BoxStrokeColor is the stroke color of the node rectangle. Defaults // to theme.TextColor(). BoxStrokeColor color.Color // HandleColor is the color of node handle. HandleColor color.Color // HandleStrokeWidth is the stroke width of the node handle, defaults // to 3. HandleStroke float32 }
GraphNode represents a node in the graph widget. It contains an inner widget, and also draws a border, and a "handle" that can be used to drag it around.
func NewGraphNode ¶
func NewGraphNode(g *GraphWidget, obj fyne.CanvasObject) *GraphNode
func (*GraphNode) CreateRenderer ¶
func (n *GraphNode) CreateRenderer() fyne.WidgetRenderer
func (*GraphNode) MouseIn ¶
func (n *GraphNode) MouseIn(event *desktop.MouseEvent)
func (*GraphNode) MouseMoved ¶
func (n *GraphNode) MouseMoved(event *desktop.MouseEvent)
func (*GraphNode) R2Position ¶
type GraphWidget ¶
type GraphWidget struct { widget.BaseWidget Offset fyne.Position // DesiredSize specifies the size which the graph widget should take // up, defaults to 800 x 600 DesiredSize fyne.Size Nodes map[string]*GraphNode Edges map[string]*GraphEdge }
func NewGraph ¶
func NewGraph() *GraphWidget
func (*GraphWidget) CreateRenderer ¶
func (g *GraphWidget) CreateRenderer() fyne.WidgetRenderer
func (*GraphWidget) Cursor ¶
func (g *GraphWidget) Cursor() desktop.Cursor
func (*GraphWidget) DragEnd ¶
func (g *GraphWidget) DragEnd()
func (*GraphWidget) Dragged ¶
func (g *GraphWidget) Dragged(event *fyne.DragEvent)
func (*GraphWidget) GetEdges ¶
func (g *GraphWidget) GetEdges(n *GraphNode) []*GraphEdge
func (*GraphWidget) MouseIn ¶
func (g *GraphWidget) MouseIn(event *desktop.MouseEvent)
func (*GraphWidget) MouseMoved ¶
func (g *GraphWidget) MouseMoved(event *desktop.MouseEvent)
func (*GraphWidget) MouseOut ¶
func (g *GraphWidget) MouseOut()
func (*GraphWidget) StepForceLayout ¶
func (g *GraphWidget) StepForceLayout(targetLength float64)
StepForceLayout calculates one step of force directed graph layout, with the target distance between adjacent nodes being targetLength.
Click to show internal directories.
Click to hide internal directories.