diff --git a/kivyblocks/boxViewer.py b/kivyblocks/boxViewer.py index 4069991..ae6beca 100644 --- a/kivyblocks/boxViewer.py +++ b/kivyblocks/boxViewer.py @@ -58,7 +58,7 @@ class BoxViewer(WidgetReady, BoxLayout): self.radius = self.options.get('radius',[]) self.box_width = CSize(options['boxwidth']) self.box_height = CSize(options['boxheight']) - self.viewContainer = VResponsiveLayout(cols=2,box_width=self.box_width) + self.viewContainer = VResponsiveLayout(box_width=self.box_width) if options.get('toolbar'): self.toolbar = Toolbar(options['toolbar']) lopts = options['dataloader'].copy() diff --git a/kivyblocks/responsivelayout.py b/kivyblocks/responsivelayout.py index 0090953..1de4846 100644 --- a/kivyblocks/responsivelayout.py +++ b/kivyblocks/responsivelayout.py @@ -27,10 +27,13 @@ class VResponsiveLayout(ScrollView): def on_box_width(self, *args): if not self._inner: return - self._inner.col_default_width = self.box_width + if self.box_width <= 1: + self._inner.col_default_width = self.width * self.box_width + else: + self._inner.col_default_width = self.box_width for w in self._inner.children: w.size_hint_x = None - w.width = self.box_width + w.width = self._inner.col_default_width self.setCols() def on_orientation(self,o): @@ -48,7 +51,7 @@ class VResponsiveLayout(ScrollView): return a def setCols(self,*args): - cols = floor(self.width / self.box_width) + cols = floor(self.width / self._inner.col_default_width) if cols < 1: cols = 1 self._inner.cols = cols