Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DiagramWidget #55

Merged
merged 56 commits into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
931b139
Added diagramwidget, updated terminology
pbrown12303 Mar 13, 2023
55d7445
Fixed arrowhead direction
pbrown12303 Mar 15, 2023
daeaa67
Arrow decorations working at three locations
pbrown12303 Mar 17, 2023
21033d4
Stacked Decorations working
pbrown12303 Mar 17, 2023
d00df3b
Anchored Text working
pbrown12303 Mar 21, 2023
3e63240
Node handles working
pbrown12303 Mar 23, 2023
4e99290
Added connectionPads, identifiers
pbrown12303 Mar 24, 2023
6b3f337
All basic functionality in place
pbrown12303 Mar 29, 2023
5b99519
Added documentation to AnchoredText
pbrown12303 Apr 14, 2023
d8e92c8
Updated Readme.md and DiagramWidget documentation
pbrown12303 Apr 14, 2023
cbe3545
Fixed Readme.md formatting
pbrown12303 Apr 14, 2023
a072838
Update README.md
pbrown12303 Apr 14, 2023
5e96093
Update README.md
pbrown12303 Apr 14, 2023
bd3d70f
Documented ForceRepaint
pbrown12303 Apr 17, 2023
f7a8fe3
Removed .gitarchive, table and viewport widgets
pbrown12303 Apr 18, 2023
d412f53
Polygon decoration implemented
pbrown12303 Apr 23, 2023
9b5449b
Made refresh workaround private; go.mod image version
pbrown12303 Apr 27, 2023
562448b
Scrolling; ForceRefresh; factored out StringForceLayout
pbrown12303 Apr 27, 2023
2d17ea6
Delete explicitlayout
pbrown12303 Apr 27, 2023
f408904
Refined Polygon point positioning; Added pad interfaces.
pbrown12303 Apr 28, 2023
34cd696
Added documentation
pbrown12303 Apr 30, 2023
5b4c073
Handling of DiagramElement deletion
pbrown12303 May 2, 2023
456a9ce
Interaction Work
pbrown12303 May 17, 2023
b2f00fc
Link end movement implemented
pbrown12303 May 23, 2023
9f4ef1c
Added primarySelection
pbrown12303 May 24, 2023
6001e0a
Added selection functions
pbrown12303 May 25, 2023
c40991f
Added Tapped override
pbrown12303 May 26, 2023
2d5e9f3
Dynamic Link Creation; DiaagramElement kind checking
pbrown12303 Jun 8, 2023
16afb1f
Added mouse callbacks; made ConnectionTransaction public
pbrown12303 Jun 16, 2023
d45d1fb
Removed debug log entries
pbrown12303 Jun 26, 2023
9a29be0
Removed ForceRepaint workaround; consolidated properties
pbrown12303 Jul 12, 2023
25ae4e7
Added link mouse callbacks
pbrown12303 Jul 13, 2023
820beec
Ignore all executables
pbrown12303 Jul 18, 2023
03d72df
Fixed Refresh() bugs
pbrown12303 Jul 25, 2023
db73a10
Removed replace directive
pbrown12303 Jul 26, 2023
b19c2e6
Merge branch 'master' into diagramwidget
pbrown12303 Jul 26, 2023
c6ee81f
Merge changes
pbrown12303 Jul 26, 2023
bc24ccd
Changed diagram drag behavior; fixed dependencies
pbrown12303 Jul 28, 2023
f9c6702
Added comments
pbrown12303 Jul 28, 2023
58634eb
Fixed lint errors
pbrown12303 Jul 28, 2023
9130c23
Update box.go
pbrown12303 Jul 29, 2023
c2b4174
Addressed Jacob's feedback.
pbrown12303 Aug 15, 2023
6f11e6d
Fixed display flickering
pbrown12303 Sep 6, 2023
91eebaa
Added scrolling
pbrown12303 Sep 7, 2023
58a0e64
Improved link selection; Added bring to front/send to back
pbrown12303 Sep 7, 2023
3be0276
Fixed review feedback
pbrown12303 Sep 11, 2023
298d96f
Revert "Fixed review feedback"
pbrown12303 Sep 12, 2023
efe6454
Addressed review feedback
pbrown12303 Sep 12, 2023
6e5f359
Fixed static error in node.go line 55
pbrown12303 Sep 12, 2023
ba26990
Removed go.work.sum
pbrown12303 Sep 13, 2023
2a8813f
Made drawingArea private, added simulation events
pbrown12303 Sep 14, 2023
846dd70
Removed DiagramWidget.SimulateMouse... functions
pbrown12303 Sep 18, 2023
40bc5e2
Merge branch 'fyne-io:master' into diagramwidget
pbrown12303 Oct 13, 2023
a8defda
Upgrade to fyne 2.4.1
pbrown12303 Oct 17, 2023
57f5855
Merge branch 'master' into diagramwidget
pbrown12303 Oct 17, 2023
bc06b79
Renamed screenshot, removed TODO comment, edited README
pbrown12303 Oct 18, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 29 additions & 79 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ This repository holds community extensions for the [Fyne](https://fyne.io) toolk

This is in early development and more information will appear soon.

# Layouts
## Layouts

Community contributed layouts.

`import "fyne.io/x/fyne/layout"`

## Responsive Layout
### Responsive Layout

The responsive layout provides a "bootstrap like" configuration to automatically make containers and canvas reponsive to the window width. It reacts to the window size to resize and move the elements. The sizes are configured with a ratio of the **container** width (`0.5` is 50% of the container size).

Expand Down Expand Up @@ -51,13 +51,22 @@ layout := NewResponsiveLayout(
```


# Widgets
## Widgets

Community contributed widgets.
This package contains a collection of community-contributed widgets for the [Fyne](https://fyne.io/)
toolkit. The code here is intended to be production ready, but may be lacking
some desirable functional features. If you have suggestions for changes to
existing functionality or addition of new functionality, please look at the existing
issues in the repository to see if your idea is already on the table. If it is not,
feel free to open an issue.

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.

`import "fyne.io/x/fyne/widget"`

## Animated Gif
### Animated Gif

A widget that will run animated gifs.

Expand All @@ -70,7 +79,7 @@ gif, err := NewAnimatedGif(storage.NewFileURI("./testdata/gif/earth.gif"))
gif.Start()
```

## Calendar
### Calendar

A date picker which returns a [time](https://pkg.go.dev/time) object with the selected date.

Expand All @@ -91,18 +100,7 @@ calendar := widget.NewCalendar(time.Now(), onSelected, cellSize, padding)
```
[Demo](./cmd/hexwidget_demo/main.go) available for example usage

## DiagramWidget

This package contains a collection of widgets for the [Fyne](https://fyne.io/)
toolkit. The code here is intended to be production ready, but may be lacking
some desirable functional features. If you have suggestions for changes to
existing functionality or addition of new functionality, please look at the existing
issues in the repository to see if your idea is already on the table. If it is not,
feel free to open an issue.

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.
### 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.
Expand All @@ -113,69 +111,21 @@ 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 essentially self-managed from a layout perspective. DiagramNodes have no size
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.

* [demo](../../cmd/diagramdemo/main.go)
* [demo](./cmd/diagramdemo/main.go)
* [More Detail](./widget/diagramwidget/README.md)

<p align="center" markdown="1" style="max-width: 100%">
<img src="img/DiagramWidget.png" width="1024" height="880" alt="Diagram Widget" style="max-width: 100%" />
</p>

### 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.

### 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
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.

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 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.

## FileTree

### FileTree

An extension of widget.Tree for displaying a file system hierarchy.

Expand All @@ -191,7 +141,7 @@ tree.Sorter = func(u1, u2 fyne.URI) bool {
<img src="img/widget-filetree.png" width="1024" height="880" alt="FileTree Widget" style="max-width: 100%" />
</p>

## CompletionEntry
### CompletionEntry

An extension of widget.Entry for displaying a popup menu for completion. The "up" and "down" keys on the keyboard are used to navigate through the menu, the "Enter" key is used to confirm the selection. The options can also be selected with the mouse. The "Escape" key closes the selection list.

Expand Down Expand Up @@ -235,7 +185,7 @@ entry.OnChanged = func(s string) {
<img src="img/widget-completion-entry.png" width="825" height="634" alt="CompletionEntry Widget" style="max-width: 100%" />
</p>

## 7-Segment ("Hex") Display
### 7-Segment ("Hex") Display

A skeuomorphic widget simulating a 7-segment "hex" display. Supports setting
digits by value, as well as directly controlling which segments are on or
Expand All @@ -254,7 +204,7 @@ h := widget.NewHexWidget()
h.Set(0xf)
```

## Map
### Map

An OpenStreetMap widget that can the user can pan and zoom.
To use this in your app and be compliant with their requirements you may need to request
Expand All @@ -266,13 +216,13 @@ m := NewMap()

![](img/map.png)

# Data Binding
## Data Binding

Community contributed data sources for binding.

`import fyne.io/x/fyne/data/binding`

## WebString
### WebString

A `WebSocketString` binding creates a `String` data binding to the specified web socket URL.
Each time a message is read the value will be converted to a `string` and set on the binding.
Expand All @@ -287,7 +237,7 @@ The code above uses a test web sockets server from "PieSocket", you can run the
and go to [their test page](https://www.piesocket.com/websocket-tester) to send messages.
The widget will automatically update to the latest data sent through the socket.

## MqttString
### MqttString

A `MqttString` binding creates a `String` data binding to the specified _topic_ associated with
the specified **MQTT** client connection. Each time a message is received the value will be converted
Expand All @@ -310,13 +260,13 @@ if err := token.Error(); err != nil {
s, err := binding.NewMqttString(client, "fyne.io/x/string")
```

# Data Validation
## Data Validation

Community contributed validators.

`import fyne.io/x/fyne/data/validation`

## Password
### Password

A validator for validating passwords. Uses https://github.com/wagslane/go-password-validator
for validation using an entropy system.
Expand Down
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ module fyne.io/x/fyne
go 1.14

require (
fyne.io/fyne/v2 v2.3.5
fyne.io/fyne/v2 v2.4.1
github.com/Andrew-M-C/go.jsonvalue v1.1.2-0.20211223013816-e873b56b4a84
github.com/eclipse/paho.mqtt.golang v1.3.5
github.com/gorilla/websocket v1.4.2
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646
github.com/srwiley/rasterx v0.0.0-20210519020934-456a8d69b780
github.com/stretchr/testify v1.8.1
github.com/srwiley/rasterx v0.0.0-20220730225603-2ab79fcdd4ef
github.com/stretchr/testify v1.8.4
github.com/twpayne/go-geom v1.0.0
github.com/wagslane/go-password-validator v0.3.0
golang.org/x/image v0.3.0
golang.org/x/image v0.11.0
)
Loading