Skip to content

Commit

Permalink
Addressed Jacob's feedback.
Browse files Browse the repository at this point in the history
  • Loading branch information
pbrown12303 committed Aug 15, 2023
1 parent 9130c23 commit c2b4174
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 13 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -125,7 +125,7 @@ or resized.
<img src="img/DiagramWidget.png" width="1024" height="880" alt="Diagram Widget" style="max-width: 100%" />
</p>

**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
Expand All @@ -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
Expand Down
3 changes: 0 additions & 3 deletions cmd/diagramdemo/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion widget/diagramwidget/anchoredtext.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
3 changes: 1 addition & 2 deletions widget/diagramwidget/connectionpad.go
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion widget/diagramwidget/geometry/r2/vec2.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c2b4174

Please sign in to comment.