diagramwidget

package
v0.0.0-...-d5a0809 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2024 License: BSD-3-Clause Imports: 16 Imported by: 1

README

DiagramWidget

The DiagramWidget provides a drawing area within which a diagram can be created. The diagram itself is a collection of DiagramElement widgets (an interface). There are two types of DiagramElements: DiagramNode widgets and DiagramLink widgets. DiagramNode widgets are thin wrappers around a user-supplied CanvasObject. Any valid CanvasObject can be used. DiagramLinks are line-based connections between DiagramElements. Note that links can connect to other links as well as nodes.

While some provisions have been made for automatic layout, layouts are for the convenience of the author and are on-demand only. The design intent is that users will place the diagram elements for human readability.

DiagramElements are managed by the DiagramWidget from a layout perspective. DiagramNodes have no size constraints imposed by the DiagramWidget and can be placed anywhere. DiagramLinks connect DiagramElements. The DiagramWidget keeps track of the DiagramElements to which each DiagramLink is connected and calls the Refresh() method on the link when the connected diagram element is moved or resized.

Diagram Widget

DiagramElement Interface

A DiagramElement is the base interface for any element of the diagram being managed by the DiagramWidget. It provides a common interface for DiagramNode and DiagramLink widgets. The DiagramElement interface provides operations for retrieving the DiagramWidget, the ID of the DiagramElement, and for showing and hiding the handles that are used for graphically manipulating the diagram element. The specifics of what handles do are different for nodes and links - these are described below in the sections for their respective widgets.

DiagramNode Widget

The DiagramNode widget is a wrapper around a user-supplied CanvasObject. In addition to the user-supplied CanvasObject, the node displays a border and, when selected, handles at the corners and edge mid-points that can be used to manipulate the size of the node. The node can be selected and dragged to a new position with a mouse by clicking in the border area around the canvas object.

The DiagramLink widget provides a directed line-based connection between two DiagramElements. The link is defined in terms of LinkPoints that are connected by LinkSegments (both of which are widgets in their own right). The link maintains an array of points, with the point at index [0] being the point at which the link connects to the source DiagramElement and the point at the last index being the point at which the link connects to the target DiagramElement. The link also maintains an array of line segments, with the segment at index [0] connecting points [0] and [1], the segment at index [1] connecting the points [1] and [2], etc. The current implementation only has a single segment, but interfaces will be added shortly to enable the addition and removal of points and segments.

Many visual languages (formalized diagrams) utilize graphical decorations on lines. The link provides the ability to add an arbitrary number of graphic decorations at three points along the link: the source end, the target end, and the midpoint. Decorations are stacked in the order they are added at the indicated point. The location of the source and target points is obvious, but the midpoint bears some discussion. If there is only one line segment, the midpoint is the midpoint of this segment. If there is more than one line segment, the "midpoint" is defined to be the next to last point in the array of points. For a two-segment link, this will be the point at which the two segments join. For a multi-segment link, this will be the point at which the next-to-last and last segments join. Decorations can be added by calling BaseDiagramLink.Add<position>Decoration(decoration Decoration). Two implementations of the Decoration interface are provided: An Arrowhead and a Polygon.

Also common in visual languages are textual annotations associated with either the link as a whole or to the ends of the link. For this purpose, the link allows the association of one or more AnchoredText widgets with each of the reference points on the link: source, target, and midpoint. These widgets keep track of their position relative to the link's reference points. They can be moved interactively with the mouse to a new position. When the reference point on the link moves, the anchored text will also move, maintaining its relative position.

Users do not create AnchoredText widgets directly: the link itself creates and manages them. the user calls BaseDiagramLink.Add<position>AnchoredText(key, text) to add an anchored text. The key is expected to be unique at the position and can be used to update the text later. The AnchoredText can also be directly edited in the diagram.

When a link connects to another link, it connects at the midpoint of the source or target link.

Target Applications

Applications employing diagram-based user interfaces commonly have a core model (data structure), a tree view of the underlying model, one or more diagrams displaying subsets of the model, and a properties view of a single selected model elements. Desired application behavior is that model data may be edited in any of the views and changes are immediately reflected in the other views.

Mappings from model to diagram are more complex than simple bindings and typically require some type of mapping. A simple value in the model (e.g. a pointer from Element1 to Element2 in the model) may map to a graphical element (e.g. a link between graphical representations of Element1 and Element2). Simple bindings are not sufficient for this type of mapping. The DiagramElements employ application-provided unique identifiers (similar to those used in the Tree Widget) that provide a mechanism for correlating graphical and model elements. Callbacks on the DiagramWidget (discussed below) provide the hooks for adding mapping behavior.

DiagramWidget Architecture

The DiagramWidget manages a private drawing area inside a scrolling container and the DiagramElements that appear in the drawing. These DiagramElements may be either Nodes or Links. The content of each node is an application-supplied canvas object that can be arbitrarily complex. Links are lines that can connect to both Nodes and other Links.

All DiagramElements have default ConnectionPads to which links may connect, and these defaults may be augmented with application-supplied ConnectionPads at specific positions on the DiagramElement. The user interface mechanisms for interactively connecting Links to ConnectionPads are built into the DiagramWidget, with an application-provided callback DiagramWidget.IsConnectionAllowedCallback() determining which connections between links and pads are allowable.

Links can be customized with both graphical decorations and floating text annotations. Graphical decorations may be "stacked" at three locations on each link, either at the ends or the mid-point. An arbitrary number of floating text annotations can be added at each of these points as well. The position of each annotation with respect to the point may be adjusted by the user and the relative position will be maintained as the links are moved. The text in the annotations may be edited directly (an Entry widget is used for each annotation).

A number of callbacks on the DiagramWidget enable applications to add functionality.

  • DiagramWidget.LinkConnectionChangedCallback() can be used to update application data structures when link connections are changed interactively.

  • DiagramWidget.LinkSegmentMouseDownSecondaryCallback() can be used to provide context menus for links.

  • DiagramWidget.LinkSegmentMouseUpCallback()

  • DiagramWidget.PrimaryDiagramElementSelectionChangedCallback() can be used to notify the application that the graphical DiagramElement selection has changed.

There are a numer of callbacks for events directly in the drawing area:

  • DiagramWidget.MouseDownCallback()
  • DiagramWidget.MouseInCallback()
  • DiagramWidget.MouseMovedCallback()
  • DiagramWidget.MouseOutCallback()
  • DiagramWidget.MouseUpCallback() can be used to complete a drag-and-drop operation adding a view of a data object to the diagram.
  • `DiagramWidget.OnTappedCallback()' can be used to add new elements to a diagram based on a toolbar selection of element type.

Extending a DiagramElement

DiagramElements can be extended by the application designer, but the initialization of the extension is slightly different than the normal fyne extension mechanism, The initialization function uses the normal fyne extension mechanism behind the scenes, but in addition initializes its relationship to the DiagramWidget to which it belongs, allowing the DiagramWidget to manage the DiagramElement. When the application designer extends diagram elements, they are expected to extend either BaseDiagramNode or BaseDiagramLink and call the appropriate initialization functions:

  • InitializeBaseDiagramNode(diagramNode DiagramNode, diagram *DiagramWidget, obj fyne.CanvasObject, nodeID string)
  • InitializeBaseDiagramLink(diagramLink DiagramLink, diagram *DiagramWidget, linkID string) where diagramNode or diagramLink are the application-defined extensions.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LinkEnds [2]LinkEnd = [2]LinkEnd{SOURCE, TARGET}

LinkEnds contains the enumerated LinkEnd values

Functions

func InitializeBaseDiagramLink(diagramLink DiagramLink, diagram *DiagramWidget, linkID string)

InitializeBaseDiagramLink initializes the BaseDiagramLink. It must be called by any extensions to BaseDiagramLink

func InitializeBaseDiagramNode

func InitializeBaseDiagramNode(diagramNode DiagramNode, diagram *DiagramWidget, obj fyne.CanvasObject, nodeID string)

InitializeBaseDiagramNode is used to initailize the BaseDiagramNode. It must be called by any extensions to the BaseDiagramNode

func StepForceLayout

func StepForceLayout(dw *DiagramWidget, targetLength float64)

StepForceLayout calculates one step of force directed graph layout, with the target distance between adjacent nodes being targetLength.

Types

type AnchoredText

type AnchoredText struct {
	widget.BaseWidget

	ForegroundColor color.Color
	// contains filtered or unexported fields
}

AnchoredText provides a text annotation for a path that is anchored to one of the path's reference points (e.g. end or middle). The anchored text may be moved independently, but it keeps track of its position relative to the reference point. If the reference point moves, the AnchoredText will also move by the same amount

func NewAnchoredText

func NewAnchoredText(text string) *AnchoredText

NewAnchoredText creates an textual annotation for a link. After it is created, one of the three Add<position>AnchoredText methods must be called on the link to actually associate the anchored text with the appropriate reference point on the link.

func (*AnchoredText) CreateRenderer

func (at *AnchoredText) CreateRenderer() fyne.WidgetRenderer

CreateRenderer is the required method for a widget extension

func (*AnchoredText) DataChanged

func (at *AnchoredText) DataChanged()

DataChanged is the callback function for the displayedTextBinding.

func (*AnchoredText) Displace

func (at *AnchoredText) Displace(delta fyne.Position)

Displace moves the anchored text relative to its reference position.

func (*AnchoredText) DragEnd

func (at *AnchoredText) DragEnd()

DragEnd is one of the required methods for a draggable widget. It just refreshes the widget.

func (*AnchoredText) Dragged

func (at *AnchoredText) Dragged(event *fyne.DragEvent)

Dragged is the required method for a draggable widget. It moves the anchored text relative to its reference position

func (*AnchoredText) GetDisplayedTextBinding

func (at *AnchoredText) GetDisplayedTextBinding() binding.String

GetDisplayedTextBinding returns the binding for the displayed text

func (*AnchoredText) GetTextEntry

func (at *AnchoredText) GetTextEntry() *widget.Entry

GetTextEntry returns the entry widget

func (*AnchoredText) MinSize

func (at *AnchoredText) MinSize() fyne.Size

MinSize returns the size of the entry widget plus a one-pixel border

func (*AnchoredText) MouseIn

func (at *AnchoredText) MouseIn(event *desktop.MouseEvent)

MouseIn is one of the required methods for a mouseable widget.

func (*AnchoredText) MouseMoved

func (at *AnchoredText) MouseMoved(event *desktop.MouseEvent)

MouseMoved is one of the required methods for a mouseable widget

func (*AnchoredText) MouseOut

func (at *AnchoredText) MouseOut()

MouseOut is one of the required methods for a mouseable widget

func (*AnchoredText) Move

func (at *AnchoredText) Move(position fyne.Position)

Move overrides the BaseWidget's Move method. It updates the anchored text's offset and then calls the normal BaseWidget.Move method.

func (*AnchoredText) SetForegroundColor

func (at *AnchoredText) SetForegroundColor(fc color.Color)

SetForegroundColor sets the text color

func (*AnchoredText) SetReferencePosition

func (at *AnchoredText) SetReferencePosition(position fyne.Position)

SetReferencePosition sets the reference position of the anchored text and calls the BaseWidget.Move() method to actually move the displayed text

type Arrowhead

type Arrowhead struct {
	widget.BaseWidget

	// Position() is the point at which the tip of the arrow will be placed.
	// StrokeWidth is the width of the arrowhead lines
	StrokeWidth float32
	// StrokeColor is the color of the arrowhead
	StrokeColor color.Color
	// Theta is the angle between each of the tails and the nominal reference axis.
	// This angle is in radians.
	Theta float64
	// Length is the length of the two "tails" that intersect at the tip.
	Length int
	// contains filtered or unexported fields
}

Arrowhead defines a canvas object which renders an arrow. The arrowhead is defined with reference to X axis, with the tip of the arrow being at the origin. When rendered, the arrowhead is rotated to match the angle of the link's line segment with which it is oriented, indicated by the baseAngle.

func NewArrowhead

func NewArrowhead() *Arrowhead

NewArrowhead creates an arrowhead with defaults

func (*Arrowhead) CreateRenderer

func (a *Arrowhead) CreateRenderer() fyne.WidgetRenderer

CreateRenderer creates a renderer for the Arrowhead

func (*Arrowhead) GetReferenceLength

func (a *Arrowhead) GetReferenceLength() float32

GetReferenceLength returns the length of the decoration along the reference axis

func (*Arrowhead) LeftPoint

func (a *Arrowhead) LeftPoint() fyne.Position

LeftPoint returns the position of the end of the left half of the arrowhead

func (*Arrowhead) MinSize

func (a *Arrowhead) MinSize() fyne.Size

MinSize returns the minimum size which is the actual size of the arrowhead

func (*Arrowhead) Resize

func (a *Arrowhead) Resize(s fyne.Size)

Resize scales the arrowhead

func (*Arrowhead) RightPoint

func (a *Arrowhead) RightPoint() fyne.Position

RightPoint returns the position of the end of the right half of the arrowhead

func (*Arrowhead) SetFillColor

func (a *Arrowhead) SetFillColor(fillColor color.Color)

SetFillColor is a noop for the arrowhead

func (*Arrowhead) SetSolid

func (a *Arrowhead) SetSolid(bool)

SetSolid is a noop because the arrowhead is an open structure

func (*Arrowhead) SetStrokeColor

func (a *Arrowhead) SetStrokeColor(strokeColor color.Color)

SetStrokeColor sets the color used to draw the arrowhead

func (*Arrowhead) SetStrokeWidth

func (a *Arrowhead) SetStrokeWidth(strokeWidth float32)

SetStrokeWidth sets the width of the lines used to render the arrowhead

func (*Arrowhead) Size

func (a *Arrowhead) Size() fyne.Size

Size returns the size of the arrowhead

type BaseDiagramLink struct {
	SourceDecorations []Decoration

	TargetDecorations []Decoration

	MidpointDecorations []Decoration
	// contains filtered or unexported fields
}

BaseDiagramLink is a directed graphic connection between two DiagramElements that are referred to as the Source and Target. The link consists of one or more line segments. By default a single line segment connects the Source and Target. The Link connects to ConnectionPads on the DiagramElements. There are three key points on a Link: the Source connection point, the Target connection point, and a MidPoint. For a single segment, the MidPoint is the middle of the segment. When there are two or more segments, the MidPoint is the source end of the next-to-last segment. Graphic Decoration widgets may be added at each of these points. Multiple decorations may be added at each point Multiple decorations are "stacked" along the line in the order added. These graphic decorations rotate with their associated line segments to maintain their orientation with respect to the line segment. Textual AnchoredText widgets may be added at each of the key points. These may be moved with respect to their associated key points. When the key point is moved, associated anchored texts move by the same amount, maintaining the existing offset between the anchored text and the key point. Multiple AnchoredText widgets may be associated with each key point. AnchoredText widgets are indexed by string key values provided at the time the AnchoredText is added. These key values can be used to retrieve the AnchoredText widget so that the displayed text value (among other things) can be set programatically. By default, there is a single ConnectionPad (a PointPad) associated with a Link and located at the MidPoint. Thus a Link can connect to another Link using this ConnectionPad.

func NewDiagramLink(diagram *DiagramWidget, linkID string) *BaseDiagramLink

NewDiagramLink creates a DiagramLink widget connecting the two indicated ConnectionPads. It adds itself to the DiagramWidget, indexed by the supplied LinkID. This id must be unique across all of the DiagramElements in the Diagram. It can be used to retrieve the DiagramLink from the Diagram. The ID is intended to be used to facilitate mapping the DiagramLink to the information it represents in the application. The DiagramLink uses the DiagramWidget's ForegroundColor as the default color for the line segments.

func (*BaseDiagramLink) AddMidpointAnchoredText

func (bdl *BaseDiagramLink) AddMidpointAnchoredText(key string, displayedText string) *AnchoredText

AddMidpointAnchoredText creates a new AnchoredText widget and adds it to the DiagramLink at the Midpoint position. It uses the supplied key to index the widget so that it can be retrieved later. Multiple AnchoredText widgets can be added.

func (*BaseDiagramLink) AddMidpointDecoration

func (bdl *BaseDiagramLink) AddMidpointDecoration(decoration Decoration)

AddMidpointDecoration adds the supplied Decoration widget at the Midpoint position. Multiple calls to this function will stack the decorations along the line segment at the Midpoint position.

func (*BaseDiagramLink) AddSourceAnchoredText

func (bdl *BaseDiagramLink) AddSourceAnchoredText(key string, displayedText string) *AnchoredText

AddSourceAnchoredText creates a new AnchoredText widget and adds it to the DiagramLink at the Source position. It uses the supplied key to index the widget so that it can be retrieved later. Multiple AnchoredText widgets can be added.

func (*BaseDiagramLink) AddSourceDecoration

func (bdl *BaseDiagramLink) AddSourceDecoration(decoration Decoration)

AddSourceDecoration adds the supplied Decoration widget at the Source position. Multiple calls to this function will stack the decorations along the line segment at the Source position.

func (*BaseDiagramLink) AddTargetAnchoredText

func (bdl *BaseDiagramLink) AddTargetAnchoredText(key string, displayedText string) *AnchoredText

AddTargetAnchoredText creates a new AnchoredText widget and adds it to the DiagramLink at the Target position. It uses the supplied key to index the widget so that it can be retrieved later. Multiple AnchoredText widgets can be added.

func (*BaseDiagramLink) AddTargetDecoration

func (bdl *BaseDiagramLink) AddTargetDecoration(decoration Decoration)

AddTargetDecoration adds the supplied Decoration widget at the Target position. Multiple calls to this function will stack the decorations along the line segment at the Target position.

func (*BaseDiagramLink) CreateRenderer

func (bdl *BaseDiagramLink) CreateRenderer() fyne.WidgetRenderer

CreateRenderer creates the WidgetRenderer for a DiagramLink

func (*BaseDiagramLink) GetBackgroundColor

func (de *BaseDiagramLink) GetBackgroundColor() color.Color

func (*BaseDiagramLink) GetConnectionPads

func (de *BaseDiagramLink) GetConnectionPads() map[string]ConnectionPad

func (*BaseDiagramLink) GetDefaultConnectionPad

func (bdl *BaseDiagramLink) GetDefaultConnectionPad() ConnectionPad

GetDefaultConnectionPad returns the midPad of the Link

func (*BaseDiagramLink) GetDiagram

func (de *BaseDiagramLink) GetDiagram() *DiagramWidget

func (*BaseDiagramLink) GetDiagramElementID

func (de *BaseDiagramLink) GetDiagramElementID() string

func (*BaseDiagramLink) GetForegroundColor

func (de *BaseDiagramLink) GetForegroundColor() color.Color

func (*BaseDiagramLink) GetHandle

func (de *BaseDiagramLink) GetHandle(handleName string) *Handle

func (*BaseDiagramLink) GetHandleColor

func (de *BaseDiagramLink) GetHandleColor() color.Color

func (*BaseDiagramLink) GetLinkPoints

func (bdl *BaseDiagramLink) GetLinkPoints() []*LinkPoint

GetLinkPoints returns an array of points that define the vertices of the link including the endpoints

func (*BaseDiagramLink) GetMidPad

func (bdl *BaseDiagramLink) GetMidPad() ConnectionPad

GetMidPad returns the PointPad at the midpoint so that it can be used as either the Source or Target pad for another Link.

func (*BaseDiagramLink) GetMidpointAnchoredText

func (bdl *BaseDiagramLink) GetMidpointAnchoredText(key string) *AnchoredText

GetMidpointAnchoredText returns the midpoint anchored text indexed under the supplied key

func (*BaseDiagramLink) GetPadColor

func (de *BaseDiagramLink) GetPadColor() color.Color

func (*BaseDiagramLink) GetProperties

func (de *BaseDiagramLink) GetProperties() DiagramElementProperties

func (*BaseDiagramLink) GetSourceAnchoredText

func (bdl *BaseDiagramLink) GetSourceAnchoredText(key string) *AnchoredText

GetSourceAnchoredText returns the source end anchored text indexed under the skupplied key

func (*BaseDiagramLink) GetSourceHandle

func (bdl *BaseDiagramLink) GetSourceHandle() *Handle

GetSourceHandle returns the handle associated with the source end

func (*BaseDiagramLink) GetSourcePad

func (bdl *BaseDiagramLink) GetSourcePad() ConnectionPad

GetSourcePad returns the pad (on another DiagramElement) to which the source end is connected

func (*BaseDiagramLink) GetTargetAnchoredText

func (bdl *BaseDiagramLink) GetTargetAnchoredText(key string) *AnchoredText

GetTargetAnchoredText returns the target tend anchored text indexed under the supplied key

func (*BaseDiagramLink) GetTargetHandle

func (bdl *BaseDiagramLink) GetTargetHandle() *Handle

GetTargetHandle returns the handle associated with the target end

func (*BaseDiagramLink) GetTargetPad

func (bdl *BaseDiagramLink) GetTargetPad() ConnectionPad

GetTargetPad returns the pad (on another DiagramElement) to which the target end is connected

func (*BaseDiagramLink) HideHandles

func (de *BaseDiagramLink) HideHandles()
func (bdl *BaseDiagramLink) IsLink() bool

IsLink returns true because this is a link

func (*BaseDiagramLink) IsNode

func (bdl *BaseDiagramLink) IsNode() bool

IsNode returns false because this is a link

func (*BaseDiagramLink) MouseIn

func (bdl *BaseDiagramLink) MouseIn(event *desktop.MouseEvent)

MouseIn responds to the mouse entering the bounding rectangle of the Link

func (*BaseDiagramLink) MouseMoved

func (bdl *BaseDiagramLink) MouseMoved(event *desktop.MouseEvent)

MouseMoved responds to the mouse moving while within the bounding rectangle of the Link

func (*BaseDiagramLink) MouseOut

func (bdl *BaseDiagramLink) MouseOut()

MouseOut responds to the mouse leaving the bounding rectangle of the Link

func (*BaseDiagramLink) SetBackgroundColor

func (de *BaseDiagramLink) SetBackgroundColor(backgroundColor color.Color)

func (*BaseDiagramLink) SetForegroundColor

func (de *BaseDiagramLink) SetForegroundColor(foregroundColor color.Color)

func (*BaseDiagramLink) SetHandleColor

func (de *BaseDiagramLink) SetHandleColor(handleColor color.Color)

func (*BaseDiagramLink) SetProperties

func (de *BaseDiagramLink) SetProperties(properties DiagramElementProperties)

func (*BaseDiagramLink) SetSourcePad

func (bdl *BaseDiagramLink) SetSourcePad(pad ConnectionPad)

SetSourcePad sets the source pad (belonging to another DiagramElement) and adds the link dependency to the diagram

func (*BaseDiagramLink) SetTargetPad

func (bdl *BaseDiagramLink) SetTargetPad(pad ConnectionPad)

SetTargetPad sets the target pad (belonging to another DiagramElement) and adds the link dependency to the diagram

func (*BaseDiagramLink) ShowHandles

func (de *BaseDiagramLink) ShowHandles()

type BaseDiagramNode

type BaseDiagramNode struct {

	// InnerSize stores size that the inner object should have, may not
	// be respected if not large enough for the object.
	InnerSize fyne.Size

	// MovedCallback, if present, is invoked when the node is moved
	MovedCallback func()
	// contains filtered or unexported fields
}

BaseDiagramNode represents a node in the diagram widget. It contains an inner widget, and also draws a border, and a "handle" that can be used to drag it around.

func (*BaseDiagramNode) Center

func (bdn *BaseDiagramNode) Center() fyne.Position

Center reurns the position of the center of the node

func (*BaseDiagramNode) CreateRenderer

func (bdn *BaseDiagramNode) CreateRenderer() fyne.WidgetRenderer

CreateRenderer creates the renderer for the diagram node

func (*BaseDiagramNode) Cursor

func (bdn *BaseDiagramNode) Cursor() desktop.Cursor

Cursor returns the desktop default cursor

func (*BaseDiagramNode) DragEnd

func (bdn *BaseDiagramNode) DragEnd()

DragEnd is presently a no-op

func (*BaseDiagramNode) Dragged

func (bdn *BaseDiagramNode) Dragged(event *fyne.DragEvent)

Dragged passes the DragEvent to the diagram for processing

func (*BaseDiagramNode) GetBackgroundColor

func (de *BaseDiagramNode) GetBackgroundColor() color.Color

func (*BaseDiagramNode) GetConnectionPads

func (de *BaseDiagramNode) GetConnectionPads() map[string]ConnectionPad

func (*BaseDiagramNode) GetDefaultConnectionPad

func (bdn *BaseDiagramNode) GetDefaultConnectionPad() ConnectionPad

GetDefaultConnectionPad returns the edge pad for the node

func (*BaseDiagramNode) GetDiagram

func (de *BaseDiagramNode) GetDiagram() *DiagramWidget

func (*BaseDiagramNode) GetDiagramElementID

func (de *BaseDiagramNode) GetDiagramElementID() string

func (*BaseDiagramNode) GetEdgePad

func (bdn *BaseDiagramNode) GetEdgePad() ConnectionPad

GetEdgePad returns the edge pad for the node

func (*BaseDiagramNode) GetForegroundColor

func (de *BaseDiagramNode) GetForegroundColor() color.Color

func (*BaseDiagramNode) GetHandle

func (de *BaseDiagramNode) GetHandle(handleName string) *Handle

func (*BaseDiagramNode) GetHandleColor

func (de *BaseDiagramNode) GetHandleColor() color.Color

func (*BaseDiagramNode) GetPadColor

func (de *BaseDiagramNode) GetPadColor() color.Color

func (*BaseDiagramNode) GetProperties

func (de *BaseDiagramNode) GetProperties() DiagramElementProperties

func (*BaseDiagramNode) HideHandles

func (de *BaseDiagramNode) HideHandles()
func (bdn *BaseDiagramNode) IsLink() bool

IsLink returns false because this is a node

func (*BaseDiagramNode) IsNode

func (bdn *BaseDiagramNode) IsNode() bool

IsNode returns true because this is a node

func (*BaseDiagramNode) Move

func (bdn *BaseDiagramNode) Move(position fyne.Position)

Move moves the node and invokes the callback if present.

func (*BaseDiagramNode) R2Box

func (bdn *BaseDiagramNode) R2Box() r2.Box

R2Box returns the bounding box in r2 coordinates

func (*BaseDiagramNode) R2Center

func (bdn *BaseDiagramNode) R2Center() r2.Vec2

R2Center returns the r2 vector for the center of the bounding box

func (*BaseDiagramNode) R2Position

func (bdn *BaseDiagramNode) R2Position() r2.Vec2

R2Position returns the position of the node as an r2 vector

func (*BaseDiagramNode) SetBackgroundColor

func (de *BaseDiagramNode) SetBackgroundColor(backgroundColor color.Color)

func (*BaseDiagramNode) SetForegroundColor

func (de *BaseDiagramNode) SetForegroundColor(foregroundColor color.Color)

func (*BaseDiagramNode) SetHandleColor

func (de *BaseDiagramNode) SetHandleColor(handleColor color.Color)

func (*BaseDiagramNode) SetInnerObject

func (bdn *BaseDiagramNode) SetInnerObject(obj fyne.CanvasObject)

SetInnerObject makes the skupplied canvas object the center of the node

func (*BaseDiagramNode) SetProperties

func (de *BaseDiagramNode) SetProperties(properties DiagramElementProperties)

func (*BaseDiagramNode) ShowHandles

func (de *BaseDiagramNode) ShowHandles()

func (*BaseDiagramNode) Tapped

func (bdn *BaseDiagramNode) Tapped(event *fyne.PointEvent)

Tapped passes the tapped event on to the Diagram

type ConnectionPad

type ConnectionPad interface {
	fyne.Widget
	desktop.Hoverable
	GetPadOwner() DiagramElement
	GetCenterInDiagramCoordinates() fyne.Position

	MouseDown(*desktop.MouseEvent)
	MouseUp(*desktop.MouseEvent)
	SetPadColor(color.Color)
	// contains filtered or unexported methods
}

ConnectionPad is an interface to a connection shape on a DiagramElement.

type ConnectionTransaction

type ConnectionTransaction struct {
	LinkPoint       *LinkPoint
	Link            DiagramLink
	InitialPad      ConnectionPad
	InitialPosition fyne.Position
	PendingPad      ConnectionPad
}

ConnectionTransaction holds transient data during the creation of a link. It is public for testing purposes only

func NewConnectionTransaction

func NewConnectionTransaction(linkPoint *LinkPoint, link DiagramLink, initialPad ConnectionPad, initialPosition fyne.Position) *ConnectionTransaction

NewConnectionTransaction returns an instance of ConnectionTransaction

type Decoration

type Decoration interface {
	fyne.Widget

	SetFillColor(color color.Color)
	// SetSolid determines whether the stroke color is used to fill the decoration
	// It has no impact if the decoration is open
	SetSolid(bool)
	// SetStrokeColor sets the color to be used for lines in the decoration
	SetStrokeColor(color color.Color)
	// SetStrokeWidth sets the width of the lines to be used in the decoration
	SetStrokeWidth(width float32)
	// GetReferenceLength returns the length of the decoration along the reference axis
	GetReferenceLength() float32
	// contains filtered or unexported methods
}

Decoration is a widget intended to be used as a decoration on a Link widget The graphical representation of the widget is defined along a reference axis with one point on that axis designated as the reference point (generally the origin). Depending on the Link widget's use of the decoration, the reference point will either be aligned with one of the endpoints of the link or with some intermediate point on the link. The Link will move the Decoration's reference point as the link itself is modified. The Link will also determine the slope of the Link's line at the reference point and direct the Decoration to rotate about the reference point to achieve the correct alignment of the decoration with respect to the Link's line. The Link may have more than one decoration stacked along the line at the reference point. To accomplish this, it needs to know the length of the decoration along the reference axis so that it can adjust the position of the next decoration appropriately.

type DiagramElement

type DiagramElement interface {
	fyne.Widget
	// GetBackgroundColor returns the background color for the widget
	GetBackgroundColor() color.Color
	// GetConnectionPads() returns all of the connection pads on the element
	GetConnectionPads() map[string]ConnectionPad
	// GetForegroundColor returns the foreground color for the widget
	GetForegroundColor() color.Color
	// GetDefaultConnectionPad returns the default pad for the DiagramElement
	GetDefaultConnectionPad() ConnectionPad
	// GetDiagram returns the DiagramWidget to which the DiagramElement belongs
	GetDiagram() *DiagramWidget
	// GetDiagramElementID returns the string identifier provided at the time the DiagramElement was created
	GetDiagramElementID() string
	// GetHandle returns the handle with the indicated index name
	GetHandle(string) *Handle
	// GetHandleColor returns the color for the element's handles
	GetHandleColor() color.Color
	// GetPadColor returns the color for the element's pads
	GetPadColor() color.Color
	// GetProperties returns the properties of the DiagramElement
	GetProperties() DiagramElementProperties

	// HideHandles hides the handles on the DiagramElement
	HideHandles()
	// IsLink returns true if the diagram element is a link
	IsLink() bool
	// IsNode returns true of the diagram element is a node
	IsNode() bool
	// Position returns the position of the diagram element
	Position() fyne.Position
	// SetForegroundColor sets the foreground color for the widget
	SetForegroundColor(color.Color)
	// SetBackgroundColor sets the background color for the widget
	SetBackgroundColor(color.Color)
	// SetProperties sets the foreground, background, and handle colors
	SetProperties(DiagramElementProperties)
	// ShowHandles shows the handles on the DiagramElement
	ShowHandles()
	// Size returns the size of the diagram element
	Size() fyne.Size
	// contains filtered or unexported methods
}

DiagramElement is a widget that can be placed directly in a diagram. The most common elements are Node and Link widgets.

type DiagramElementProperties

type DiagramElementProperties struct {
	ForegroundColor   color.Color
	BackgroundColor   color.Color
	HandleColor       color.Color
	PadColor          color.Color
	TextSize          float32
	CaptionTextSize   float32
	Padding           float32
	StrokeWidth       float32
	PadStrokeWidth    float32
	HandleStrokeWidth float32
}

DiagramElementProperties are the rendering properties of a DiagramElement

type DiagramLink interface {
	DiagramElement

	GetLinkPoints() []*LinkPoint
	GetSourcePad() ConnectionPad
	GetSourceHandle() *Handle
	GetTargetPad() ConnectionPad
	GetTargetHandle() *Handle

	SetSourcePad(ConnectionPad)
	SetTargetPad(ConnectionPad)
	// contains filtered or unexported methods
}

DiagramLink is a DiagramElement that connects two other DiagramElements

type DiagramNode

type DiagramNode interface {
	DiagramElement

	GetEdgePad() ConnectionPad
	R2Center() r2.Vec2
	SetInnerObject(fyne.CanvasObject)
	// contains filtered or unexported methods
}

DiagramNode is a rectangular DiagramElement typically containing one or more widgets

func NewDiagramNode

func NewDiagramNode(diagram *DiagramWidget, obj fyne.CanvasObject, nodeID string) DiagramNode

NewDiagramNode creates a DiagramNode widget and adds it to the DiagramWidget. The user-supplied nodeID string must be unique across all of the DiagramElements in the diagram. It can be used to retrieve the DiagramNode from the DiagramWidget. It is permissible for the canvas object to be nil when this function is called and then add the canvas object later.

type DiagramWidget

type DiagramWidget struct {
	widget.BaseWidget

	// ID is expected to be unique across all DiagramWidgets in the application.
	ID string

	Offset fyne.Position

	// DesiredSize specifies the size of the displayed diagram. Defaults to 800 x 600
	DesiredSize fyne.Size

	DefaultDiagramElementProperties DiagramElementProperties
	DiagramElements                 *list.List

	// ConnectionTransaction holds transient data during the creation of a link. It is public for testing purposes
	ConnectionTransaction *ConnectionTransaction
	// IsConnectionAllowedCallback is called to determine whether a particular connection between a link and a pad is allowed
	IsConnectionAllowedCallback func(DiagramLink, LinkEnd, ConnectionPad) bool
	// LinkConnectionChangedCallback is called when a link connection changes. The string can either be
	// "source" or "target". The first pad is the old pad, the second one is the new pad
	LinkConnectionChangedCallback func(DiagramLink, string, ConnectionPad, ConnectionPad)
	// LinkSegmentMouseDownSecondaryCallback is called when a secondary button MouseDown occurs in a link segment
	LinkSegmentMouseDownSecondaryCallback func(DiagramLink, *desktop.MouseEvent)
	// LinkSegmentMouseUpCallback is called when a MouseUp occurs in a link segment and it was either the
	// secondary button or it was the primary button but at a different location than the MouseDown
	LinkSegmentMouseUpCallback func(DiagramLink, *desktop.MouseEvent)
	// MouseDownCallback is called when a MouseDown occurs in the diagram
	MouseDownCallback func(*desktop.MouseEvent)
	// MouseInCallback is called when a MouseIn occurs in the diagram
	MouseInCallback func(*desktop.MouseEvent)
	// MouseMovedCallback is called when a MouseMove occurs in the diagram
	MouseMovedCallback func(*desktop.MouseEvent)
	// MouseOutCallback is called when a MouseOut occurs in the diagram
	MouseOutCallback func()
	// MouseUpCallback is invoked when a MouseUp occurs in the diagram
	MouseUpCallback func(*desktop.MouseEvent)
	// OnTappedCallback is called when the diagram background is tapped. If present, it overrides the default
	// diagram behavior for Tapped()
	OnTappedCallback func(*DiagramWidget, *fyne.PointEvent)
	// PrimaryDiagramElementSelectionChangedCallback is called when the primary element selection changes
	PrimaryDiagramElementSelectionChangedCallback func(string)
	// ElementTappedExtendsSelection determines the behavior when one or more elements are already selected and
	// an element that is not currently selected is tapped. When true, the new element is added to the selection.
	// When false, the selection is cleared and the new element is made the only selected element.
	ElementTappedExtendsSelection bool
	// contains filtered or unexported fields
}

DiagramWidget maintains a diagram consisting of DiagramNodes and DiagramLinks. The layout of the nodes and links does not change when the DiagramWidget is resized: they are either positioned manually (interactively) or programmatically.

func NewDiagramWidget

func NewDiagramWidget(id string) *DiagramWidget

NewDiagramWidget creates a DiagramWidget. The user-supplied ID can be used to map the diagram to data structures within the of the application. It is expected to be unique within the application

func (*DiagramWidget) BringForward

func (dw *DiagramWidget) BringForward(elementID string)

BringForward moves the diagram element on top of the next element of the display list

func (*DiagramWidget) BringToFront

func (dw *DiagramWidget) BringToFront(elementID string)

BringToFront moves the diagram element to the top of the display list (which is the back of the DiagramElements list)

func (*DiagramWidget) ClearSelection

func (dw *DiagramWidget) ClearSelection()

ClearSelection clears the selection and invokes the PrimaryDiagramElementSelectionChangedCallback

func (*DiagramWidget) ClearSelectionNoCallback

func (dw *DiagramWidget) ClearSelectionNoCallback()

ClearSelectionNoCallback clears the selection. It does not invoke the PrimaryDiagramElementSelectionChangedCallback

func (*DiagramWidget) CreateRenderer

func (dw *DiagramWidget) CreateRenderer() fyne.WidgetRenderer

CreateRenderer creates the renderer for the diagram

func (*DiagramWidget) Cursor

func (dw *DiagramWidget) Cursor() desktop.Cursor

Cursor returns the default cursor

func (*DiagramWidget) DiagramElementTapped

func (dw *DiagramWidget) DiagramElementTapped(de DiagramElement)

DiagramElementTapped adds the element to the selection when the element is tapped

func (*DiagramWidget) DiagramNodeDragged

func (dw *DiagramWidget) DiagramNodeDragged(node *BaseDiagramNode, event *fyne.DragEvent)

DiagramNodeDragged moves the indicated node and refreshes any links that may be attached to it

func (*DiagramWidget) DisplaceNode

func (dw *DiagramWidget) DisplaceNode(node DiagramNode, delta fyne.Position)

DisplaceNode moves the indicated node, refreshes any links that may be attached to it, and adjusts the bounds of the drawing area

func (*DiagramWidget) GetBackgroundColor

func (dw *DiagramWidget) GetBackgroundColor() color.Color

GetBackgroundColor returns the background color for the widget from the diagram's theme, which may be different from the application's theme.

func (*DiagramWidget) GetDiagramElement

func (dw *DiagramWidget) GetDiagramElement(elementID string) DiagramElement

GetDiagramElement returns the diagram element with the specified ID, whether it is a node or a link

func (*DiagramWidget) GetDiagramElements

func (dw *DiagramWidget) GetDiagramElements() []DiagramElement

GetDiagramElements returns an array all of the diagram's DiagramElements

func (dw *DiagramWidget) GetDiagramLink(id string) DiagramLink

GetDiagramLink returns the diagram link with the indicated ID

func (dw *DiagramWidget) GetDiagramLinks() []DiagramLink

GetDiagramLinks returns a map of all of the diagram's DiagramElements

func (*DiagramWidget) GetDiagramNode

func (dw *DiagramWidget) GetDiagramNode(id string) DiagramNode

GetDiagramNode returns the diagram node with the indicated ID

func (*DiagramWidget) GetDiagramNodes

func (dw *DiagramWidget) GetDiagramNodes() []DiagramNode

GetDiagramNodes returns a map of all of the diagram's DiagramElements

func (*DiagramWidget) GetForegroundColor

func (dw *DiagramWidget) GetForegroundColor() color.Color

GetForegroundColor returns the foreground color from the diagram's theme, which may be different from the application's theme

func (*DiagramWidget) GetPrimarySelection

func (dw *DiagramWidget) GetPrimarySelection() DiagramElement

GetPrimarySelection returns the diagram element that is currently selected

func (*DiagramWidget) IsSelected

func (dw *DiagramWidget) IsSelected(de DiagramElement) bool

IsSelected returns true if the indicated element is currently part of the selection

func (*DiagramWidget) RemoveElement

func (dw *DiagramWidget) RemoveElement(elementID string)

RemoveElement removes the element from the diagram. It also removes any linkss to the element

func (*DiagramWidget) SelectDiagramElement

func (dw *DiagramWidget) SelectDiagramElement(element DiagramElement)

SelectDiagramElement clears the selection, makes the indicated element the primary selection, and invokes the PrimaryDiagramElementSelectionChangedCallback

func (*DiagramWidget) SelectDiagramElementNoCallback

func (dw *DiagramWidget) SelectDiagramElementNoCallback(id string)

SelectDiagramElementNoCallback makes the indicated element the PrimarySelection. It does not invoke the PrimaryDiagramElementSelectionChangedCallback

func (*DiagramWidget) SendBackward

func (dw *DiagramWidget) SendBackward(elementID string)

SendBackward moves the diagram element on top of the next element of the display list

func (*DiagramWidget) SendToBack

func (dw *DiagramWidget) SendToBack(elementID string)

SendToBack moves the diagram element to the top of the display list (which is the front of the DiagramElements list)

func (*DiagramWidget) StartNewLinkConnectionTransaction

func (dw *DiagramWidget) StartNewLinkConnectionTransaction(link DiagramLink)

StartNewLinkConnectionTransaction starts the process of adding a link, setting up for the source connection

type Handle

type Handle struct {
	widget.BaseWidget
	// contains filtered or unexported fields
}

Handle is a widget used to manipulate the size or shape of its owning DiagramElement

func NewHandle

func NewHandle(diagramElement DiagramElement) *Handle

NewHandle creates a handle for the specified DiagramElement

func (*Handle) CreateRenderer

func (h *Handle) CreateRenderer() fyne.WidgetRenderer

CreateRenderer is the required method for the Handle widget

func (*Handle) DragEnd

func (h *Handle) DragEnd()

DragEnd passes the event on to the owning DiagramElement

func (*Handle) Dragged

func (h *Handle) Dragged(event *fyne.DragEvent)

Dragged respondss to drag events, passing them on to the owning DiagramElement. It is the DiagramElement that determines what to do as a result of the drag.

func (*Handle) Move

func (h *Handle) Move(position fyne.Position)

Move changes the position of the handle

type LinkEnd

type LinkEnd int

LinkEnd is an enumeration that identifies the ends of a link

const (
	SOURCE LinkEnd = iota
	TARGET
)

Specify the enumerated values for LinkEnd

func (LinkEnd) ToString

func (le LinkEnd) ToString() string

ToString returns a string indicating which end is represented by the LinkEnd value

type LinkPoint

type LinkPoint struct {
	widget.BaseWidget
	// contains filtered or unexported fields
}

LinkPoint identifies the point at which a link end is connected to another diagram element's connection pad

func NewLinkPoint

func NewLinkPoint(link DiagramLink) *LinkPoint

NewLinkPoint creates an instance of a LinkPoint for a specific DiagramLink

func (*LinkPoint) CreateRenderer

func (lp *LinkPoint) CreateRenderer() fyne.WidgetRenderer

CreateRenderer creates the renderere for a LinkPoint

func (lp *LinkPoint) GetLink() DiagramLink

GetLink returns the Link to which the LinkPoint belongs

func (*LinkPoint) IsConnectionAllowed

func (lp *LinkPoint) IsConnectionAllowed(connectionPad ConnectionPad) bool

IsConnectionAllowed returns true if a connection is permitted with the indicated pad. The question is passed to the owning link

type LinkSegment

type LinkSegment struct {
	widget.BaseWidget
	// contains filtered or unexported fields
}

LinkSegment is a widget representing a single line segment belonging to a link

func NewLinkSegment

func NewLinkSegment(link *BaseDiagramLink, p1 fyne.Position, p2 fyne.Position) *LinkSegment

NewLinkSegment returns a LinkSegment belonging to the indicated Link

func (*LinkSegment) CreateRenderer

func (ls *LinkSegment) CreateRenderer() fyne.WidgetRenderer

CreateRenderer creates the renderer for the LinkSegment

func (*LinkSegment) MouseDown

func (ls *LinkSegment) MouseDown(event *desktop.MouseEvent)

MouseDown behavior depends upon the mouse event. If it is the primary button, it records the locateion of the MouseDown in preparation for a MouseUp at the same location, which will trigger Tapped() behavior. Otherwise, if it is the seconday button and a callback is present, it will invoke the callback

func (*LinkSegment) MouseUp

func (ls *LinkSegment) MouseUp(event *desktop.MouseEvent)

MouseUp behavior depends on the mouse event. If it is the primary button and it is at the same location as the MouseDown, the Tapped() behavior is invoked. Otherwise, if there is a callback present, the callback is invoked.

func (*LinkSegment) SetPoints

func (ls *LinkSegment) SetPoints(p1 fyne.Position, p2 fyne.Position)

SetPoints sets the endpoints of the LinkSegment

type PointPad

type PointPad struct {
	widget.BaseWidget
	// contains filtered or unexported fields
}

PointPad is a ConnectionPad consisting of a single point (the Position of the PointPad)

func NewPointPad

func NewPointPad(padOwner DiagramElement) *PointPad

NewPointPad creates a PointPad and associates it with the DiagramElement. Note that, by default, the position of the PointPad will be (0,0), i.e. the origin of the DiagramElement.

func (*PointPad) CreateRenderer

func (pp *PointPad) CreateRenderer() fyne.WidgetRenderer

CreateRenderer creates the WidgetRenderer for a PointPad

func (*PointPad) GetCenterInDiagramCoordinates

func (pp *PointPad) GetCenterInDiagramCoordinates() fyne.Position

GetCenterInDiagramCoordinates returns the position in diagram coordinates

func (*PointPad) GetPadOwner

func (cp *PointPad) GetPadOwner() DiagramElement

func (*PointPad) MouseDown

func (pp *PointPad) MouseDown(event *desktop.MouseEvent)

MouseDown responds to mouse down events

func (*PointPad) MouseIn

func (pp *PointPad) MouseIn(event *desktop.MouseEvent)

MouseIn responds to mouse movements within the pointPadSize distance of the center

func (*PointPad) MouseMoved

func (pp *PointPad) MouseMoved(event *desktop.MouseEvent)

MouseMoved responds to mouse movements within the pointPadSize distance of the center

func (*PointPad) MouseOut

func (pp *PointPad) MouseOut()

MouseOut responds to mouse movements within the pointPadSize distance of the center

func (*PointPad) MouseUp

func (pp *PointPad) MouseUp(event *desktop.MouseEvent)

MouseUp responds to mouse up events

func (*PointPad) SetPadColor

func (pp *PointPad) SetPadColor(c color.Color)

SetPadColor sets the color to be used in rendering the pad

type Polygon

type Polygon struct {
	widget.BaseWidget

	// StrokeWidth is the width of the polygon perimeter line
	StrokeWidth float32
	// StrokeColor is the color of the polygon perimeter line
	StrokeColor color.Color
	// FillColor is the color if the polygon interior. A nil value indicates
	// no fill
	FillColor color.Color
	// contains filtered or unexported fields
}

Polygon defines a canvas object which renders a polygon defined with respect to a reference point (the Position of the canvas object). The polygon is intended to be a decoration on a line. The nominal definition of the polygon assumes that the nominal line lays along the X axis extending to the right of the reference point. The polygon is defined as a series of points, with (0,0) corresponting to the the polygon's Position. When rendered, the polygon is rotated by the BaseAngle. The BaseAngle is supplied by the Link for which the Polygon is a decoration. By default, the polygon is a closed structure that can optionally be filled by providing p fill color (the default is no fill). SetClosed(false) can be used to make the structure open, which makes it a polyline. Fill color is ignored in this case. By default, stroke color and fill color are color.Black

func NewPolygon

func NewPolygon(definingPoints []fyne.Position) *Polygon

NewPolygon creates a Polygon as defined by the supplied points

func (*Polygon) CreateRenderer

func (p *Polygon) CreateRenderer() fyne.WidgetRenderer

CreateRenderer creates an instance of the renderer for the Polygon

func (*Polygon) GetReferenceLength

func (p *Polygon) GetReferenceLength() float32

GetReferenceLength returns the length of the decoration along the reference axis

func (*Polygon) MinSize

func (p *Polygon) MinSize() fyne.Size

MinSize returns the minimum size based on nominal polygon points, base angle, and stroke width

func (*Polygon) SetClosed

func (p *Polygon) SetClosed(closed bool)

SetClosed determines whether the polygon is open or closed. A value of false makes the polygon a polyline

func (*Polygon) SetFillColor

func (p *Polygon) SetFillColor(fillColor color.Color)

SetFillColor sets the color that will be used for the polygon interior A nil value indicates there is no fill

func (*Polygon) SetSolid

func (p *Polygon) SetSolid(value bool)

SetSolid determines whether the foreground color should be used to fill the polygon. It has no effect if the polygon is open instead of closed

func (*Polygon) SetStrokeColor

func (p *Polygon) SetStrokeColor(strokeColor color.Color)

SetStrokeColor sets the color that will be used for the polygon perimeter

func (*Polygon) SetStrokeWidth

func (p *Polygon) SetStrokeWidth(strokeWidth float32)

SetStrokeWidth sets the width of the linke that will be used for the polygon perimeter

type RectanglePad

type RectanglePad struct {
	widget.BaseWidget
	// contains filtered or unexported fields
}

RectanglePad provides a ConnectionPad corresponding to the perimeter of the DiagramElement owning the pad.

func NewRectanglePad

func NewRectanglePad(padOwner DiagramElement) *RectanglePad

NewRectanglePad creates a RectanglePad and associates it with the DiagramElement. The size of the pad becomes the size of the padOwner.

func (*RectanglePad) CreateRenderer

func (rp *RectanglePad) CreateRenderer() fyne.WidgetRenderer

CreateRenderer creates the WidgetRenderer for the RectanglePad

func (*RectanglePad) GetCenterInDiagramCoordinates

func (rp *RectanglePad) GetCenterInDiagramCoordinates() fyne.Position

GetCenterInDiagramCoordinates returns the center of the pad in the diagram's coordinate system

func (*RectanglePad) GetPadOwner

func (cp *RectanglePad) GetPadOwner() DiagramElement

func (*RectanglePad) MouseDown

func (rp *RectanglePad) MouseDown(event *desktop.MouseEvent)

MouseDown responds to mouse down events

func (*RectanglePad) MouseIn

func (rp *RectanglePad) MouseIn(event *desktop.MouseEvent)

MouseIn responds to the mouse entering the bounds of the RectanglePad

func (*RectanglePad) MouseMoved

func (rp *RectanglePad) MouseMoved(event *desktop.MouseEvent)

MouseMoved responds to mouse movements within the rectangle pad

func (*RectanglePad) MouseOut

func (rp *RectanglePad) MouseOut()

MouseOut responds to mouse movements leaving the rectangle pad

func (*RectanglePad) MouseUp

func (rp *RectanglePad) MouseUp(event *desktop.MouseEvent)

MouseUp responds to mouse up events

func (*RectanglePad) SetPadColor

func (rp *RectanglePad) SetPadColor(c color.Color)

SetPadColor sets the color to be used in rendering the pad

Directories

Path Synopsis
Package geometry implements various useful geometric primitives.
Package geometry implements various useful geometric primitives.
r2
Package r2 implements operations relating to objects in R2.
Package r2 implements operations relating to objects in R2.

Jump to

Keyboard shortcuts

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