example/basic: redraw glitches
sbinet opened this issue · comments
hi,
first of all, great library! thanks a lot.
I have tried the basic
example, and I noticed that when resizing the window passed its original size, there were a few display glitches (see attached screenshot).
I am on ArchLinux.
Is it just a glitch b/c basic
doesn't do all that a robust app should do?
(TBH, I have also noticed the same behaviour in my own little app that's based on exp/shiny
as well)
first of all, great library! thanks a lot.
You're welcome!
Is it just a glitch b/c basic doesn't do all that a robust app should do?
That's right, the basic example doesn't handle resizing. This library isn't too aware of what's going on in shiny either. Most of these operations are just executed on an arbitrary *image.RGBA.
The easiest way to handle the size.Event{} at this time is just to recreate the frame with the new dimensions. I've thought to adding a frame.Reset(b *image.RGBA)
, but that would still require the size.Event{}
handling in shiny.
The one example I can show you that does this is in github.com/as/ui/win
func (w *Win) Resize(size image.Point) {
b := w.NewBuffer(size)
w.size = size
w.b.Release()
w.b = b
r := image.Rectangle{w.pad, w.size} //.Inset(1)
w.Frame = frame.New(r, w.Frame.Font, w.b.RGBA(), w.Frame.Color)
w.init()
w.scrollinit(w.pad)
w.Refresh()
}
The github.com/as/a package uses that to implement a tiling grid.
ok. so it's (as I suspected) related to these: