Resizing working again.

This commit is contained in:
Scott Duensing 2022-08-16 17:43:21 -05:00
parent 105a8a63a2
commit 74d4e05af9
2 changed files with 24 additions and 22 deletions

View file

@ -223,8 +223,6 @@ void widgetAdd(WidgetT *target, int16_t x, int16_t y, WidgetT *widget) {
widget->r.x = x;
widget->r.y = y;
arrput(t->children, widget);
logWrite("Adding %s to %s\n", widget->reg->widgetName, t->reg->widgetName);
}
@ -259,7 +257,6 @@ static uint8_t widgetChildrenDirtyPaint(WidgetT *widget, uint8_t paint) {
updated = 1;
// Paint it.
widget->children[x]->reg->paint(widget->children[x]);
logWrite("Painted %s on %s\n", widget->children[x]->reg->widgetName, widget->children[x]->parent->reg->widgetName);
} else {
updated = 1;
}

View file

@ -59,8 +59,6 @@ static void windowCache(WindowT *w, uint8_t redrawWindow) {
ColorT gadgetColor;
SurfaceT *target = surfaceGet();
logWrite("Caching window\n");
// Move the window to 0,0 to draw it into it's own surface.
originalX = w->base.r.x;
originalY = w->base.r.y;
@ -78,7 +76,6 @@ static void windowCache(WindowT *w, uint8_t redrawWindow) {
// Do we need to create a surface?
if (!w->cached) {
w->cached = surfaceCreate(w->base.r.w, w->base.r.h);
logWrite("New cache surface\n");
}
// Draw into cache.
@ -557,31 +554,40 @@ RegisterT *windowRegister(uint8_t magic) {
void windowResize(WindowT *win, uint16_t width, uint16_t height) {
/*
int16_t delta;
int16_t x = 0;
int16_t y = 0;
int16_t w = 0;
// Too small?
if (width < (GADGET_SIZE * 4) + 15) width = (GADGET_SIZE * 4) + 15;
if (height < (GADGET_SIZE * 4) + 15) height = (GADGET_SIZE * 4) + 15;
// Too big?
if (win->bounds.w - win->bounds.x + (width - win->base.r.w) + win->offset.x > surfaceWidthGet(win->content)) {
// Do we have room to scroll content into view?
if (win->offset.x > 0) {
delta = width - win->base.r.w;
if (delta > win->offset.x) delta = win->offset.x;
win->offset.x -= delta;
if (win->scroll->scrollh) {
x = hscrollValueGet(win->scroll->scrollh);
if (win->scroll->scrollv) w = win->scroll->scrollv->base.r.w;
if (win->bounds.w - win->bounds.x + (width - win->base.r.w) + x > surfaceWidthGet(win->scroll->area) + w) {
// Do we have room to scroll content into view?
if (x > 0) {
delta = width - win->base.r.w;
if (delta > x) delta = x;
hscrollValueSet(win->scroll->scrollh, x - delta);
}
width = (win->base.r.w - (win->bounds.x2 - win->bounds.x) - x + surfaceWidthGet(win->scroll->area) + w);
}
width = (win->base.r.w - (win->bounds.x2 - win->bounds.x) - win->offset.x + surfaceWidthGet(win->content));
}
if (win->bounds.h - win->bounds.y + (height - win->base.r.h) + win->offset.y > surfaceHeightGet(win->content)) {
// Do we have room to scroll content into view?
if (win->offset.y > 0) {
delta = height - win->base.r.h;
if (delta > win->offset.y) delta = win->offset.y;
win->offset.y -= delta;
if (win->scroll->scrollv) {
y = vscrollValueGet(win->scroll->scrollv);
if (win->bounds.h - win->bounds.y + (height - win->base.r.h) + y > surfaceHeightGet(win->scroll->area)) {
// Do we have room to scroll content into view?
if (y > 0) {
delta = height - win->base.r.h;
if (delta > y) delta = y;
vscrollValueSet(win->scroll->scrollv, y - delta);
}
height = (win->base.r.h - (win->bounds.y2 - win->bounds.y) - y + surfaceHeightGet(win->scroll->area));
}
height = (win->base.r.h - (win->bounds.y2 - win->bounds.y) - win->offset.y + surfaceHeightGet(win->content));
}
// Did the size change?
@ -594,7 +600,6 @@ void windowResize(WindowT *win, uint16_t width, uint16_t height) {
win->base.r.h =height;
windowCache(win, 1);
}
*/
}