ajstarks / giocanvas

Canvas API built with Gio
Other
141 stars 14 forks source link

Adding path.Close() #8

Closed jonegil closed 3 years ago

jonegil commented 3 years ago

By closing the path, the canvas can be resized dynamically by inheriting constraints form the parent in the layout structure.

With this fix, one can set the size of the canvas through the constrains handed down to it from it's parent in the layout structure. That allows for dynamic canvas size.

I've gif'ed it in this tweet. The width of the canvas is set through gtx.Constraints.Max.X, while the height is hardcoded to 500. https://twitter.com/jonegilstrand/status/1452352259963117570

Without path.close(), resizing throws a "panic path not closed". With the explicit close, it's all good.

I have not gone through the rest of the code to check if a path.close() should be included.

By the way, I could share with you the example program behind the gif to the issue raised on giocanvas?

ajstarks commented 3 years ago

Added with revision https://github.com/ajstarks/giocanvas/commit/2761fc613cd586357b459c9777e77a793cc9018a