Improve extensibility of the DiagramWidget#83
Improve extensibility of the DiagramWidget#83pbrown12303 wants to merge 4 commits intofyne-io:masterfrom
Conversation
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.
Pull Request Test Coverage Report for Build 7492839566
💛 - Coveralls |
andydotxyz
left a comment
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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() |
There was a problem hiding this comment.
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?
These changes improve the extensibility of the DiagramWidget. Changes include: