Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use splitter double tap on border to alternate between max/min size. #1655

Merged
merged 1 commit into from Nov 30, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
25 changes: 23 additions & 2 deletions kivy/uix/splitter.py
Expand Up @@ -14,8 +14,8 @@

The :class:`Splitter` is a widget that helps you re-size it's child
widget/layout by letting you re-size it via
dragging the boundary. This widget is similar to the
:class:`~kivy.uix.scrollview.ScrollView` in that it allows only one child
dragging the boundary or double tapping the boundary. This widget is similar to
the :class:`~kivy.uix.scrollview.ScrollView` in that it allows only one child
widget.

Usage::
Expand Down Expand Up @@ -247,6 +247,27 @@ def strip_move(self, instance, touch):
def strip_up(self, instance, touch):
if touch.grab_current is not instance:
return

if touch.is_double_tap:
max_size = self.max_size
min_size = self.min_size
sz_frm = self.sizable_from[0]
s = self.size

if sz_frm in ('t', 'b'):
if self.size_hint_y:
self.size_hint_y = None
if s[1] - min_size <= max_size - s[1]:
self.height = max_size
else:
self.height = min_size
else:
if self.size_hint_x:
self.size_hint_x = None
if s[0] - min_size <= max_size - s[0]:
self.width = max_size
else:
self.width = min_size
touch.ungrab(instance)
self.dispatch('on_release')

Expand Down