diff ios/dw.m @ 2448:7e1828dd4fe0

iOS: Fix scrollbox content not expanding to take the full area if smaller. General dwtest code cleanup.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Fri, 09 Apr 2021 23:38:59 +0000
parents 8723c01fb87e
children 6edaa9382046
line wrap: on
line diff
--- a/ios/dw.m	Fri Apr 09 22:17:42 2021 +0000
+++ b/ios/dw.m	Fri Apr 09 23:38:59 2021 +0000
@@ -2858,25 +2858,25 @@
                     NSArray *subviews = [scrollbox subviews];
                     DWBox *contentbox = [subviews firstObject];
                     Box *thisbox = [contentbox box];
-                    CGSize contentsize = [scrollbox contentSize];
-                    CGRect frame = [contentbox frame];
+                    /* We start with the content being the available size */
+                    CGRect frame = CGRectMake(0,0,rect.size.width,rect.size.height);
 
                     /* Get the required space for the box */
                     _dw_resize_box(thisbox, &depth, x, y, 1);
 
-                    if(contentsize.width < thisbox->minwidth)
+                    /* Expand the content box to the size of the contents */
+                    if(frame.size.width < thisbox->minwidth)
                     {
-                        contentsize.width = thisbox->minwidth;
+                        frame.size.width = thisbox->minwidth;
                     }
-                    if(contentsize.height < thisbox->minheight)
+                    if(frame.size.height < thisbox->minheight)
                     {
-                        contentsize.height = thisbox->minheight;
+                        frame.size.height = thisbox->minheight;
                     }
-                    frame.size = contentsize;
                     [contentbox setFrame:frame];
 
                     /* Layout the content of the scrollbox */
-                    _dw_do_resize(thisbox, contentsize.width, contentsize.height);
+                    _dw_do_resize(thisbox, frame.size.width, frame.size.height);
                     _dw_handle_resize_events(thisbox);
                 }
                 /* Special handling for spinbutton controls */