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

Improve extensibility of the DiagramWidget #83

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

pbrown12303
Copy link
Contributor

These changes improve the extensibility of the DiagramWidget. Changes include:

  • The ability to add a background canvas object to a diagram
  • The ability to add user-defined connection pads to diagram elements
  • Addition of AnchoredText callbacks to facilitate coordinating changes to the anchored text

Added background graphic capability and an example of extending a DiagramNode so that vertical movement and resizing are disallowed.
Added DiagramWidget override callbacks for the drawing area Dragged() and DragEnd() functions. Added DiagramElement.SetConnectionPad() function so that custom pads can be added to a DiagramElement. Added example custom pads to the demo.
@coveralls
Copy link

Pull Request Test Coverage Report for Build 7492839566

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.9%) to 46.941%

Totals Coverage Status
Change from base Build 7373224328: -0.9%
Covered Lines: 1895
Relevant Lines: 4037

💛 - Coveralls

Copy link
Member

@andydotxyz andydotxyz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My apologies this has sat so long. I like the overall improvements but I think some of the API / docs could be improved as noted inline

@@ -105,12 +116,12 @@ type PointPad struct {

// 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 NewPointPad(padOwner DiagramElement) *PointPad {
func NewPointPad(lineWidth float32) *PointPad {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation here is now out of date.

@@ -223,11 +234,9 @@ type RectanglePad struct {

// NewRectanglePad creates a RectanglePad and associates it with the DiagramElement. The size of the
// pad becomes the size of the padOwner.
func NewRectanglePad(padOwner DiagramElement) *RectanglePad {
func NewRectanglePad() *RectanglePad {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With this change of signature the documents no longer correctly describe what it does.
What this API break intentional?

@@ -38,6 +37,9 @@ type DiagramWidget struct {
// DesiredSize specifies the size of the displayed diagram. Defaults to 800 x 600
DesiredSize fyne.Size

// MinimumSize is the minimum size for the diagram widget
MinimumSize fyne.Size
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this should be exposed as a field - the function MinSize() already returns that information.

// AnchoredTextChangedCallback is called when the position, offset, or text of the anchored text has changed
AnchoredTextChangedCallback func(*AnchoredText)
// DragEndCallback is called when a dragEnd event occurs in the drawing area
DragEndCallback func()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are pretty much duplicating the existing Fyne events for DragEnd etc - can they be exposed in the way of other widgets such that someone extending the widget can do that and replace the method, delegating back upward to the embedded widget?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants