diff --git a/README.md b/README.md index ed562b75..d70fb738 100644 --- a/README.md +++ b/README.md @@ -104,9 +104,9 @@ This collection should be considered a work in progress. When changes are made, serious consideration will be given to backward compatibility, but compatibility is not guaranteed. -The DiagramWidget itself is intended to be incorporated into a Fyne application. It 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. +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. @@ -125,7 +125,7 @@ or resized. Diagram Widget

-**DiagramElement Interface** +### 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 @@ -134,12 +134,12 @@ for showing and hiding the handles that are used for graphically manipulating th 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** +### 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. -**DiagramLink Widget** +### DiagramLink Widget 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 diff --git a/cmd/diagramdemo/main.go b/cmd/diagramdemo/main.go index 835b03f8..a65c898e 100644 --- a/cmd/diagramdemo/main.go +++ b/cmd/diagramdemo/main.go @@ -17,9 +17,6 @@ var forceticks int = 0 func forceanim(diagramWidget *diagramwidget.DiagramWidget) { - // XXX: very naughty -- accesses shared memory in potentially unsafe - // ways, this almost certainly has race conditions... don't do this! - for { if forceticks > 0 { diagramwidget.StepForceLayout(diagramWidget, 300) diff --git a/widget/diagramwidget/anchoredtext.go b/widget/diagramwidget/anchoredtext.go index e24d0665..2b5992c3 100644 --- a/widget/diagramwidget/anchoredtext.go +++ b/widget/diagramwidget/anchoredtext.go @@ -40,7 +40,6 @@ func NewAnchoredText(text string) *AnchoredText { at.textEntry = widget.NewEntryWithData(at.displayedTextBinding) at.textEntry.Wrapping = fyne.TextWrapOff at.textEntry.Validator = nil - at.textEntry.Enable() at.ExtendBaseWidget(at) return at } diff --git a/widget/diagramwidget/connectionpad.go b/widget/diagramwidget/connectionpad.go index f18e15f3..dd063a19 100644 --- a/widget/diagramwidget/connectionpad.go +++ b/widget/diagramwidget/connectionpad.go @@ -68,8 +68,7 @@ func (rp *RectanglePad) MouseDown(event *desktop.MouseEvent) { if link.isConnectionAllowed(connectionTransaction.LinkPoint, rp) { padOwnerPosition := rp.padOwner.Position() pseudoEvent := &fyne.DragEvent{ - PointEvent: fyne.PointEvent{}, - Dragged: fyne.NewDelta(event.Position.X+padOwnerPosition.X, event.Position.Y+padOwnerPosition.Y), + Dragged: fyne.NewDelta(event.Position.X+padOwnerPosition.X, event.Position.Y+padOwnerPosition.Y), } // the link point has to be changed before the handle is dragged connectionTransaction.LinkPoint = connectionTransaction.Link.GetLinkPoints()[1] diff --git a/widget/diagramwidget/geometry/r2/vec2.go b/widget/diagramwidget/geometry/r2/vec2.go index b50dd74a..132edbd0 100644 --- a/widget/diagramwidget/geometry/r2/vec2.go +++ b/widget/diagramwidget/geometry/r2/vec2.go @@ -31,7 +31,7 @@ func (v Vec2) Length() float64 { // Dot returns the dot product of vector v and u func (v Vec2) Dot(u Vec2) float64 { - return v.X*u.X + v.Y + u.Y + return v.X*u.X + v.Y*u.Y } // Add returns the sum of vector v and u