-
Running the code below, I would expect the canvas to fill the entire region of the parent and thus the line would be drawn from the top left (0,0) to the bottom right (1,1) of the parent (main window) However, this is not the case, the line is drawn and only covers about 40% of the region. How can I make it fill the entire region of the parent?
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
This should work: b := core.NewBody("Test")
c := core.NewCanvas(b)
c.Styler(func(s *styles.Style) {
s.Grow.Set(1, 1) // << this makes it take up the entire space
})
c.SetDraw(func(pc *paint.Context) {
pc.MoveTo(0, 0)
pc.LineTo(1, 1)
pc.StrokeStyle.Color = colors.Scheme.Error.Base
pc.Stroke()
})
b.RunMainWindow() Depending on your use case, you might also be interested in our data plots. |
Beta Was this translation helpful? Give feedback.
-
Yes the above works. Thank you. |
Beta Was this translation helpful? Give feedback.
This should work:
Depending on your use case, you might also be interested in our data plots.