WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

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

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

// 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?

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